Class: DocTemplate::Tags::StandardTag
- Includes:
- ERB::Util
- Defined in:
- lib/doc_template/tags/standard_tag.rb
Constant Summary collapse
- STANDARD_RE =
- rl.2.2a.2
/[^\[\]]*\[(ela\.)?((rl|ri|rf|w|sl|l)\.[^\]]+)\]/i.freeze
- TAG_NAME =
RL.2.4 or ELA.RL.2.4
/(ela\.)?((rl|ri|rf|w|sl|l)\.[^\]]+)/.freeze
- TAG_RE =
/\[[^\]]*\]/.freeze
- TAG_SEPARATOR =
'[separator]'
- TEMPLATES =
{ default: 'standard.html.erb', gdoc: 'gdoc/standard.html.erb' }.freeze
Constants inherited from BaseTag
BaseTag::SOFT_RETURN_RE, BaseTag::UNICODE_SPACES_RE
Instance Attribute Summary
Attributes inherited from BaseTag
Instance Method Summary collapse
Methods inherited from BaseTag
#before_tag, #check_tag_soft_return, #content_until_break, #content_until_materials, #ela2?, #ela6?, #gdoc?, #include_break?, #include_break_for?, #materials, parse, #parse_nested, #parse_template, #placeholder, #placeholder_id, #render, #replace_tag, #tag_data, tag_with_html_regexp, #template_name, #template_path, template_path_for
Instance Method Details
#parse(node, opts) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/doc_template/tags/standard_tag.rb', line 15 def parse(node, opts) @content = render_template node, opts loop do break unless STANDARD_RE =~ @content @content = render_template Nokogiri::HTML.fragment(@content), opts end # preserve `li` element if node.name == 'li' @result = node.replace "<li class='#{node['class']}'>#{placeholder}</li>" else replace_tag node end self end |