Class: Codnar::Haddock
- Inherits:
-
Object
- Object
- Codnar::Haddock
- Defined in:
- lib/codnar/haddock.rb
Overview
Convert Haddoc to HTML.
Class Method Summary collapse
-
.to_html(haddock) ⇒ Object
Since Haddock is as slow as molasses to start up, we cache the results of highlighting the syntax of each code fragment in a directory called
.codnar-cache, which can appear at the current working directory or in any of its parents. -
.uncached_to_html(haddock) ⇒ Object
Process a Haddock String and return the resulting HTML.
Class Method Details
.to_html(haddock) ⇒ Object
Since Haddock is as slow as molasses to start up, we cache the results of highlighting the syntax of each code fragment in a directory called .codnar-cache, which can appear at the current working directory or in any of its parents.
26 27 28 29 |
# File 'lib/codnar/haddock.rb', line 26 def self.to_html(haddock) data = { "haddock" => haddock } return @cache[data] end |
.uncached_to_html(haddock) ⇒ Object
Process a Haddock String and return the resulting HTML.
13 14 15 16 17 18 19 20 |
# File 'lib/codnar/haddock.rb', line 13 def self.uncached_to_html(haddock) with_temporary_directory do |path| write_temporary_file(path, haddock) run_haddock(path) html = read_html_file(path) clean_html(html) end end |