Class: DocItem
- Inherits:
-
TextLine
- Object
- TextLineBuilderContext
- TextLine
- DocItem
- Defined in:
- lib/almirah/doc_items/doc_item.rb
Overview
rubocop:disable Style/Documentation
Direct Known Subclasses
Blockquote, CodeBlock, ControlledTable, ControlledTableRow, DocFooter, Image, MarkdownList, MarkdownTable, Paragraph, TodoBlock
Constant Summary collapse
- @@html_table_render_in_progress =
rubocop:disable Style/ClassVars
false
Instance Attribute Summary collapse
-
#parent_doc ⇒ Object
Returns the value of attribute parent_doc.
-
#parent_heading ⇒ Object
Returns the value of attribute parent_heading.
Instance Method Summary collapse
- #get_url ⇒ Object
-
#initialize(doc) ⇒ DocItem
constructor
A new instance of DocItem.
- #owner_document ⇒ Object
-
#split_table_cells(row) ⇒ Object
Splits a Markdown table row into its cell strings, treating a backslash-escaped pipe (|) as a literal character within a cell rather than a column separator (e.g. a “|” inside an inline code span such as ‘[[target|alias]]`).
Methods inherited from TextLine
#bold, #bold_and_italic, broken_links, #format_string, #inline_code, #italic, #link, link_registry, link_registry=, record_broken_link, reset_broken_links, #wiki_link
Methods inherited from TextLineBuilderContext
#bold, #bold_and_italic, #inline_code, #italic, #link, #wiki_link
Constructor Details
#initialize(doc) ⇒ DocItem
Returns a new instance of DocItem.
13 14 15 16 17 |
# File 'lib/almirah/doc_items/doc_item.rb', line 13 def initialize(doc) super() @parent_doc = doc @parent_heading = doc.headings[-1] end |
Instance Attribute Details
#parent_doc ⇒ Object
Returns the value of attribute parent_doc.
6 7 8 |
# File 'lib/almirah/doc_items/doc_item.rb', line 6 def parent_doc @parent_doc end |
#parent_heading ⇒ Object
Returns the value of attribute parent_heading.
6 7 8 |
# File 'lib/almirah/doc_items/doc_item.rb', line 6 def parent_heading @parent_heading end |
Instance Method Details
#get_url ⇒ Object
19 20 21 |
# File 'lib/almirah/doc_items/doc_item.rb', line 19 def get_url '' end |
#owner_document ⇒ Object
31 32 33 |
# File 'lib/almirah/doc_items/doc_item.rb', line 31 def owner_document @parent_doc end |
#split_table_cells(row) ⇒ Object
Splits a Markdown table row into its cell strings, treating a backslash-escaped pipe (|) as a literal character within a cell rather than a column separator (e.g. a “|” inside an inline code span such as ‘[[target|alias]]`). The escaping backslash is dropped so the cell renders the intended literal pipe.
27 28 29 |
# File 'lib/almirah/doc_items/doc_item.rb', line 27 def split_table_cells(row) row.split(/(?<!\\)\|/).map { |cell| cell.gsub('\\|', '|') } end |