In Files

Parent

Class/Module Index [+]

Quicksearch

HikiDoc::HTMLOutput

Public Class Methods

new(suffix = " />") click to toggle source
# File lib/hikidoc.rb, line 551
def initialize(suffix = " />")
  @suffix = suffix
  @f = nil
end

Public Instance Methods

block_plugin(str) click to toggle source
# File lib/hikidoc.rb, line 697
def block_plugin(str)
  @f.puts %(<div class="plugin">{{#{escape_html(str)}}}</div>)
end
block_preformatted(str, info) click to toggle source
# File lib/hikidoc.rb, line 672
def block_preformatted(str, info)
  syntax = info ? info.downcase : nil
  if syntax
    begin
      convertor = Syntax::Convertors::HTML.for_syntax(syntax)
      @f.puts convertor.convert(str)
      return
    rescue NameError, RuntimeError
      @f.puts %<pre class="prettyprint">#{text(str)}</pre>|
      return
    end
  end
  preformatted(text(str))
end
blockquote_close() click to toggle source
# File lib/hikidoc.rb, line 668
def blockquote_close
  @f.puts "</blockquote>"
end
blockquote_open() click to toggle source
# File lib/hikidoc.rb, line 664
def blockquote_open
  @f.print "<blockquote>"
end
container(_for=nil) click to toggle source
# File lib/hikidoc.rb, line 564
def container(_for=nil)
  case _for
  when :paragraph
    []
  else
    ""
  end
end
del(item) click to toggle source
# File lib/hikidoc.rb, line 727
def del(item)
  "<del>#{item}</del>"
end
dlist_close() click to toggle source
# File lib/hikidoc.rb, line 616
def dlist_close
  @f.puts "</dl>"
end
dlist_item(dt, dd) click to toggle source
# File lib/hikidoc.rb, line 620
def dlist_item(dt, dd)
  case
  when dd.empty?
    @f.puts "<dt>#{dt}</dt>"
  when dt.empty?
    @f.puts "<dd>#{dd}</dd>"
  else
    @f.puts "<dt>#{dt}</dt>"
    @f.puts "<dd>#{dd}</dd>"
  end
end
dlist_open() click to toggle source
# File lib/hikidoc.rb, line 612
def dlist_open
  @f.puts "<dl>"
end
em(item) click to toggle source
# File lib/hikidoc.rb, line 723
def em(item)
  "<em>#{item}</em>"
end
escape_html(text) click to toggle source
# File lib/hikidoc.rb, line 751
def escape_html(text)
  text.gsub(/&/, "&amp;").gsub(/</, "&lt;").gsub(/>/, "&gt;")
end
escape_html_param(str) click to toggle source

Utilities

# File lib/hikidoc.rb, line 747
def escape_html_param(str)
  escape_quote(escape_html(str))
end
escape_quote(text) click to toggle source
# File lib/hikidoc.rb, line 759
def escape_quote(text)
  text.gsub(/"/, "&quot;")
end
finish() click to toggle source
# File lib/hikidoc.rb, line 560
def finish
  @f.string
end
headline(level, title) click to toggle source

Procedures

# File lib/hikidoc.rb, line 577
def headline(level, title)
  @f.puts "<h#{level}>#{title}</h#{level}>"
end
hrule() click to toggle source
# File lib/hikidoc.rb, line 581
def hrule
  @f.puts "<hr#{@suffix}"
end
inline_plugin(src) click to toggle source
# File lib/hikidoc.rb, line 739
def inline_plugin(src)
  %(<span class="plugin">{{#{escape_html(src)}}}</span>)
end
list_begin() click to toggle source
# File lib/hikidoc.rb, line 585
def list_begin
end
list_close(type) click to toggle source
# File lib/hikidoc.rb, line 596
def list_close(type)
  @f.print "</#{type}>"
end
list_end() click to toggle source
# File lib/hikidoc.rb, line 588
def list_end
  @f.puts
end
list_open(type) click to toggle source
# File lib/hikidoc.rb, line 592
def list_open(type)
  @f.puts "<#{type}>"
end
listitem(item) click to toggle source
# File lib/hikidoc.rb, line 608
def listitem(item)
  @f.print item
end
listitem_close() click to toggle source
# File lib/hikidoc.rb, line 604
def listitem_close
  @f.puts "</li>"
end
listitem_open() click to toggle source
# File lib/hikidoc.rb, line 600
def listitem_open
  @f.print "<li>"
end
paragraph(lines) click to toggle source
# File lib/hikidoc.rb, line 693
def paragraph(lines)
  @f.puts "<p>#{lines.join("\n")}</p>"
end
preformatted(str) click to toggle source
# File lib/hikidoc.rb, line 687
def preformatted(str)
  @f.print "<pre>"
  @f.print str
  @f.puts "</pre>"
end
reset() click to toggle source
# File lib/hikidoc.rb, line 556
def reset
  @f = StringIO.new
end
strong(item) click to toggle source
# File lib/hikidoc.rb, line 719
def strong(item)
  "<strong>#{item}</strong>"
end
table_close() click to toggle source
# File lib/hikidoc.rb, line 636
def table_close
  @f.puts "</table>"
end
table_data(item, rs, cs) click to toggle source
# File lib/hikidoc.rb, line 652
def table_data(item, rs, cs)
  @f.print "<td#{tdattr(rs, cs)}>#{item}</td>"
end
table_head(item, rs, cs) click to toggle source
# File lib/hikidoc.rb, line 648
def table_head(item, rs, cs)
  @f.print "<th#{tdattr(rs, cs)}>#{item}</th>"
end
table_open() click to toggle source
# File lib/hikidoc.rb, line 632
def table_open
  @f.puts %(<table border="1">)
end
table_record_close() click to toggle source
# File lib/hikidoc.rb, line 644
def table_record_close
  @f.puts "</tr>"
end
table_record_open() click to toggle source
# File lib/hikidoc.rb, line 640
def table_record_open
  @f.print "<tr>"
end
text(str) click to toggle source
# File lib/hikidoc.rb, line 735
def text(str)
  escape_html(str)
end
tt(item) click to toggle source
# File lib/hikidoc.rb, line 731
def tt(item)
  "<tt>#{item}</tt>"
end
unescape_html(text) click to toggle source
# File lib/hikidoc.rb, line 755
def unescape_html(text)
  text.gsub(/&gt;/, ">").gsub(/&lt;/, "<").gsub(/&amp;/, "&")
end
wiki_name(name) click to toggle source
# File lib/hikidoc.rb, line 709
def wiki_name(name)
  hyperlink(name, text(name))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.