Class: HikiDoc

Inherits:
Object
  • Object
show all
Defined in:
lib/hikidoc.rb

Defined Under Namespace

Classes: Error, HTMLOutput, LineInput, UnexpectedError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output, options = {}) ⇒ HikiDoc

Returns a new instance of HikiDoc.



57
58
59
60
61
62
63
# File 'lib/hikidoc.rb', line 57

def initialize(output, options = {})
  @output = output
  @options = default_options.merge(options)
  @header_re = nil
  @level = options[:level] || 1
  @plugin_syntax = options[:plugin_syntax] || method(:valid_plugin_syntax?)
end

Class Method Details

.to_html(src, options = {}) ⇒ Object



49
50
51
# File 'lib/hikidoc.rb', line 49

def HikiDoc.to_html(src, options = {})
  new(HTMLOutput.new(">"), options).compile(src)
end

.to_xhtml(src, options = {}) ⇒ Object



53
54
55
# File 'lib/hikidoc.rb', line 53

def HikiDoc.to_xhtml(src, options = {})
  new(HTMLOutput.new(" />"), options).compile(src)
end

Instance Method Details

#compile(src) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/hikidoc.rb', line 65

def compile(src)
  @output.reset
  escape_plugin_blocks(src) {|escaped|
    compile_blocks escaped
    @output.finish
  }
end

#to_htmlObject

for backward compatibility



74
75
76
77
# File 'lib/hikidoc.rb', line 74

def to_html
  $stderr.puts("warning: HikiDoc#to_html is deprecated. Please use HikiDoc.to_html or HikiDoc.to_xhtml instead.")
  self.class.to_html(@output, @options)
end