Class: Protos::Markdown::Table
- Inherits:
-
Table
- Object
- Table
- Protos::Markdown::Table
- Defined in:
- lib/protos/markdown/table.rb
Instance Method Summary collapse
- #visit_code(node) ⇒ Object
- #visit_emph(node) ⇒ Object
- #visit_html_inline(node) ⇒ Object
- #visit_image(node) ⇒ Object
- #visit_link(node) ⇒ Object
- #visit_strong(node) ⇒ Object
- #visit_table(node) ⇒ Object
- #visit_table_cell(node) ⇒ Object
- #visit_table_header(node) ⇒ Object
- #visit_table_row(node) ⇒ Object
- #visit_text(node) ⇒ Object
Instance Method Details
#visit_code(node) ⇒ Object
45 46 47 |
# File 'lib/protos/markdown/table.rb', line 45 def visit_code(node) code { node.string_content } end |
#visit_emph(node) ⇒ Object
53 54 55 |
# File 'lib/protos/markdown/table.rb', line 53 def visit_emph(node) em { visit_children(node) } end |
#visit_html_inline(node) ⇒ Object
57 58 59 60 61 |
# File 'lib/protos/markdown/table.rb', line 57 def visit_html_inline(node) return if @sanitize raw safe(node.to_html(options: { render: { unsafe: true } })) end |
#visit_image(node) ⇒ Object
13 14 15 |
# File 'lib/protos/markdown/table.rb', line 13 def visit_image(node) img(src: node.url, alt: node.first&.string_content) end |
#visit_link(node) ⇒ Object
63 64 65 |
# File 'lib/protos/markdown/table.rb', line 63 def visit_link(node) a(href: node.url, title: node.title) { visit_children(node) } end |
#visit_strong(node) ⇒ Object
49 50 51 |
# File 'lib/protos/markdown/table.rb', line 49 def visit_strong(node) strong { visit_children(node) } end |
#visit_table(node) ⇒ Object
9 10 11 |
# File 'lib/protos/markdown/table.rb', line 9 def visit_table(node) visit_children(node) end |
#visit_table_cell(node) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/protos/markdown/table.rb', line 25 def visit_table_cell(node) if @inside_header head { visit_children(node) } else cell { visit_children(node) } end end |
#visit_table_header(node) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/protos/markdown/table.rb', line 17 def visit_table_header(node) @inside_header = true header do visit_children(node) end end |
#visit_table_row(node) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/protos/markdown/table.rb', line 37 def visit_table_row(node) row do visit_children(node) end @inside_header = false end |
#visit_text(node) ⇒ Object
33 34 35 |
# File 'lib/protos/markdown/table.rb', line 33 def visit_text(node) plain(node.string_content) end |