Sha256: 95bdf9282daa9465816eec55ce282a6fc7f0057ae5d342f78a63c9d59d60c030
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
module Hemingway module EntryNode def html footnote_content = [] paragraph_html = "" elements.each do |e| paragraph_html += e.html(footnote_content.size) footnote_content += e.footnote_html(footnote_content.size) end footnote_html = footnote_content.join Build.tag("div", paragraph_html + footnote_html, :class => "entry") end end module ParagraphNode def html(footnote_seed) paragraph_content = sequence.elements.map do |element| if element.respond_to?(:footnote_html) footnote_seed += 1 element.html(footnote_seed) elsif element.respond_to?(:newline) element.newline.html else element.html end end.join Build.tag("p", paragraph_content) end def footnote_html(footnote_seed) footnote_content = sequence.elements.reduce([]) do |memo, element| if element.respond_to?(:footnote_html) footnote_seed += 1 memo + [element.footnote_html(footnote_seed)] else memo end end end end module NewlineNode def html end def visible_html "\n" end end module WhitespaceNode def html end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hemingway-0.0.3 | lib/hemingway/latex_nodes.rb |