element_tspan.erl 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. -module(element_tspan).
  2. -author('Konstantin Zakablukovsky').
  3. -include("nitro.hrl").
  4. -compile(export_all).
  5. render_element(Record) ->
  6. wf_tags:emit_tag(<<"tspan">>, nitro:render(Record#tspan.body),
  7. lists:append([
  8. [
  9. {<<"id">>, Record#tspan.id},
  10. {<<"class">>, Record#tspan.class},
  11. {<<"style">>, Record#tspan.style},
  12. {<<"x">>, Record#tspan.x},
  13. {<<"y">>, Record#tspan.y},
  14. {<<"dx">>, Record#tspan.dx},
  15. {<<"dy">>, Record#tspan.dy},
  16. {<<"rotate">>, Record#tspan.rotate},
  17. {<<"textLength">>, Record#tspan.textLength},
  18. {<<"lengthAdjust">>, Record#tspan.lengthAdjust},
  19. {<<"externalResourcesRequired">>, Record#tspan.externalResourcesRequired}
  20. ],
  21. svg_conditional_processing(Record),
  22. svg_core(Record),
  23. svg_graphical_event(Record),
  24. svg_presentation(Record),
  25. Record#tspan.data_fields,
  26. Record#tspan.aria_states
  27. ])).
  28. %% Common SVG attributes
  29. svg_conditional_processing(Record)-> [
  30. {<<"requiredExtensions">>, Record#tspan.requiredExtensions},
  31. {<<"requiredFeatures">>, Record#tspan.requiredFeatures},
  32. {<<"systemLanguage">>, Record#tspan.systemLanguage}
  33. ].
  34. svg_core(Record)-> [
  35. {<<"xml:base">>, Record#tspan.xmlbase},
  36. {<<"xml:lang">>, Record#tspan.xmllang},
  37. {<<"xml:space">>, Record#tspan.xmlspace}
  38. ].
  39. svg_graphical_event(Record)-> [
  40. {<<"onactivate">>, Record#tspan.onactivate},
  41. {<<"onclick">>, Record#tspan.onclick},
  42. {<<"onfocusin">>, Record#tspan.onfocusin},
  43. {<<"onfocusout">>, Record#tspan.onfocusout},
  44. {<<"onload">>, Record#tspan.onload_graphical},
  45. {<<"onmousedown">>, Record#tspan.onmousedown},
  46. {<<"onmousemove">>, Record#tspan.onmousemove},
  47. {<<"onmouseout">>, Record#tspan.onmouseout},
  48. {<<"onmouseover">>, Record#tspan.onmouseover},
  49. {<<"onmouseup">>, Record#tspan.onmouseup}
  50. ].
  51. svg_presentation(Record)-> [
  52. {<<"alignment-baseline">>, Record#tspan.alignment_baseline},
  53. {<<"baseline-shift">>, Record#tspan.baseline_shift},
  54. {<<"clip">>, Record#tspan.clip},
  55. {<<"clip-path">>, Record#tspan.clip_path},
  56. {<<"clip-rule">>, Record#tspan.clip_rule},
  57. {<<"color">>, Record#tspan.color},
  58. {<<"color-interpolation">>, Record#tspan.color_interpolation},
  59. {<<"color-interpolation-filters">>, Record#tspan.color_interpolation_filters},
  60. {<<"color-profile">>, Record#tspan.color_profile},
  61. {<<"color-rendering">>, Record#tspan.color_rendering},
  62. {<<"cursor">>, Record#tspan.cursor},
  63. {<<"direction">>, Record#tspan.direction},
  64. {<<"display">>, Record#tspan.display},
  65. {<<"dominant-baseline">>, Record#tspan.dominant_baseline},
  66. {<<"enable-background">>, Record#tspan.enable_background},
  67. {<<"fill">>, Record#tspan.fill},
  68. {<<"fill-opacity">>, Record#tspan.fill_opacity},
  69. {<<"fill-rule">>, Record#tspan.fill_rule},
  70. {<<"filter">>, Record#tspan.filter},
  71. {<<"flood-color">>, Record#tspan.flood_color},
  72. {<<"flood-opacity">>, Record#tspan.flood_opacity},
  73. {<<"font-family">>, Record#tspan.font_family},
  74. {<<"font-size">>, Record#tspan.font_size},
  75. {<<"font-size-adjust">>, Record#tspan.font_size_adjust},
  76. {<<"font-stretch">>, Record#tspan.font_stretch},
  77. {<<"font-style">>, Record#tspan.font_style},
  78. {<<"font-variant">>, Record#tspan.font_variant},
  79. {<<"font-weight">>, Record#tspan.font_weight},
  80. {<<"glyph-orientation-horizontal">>, Record#tspan.glyph_orientation_horizontal},
  81. {<<"glyph-orientation-vertical">>, Record#tspan.glyph_orientation_vertical},
  82. {<<"image-rendering">>, Record#tspan.image_rendering},
  83. {<<"kerning">>, Record#tspan.kerning},
  84. {<<"letter-spacing">>, Record#tspan.letter_spacing},
  85. {<<"lighting-color">>, Record#tspan.lighting_color},
  86. {<<"marker-end">>, Record#tspan.marker_end},
  87. {<<"marker-mid">>, Record#tspan.marker_mid},
  88. {<<"marker-start">>, Record#tspan.marker_start},
  89. {<<"mask">>, Record#tspan.mask},
  90. {<<"opacity">>, Record#tspan.opacity},
  91. {<<"overflow">>, Record#tspan.overflow},
  92. {<<"pointer-events">>, Record#tspan.pointer_events},
  93. {<<"shape-rendering">>, Record#tspan.shape_rendering},
  94. {<<"stop-color">>, Record#tspan.stop_color},
  95. {<<"stop-opacity">>, Record#tspan.stop_opacity},
  96. {<<"stroke">>, Record#tspan.stroke},
  97. {<<"stroke-dasharray">>, Record#tspan.stroke_dasharray},
  98. {<<"stroke-dashoffset">>, Record#tspan.stroke_dashoffset},
  99. {<<"stroke-linecap">>, Record#tspan.stroke_linecap},
  100. {<<"stroke-linejoin">>, Record#tspan.stroke_linejoin},
  101. {<<"stroke-miterlimit">>, Record#tspan.stroke_miterlimit},
  102. {<<"stroke-opacity">>, Record#tspan.stroke_opacity},
  103. {<<"stroke-width">>, Record#tspan.stroke_width},
  104. {<<"text-anchor">>, Record#tspan.text_anchor},
  105. {<<"text-decoration">>, Record#tspan.text_decoration},
  106. {<<"text-rendering">>, Record#tspan.text_rendering},
  107. {<<"unicode-bidi">>, Record#tspan.unicode_bidi},
  108. {<<"visibility">>, Record#tspan.visibility},
  109. {<<"word-spacing">>, Record#tspan.word_spacing},
  110. {<<"writing-mode">>, Record#tspan.writing_mode}
  111. ].