Class: DocTemplate::Tags::InsetTag
- Defined in:
- lib/doc_template/tags/inset_tag.rb
Constant Summary collapse
- STYLES_REGEXP =
{ bold: /font-weight:[6-9]00/i, italic: /font-style:italic/i }.freeze
- TAG_NAME =
'inset'
Constants inherited from BlockTag
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 BlockTag
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
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/doc_template/tags/inset_tag.rb', line 12 def parse(node, opts = {}) nodes = block_nodes(node) { |n| preserve_styles n, opts } content = parse_nested nodes.map(&:to_html).join, opts nodes.each(&:remove) @content = if gdoc?(opts) %(#{content}<p class="do-not-strip"></p>) else %(<div class="o-ld-inset">#{content}</div>) end replace_tag node self end |