Class: DocTemplate::Tags::LinkTag

Inherits:
BaseTag
  • Object
show all
Defined in:
lib/doc_template/tags/link_tag.rb

Direct Known Subclasses

ImTag, PosTag, QrdTag, SgimTag

Constant Summary collapse

FORTHCOMING_PATH =
'/forthcoming'

Constants inherited from BaseTag

BaseTag::SOFT_RETURN_RE, BaseTag::UNICODE_SPACES_RE

Instance Attribute Summary

Attributes inherited from BaseTag

#anchor, #content

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



8
9
10
11
12
13
14
15
16
17
# File 'lib/doc_template/tags/link_tag.rb', line 8

def parse(node, opts = {})
  # preserve the node content and replace only the tag by the link
  content = node.to_s.sub(self.class.tag_with_html_regexp, link(opts))

  opts[:iteration] ||= 1
  opts[:parent_node] = content
  @content = parse_nested content, opts
  replace_tag node
  self
end