element_svgstyle.erl 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. -module(element_svgstyle).
  2. -author('Konstantin Zakablukovsky').
  3. -include("nitro.hrl").
  4. -compile(export_all).
  5. render_element(Record) ->
  6. wf_tags:emit_tag(<<"svgstyle">>, nitro:render(Record#svgstyle.body),
  7. lists:append([
  8. [
  9. {<<"id">>, Record#svgstyle.id},
  10. {<<"class">>, Record#svgstyle.class},
  11. {<<"style">>, Record#svgstyle.style},
  12. {<<"type">>, Record#svgstyle.type},
  13. {<<"media">>, Record#svgstyle.media},
  14. {<<"title">>, Record#svgstyle.title}
  15. ],
  16. svgstyle_core(Record),
  17. svgstyle_xlink(Record),
  18. Record#svgstyle.data_fields,
  19. Record#svgstyle.aria_states
  20. ])).
  21. %% Common SVG attributes
  22. svgstyle_core(Record)-> [
  23. {<<"xml:base">>, Record#svgstyle.xmlbase},
  24. {<<"xml:lang">>, Record#svgstyle.xmllang},
  25. {<<"xml:space">>, Record#svgstyle.xmlspace}
  26. ].
  27. svgstyle_xlink(Record)-> [
  28. {<<"xlink:href">>, Record#svgstyle.xlinkhref},
  29. {<<"xlink:type">>, Record#svgstyle.xlinktype},
  30. {<<"xlink:role">>, Record#svgstyle.xlinkrole},
  31. {<<"xlink:arcrole">>, Record#svgstyle.xlinkarcrole},
  32. {<<"xlink:title">>, Record#svgstyle.xlinktitle},
  33. {<<"xlink:show">>, Record#svgstyle.xlinkshow},
  34. {<<"xlink:actuate">>, Record#svgstyle.xlinkactuate}
  35. ].