Class: MindmapMFM
- Inherits:
-
Object
- Object
- MindmapMFM
- Defined in:
- lib/mindmap_mfm.rb
Instance Method Summary collapse
-
#initialize(s, debug: false) ⇒ MindmapMFM
constructor
A new instance of MindmapMFM.
-
#to_htc ⇒ Object
Returns an HTML-to-CSS object.
- #to_html(cssfile: nil) ⇒ Object
Constructor Details
#initialize(s, debug: false) ⇒ MindmapMFM
Returns a new instance of MindmapMFM.
15 16 17 18 19 20 21 |
# File 'lib/mindmap_mfm.rb', line 15 def initialize(s, debug: false) @debug = debug @rawdoc = build_rawdoc(s) @html = Kramdown::Document.new(@rawdoc).to_html end |
Instance Method Details
#to_htc ⇒ Object
Returns an HTML-to-CSS object
25 26 27 |
# File 'lib/mindmap_mfm.rb', line 25 def to_htc() HtmlToCss.new(@html) end |
#to_html(cssfile: nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mindmap_mfm.rb', line 29 def to_html(cssfile: nil) html = if cssfile then doc = Rexle.new(@html) link = Rexle::Element.new('link') link.attributes.merge!(rel: 'stylesheet', href: cssfile) doc.root.element('head/style').insert_after(link) doc.xml(declaration: 'none') else @html end "<!DOCTYPE html>\n" + html end |