Class: HikiDoc::HTMLOutput

### Home Classes Methods

### In Files

- lib/hikidoc.rb

### Parent

Object

### Methods

- ::new
- #block_plugin
- #block_preformatted
- #blockquote_close
- #blockquote_open
- #container
- #del
- #dlist_close
- #dlist_item
- #dlist_open
- #em
- #escape_html
- #escape_html_param
- #escape_quote
- #finish
- #headline
- #hrule
- #hyperlink
- #image_hyperlink
- #inline_plugin
- #list_begin
- #list_close
- #list_end
- #list_open
- #listitem
- #listitem_close
- #listitem_open
- #paragraph
- #preformatted
- #reset
- #strong
- #table_close
- #table_data
- #table_head
- #table_open
- #table_record_close
- #table_record_open
- #text
- #tt
- #unescape_html
- #wiki_name

### Class/Module Index

Quicksearch

- HikiDoc
- HikiDoc::Error
- HikiDoc::HTMLOutput
- HikiDoc::LineInput
- HikiDoc::UnexpectedError

No matching classes.

# HikiDoc::HTMLOutput

### Public Class Methods

new(suffix = " />") click to toggle source

    # File lib/hikidoc.rb, line 549
    def initialize(suffix = " />")
      @suffix = suffix
      @f = nil
    end

### Public Instance Methods

block_plugin(str) click to toggle source

    # File lib/hikidoc.rb, line 695
    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 670
    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 666
    def blockquote_close
      @f.puts "</blockquote>"
    end

blockquote_open() click to toggle source

    # File lib/hikidoc.rb, line 662
    def blockquote_open
      @f.print "<blockquote>"
    end

container(_for=nil) click to toggle source

    # File lib/hikidoc.rb, line 562
    def container(_for=nil)
      case _for
      when :paragraph
        []
      else
        ""
      end
    end

del(item) click to toggle source

    # File lib/hikidoc.rb, line 725
    def del(item)
      "<del>#{item}</del>"
    end

dlist_close() click to toggle source

    # File lib/hikidoc.rb, line 614
    def dlist_close
      @f.puts "</dl>"
    end

dlist_item(dt, dd) click to toggle source

    # File lib/hikidoc.rb, line 618
    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 610
    def dlist_open
      @f.puts "<dl>"
    end

em(item) click to toggle source

    # File lib/hikidoc.rb, line 721
    def em(item)
      "<em>#{item}</em>"
    end

escape_html(text) click to toggle source

    # File lib/hikidoc.rb, line 749
    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 745
    def escape_html_param(str)
      escape_quote(escape_html(str))
    end

escape_quote(text) click to toggle source

    # File lib/hikidoc.rb, line 757
    def escape_quote(text)
      text.gsub(/"/, "&quot;")
    end

finish() click to toggle source

    # File lib/hikidoc.rb, line 558
    def finish
      @f.string
    end

headline(level, title) click to toggle source

Procedures

    # File lib/hikidoc.rb, line 575
    def headline(level, title)
      @f.puts "<h#{level}>#{title}</h#{level}>"
    end

hrule() click to toggle source

    # File lib/hikidoc.rb, line 579
    def hrule
      @f.puts "<hr#{@suffix}"
    end

hyperlink(uri, title) click to toggle source

Functions

    # File lib/hikidoc.rb, line 703
    def hyperlink(uri, title)
      %(<a href="#{escape_html_param(uri)}">#{title}</a>)
    end

image_hyperlink(uri, alt = nil) click to toggle source

    # File lib/hikidoc.rb, line 711
    def image_hyperlink(uri, alt = nil)
      alt ||= uri.split(/\//).last
      alt = escape_html(alt)
      %(<img src="#{escape_html_param(uri)}" alt="#{alt}"#{@suffix})
    end

inline_plugin(src) click to toggle source

    # File lib/hikidoc.rb, line 737
    def inline_plugin(src)
      %(<span class="plugin">{{#{escape_html(src)}}}</span>)
    end

list_begin() click to toggle source

    # File lib/hikidoc.rb, line 583
    def list_begin
    end

list_close(type) click to toggle source

    # File lib/hikidoc.rb, line 594
    def list_close(type)
      @f.print "</#{type}>"
    end

list_end() click to toggle source

    # File lib/hikidoc.rb, line 586
    def list_end
      @f.puts
    end

list_open(type) click to toggle source

    # File lib/hikidoc.rb, line 590
    def list_open(type)
      @f.puts "<#{type}>"
    end

listitem(item) click to toggle source

    # File lib/hikidoc.rb, line 606
    def listitem(item)
      @f.print item
    end

listitem_close() click to toggle source

    # File lib/hikidoc.rb, line 602
    def listitem_close
      @f.puts "</li>"
    end

listitem_open() click to toggle source

    # File lib/hikidoc.rb, line 598
    def listitem_open
      @f.print "<li>"
    end

paragraph(lines) click to toggle source

    # File lib/hikidoc.rb, line 691
    def paragraph(lines)
      @f.puts "<p>#{lines.join("\n")}</p>"
    end

preformatted(str) click to toggle source

    # File lib/hikidoc.rb, line 685
    def preformatted(str)
      @f.print "<pre>"
      @f.print str
      @f.puts "</pre>"
    end

reset() click to toggle source

    # File lib/hikidoc.rb, line 554
    def reset
      @f = StringIO.new
    end

strong(item) click to toggle source

    # File lib/hikidoc.rb, line 717
    def strong(item)
      "<strong>#{item}</strong>"
    end

table_close() click to toggle source

    # File lib/hikidoc.rb, line 634
    def table_close
      @f.puts "</table>"
    end

table_data(item, rs, cs) click to toggle source

    # File lib/hikidoc.rb, line 650
    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 646
    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 630
    def table_open
      @f.puts %(<table border="1">)
    end

table_record_close() click to toggle source

    # File lib/hikidoc.rb, line 642
    def table_record_close
      @f.puts "</tr>"
    end

table_record_open() click to toggle source

    # File lib/hikidoc.rb, line 638
    def table_record_open
      @f.print "<tr>"
    end

text(str) click to toggle source

    # File lib/hikidoc.rb, line 733
    def text(str)
      escape_html(str)
    end

tt(item) click to toggle source

    # File lib/hikidoc.rb, line 729
    def tt(item)
      "<tt>#{item}</tt>"
    end

unescape_html(text) click to toggle source

    # File lib/hikidoc.rb, line 753
    def unescape_html(text)
      text.gsub(/&gt;/, ">").gsub(/&lt;/, "<").gsub(/&amp;/, "&")
    end

wiki_name(name) click to toggle source

    # File lib/hikidoc.rb, line 707
    def wiki_name(name)
      hyperlink(name, text(name))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.