module DocuBot

Constants

DIR
SHELLS
SHELL_DIR
TEMPLATE_DIR
VERSION

Public Class Methods

convert_to_html( page, source, type ) click to toggle source
# File lib/docubot/converter.rb, line 16
def self.convert_to_html( page, source, type )
        if converter = DocuBot::Converter.by_type[ type.to_s ]
                puts "Converting #{type}: #{source.inspect[0..60]}" if $DEBUG
                converter[ page, source ]
        else
                raise "No converter found for type #{type}"
        end
end
handle_snippet( regexp, &handler ) click to toggle source
# File lib/docubot/snippet.rb, line 5
def self.handle_snippet( regexp, &handler )
        @snippets[ regexp ] = handler
end
id_from_text( text ) click to toggle source
# File lib/docubot.rb, line 30
def self.id_from_text( text )
        "#" << text.strip.gsub(/[^\w.:-]+/,'-').gsub(/^[^a-z]+|-+$/i,'')
end
process_snippets( page, html ) click to toggle source
# File lib/docubot/snippet.rb, line 9
def self.process_snippets( page, html )
        # TODO: Don't process snippets on the 'raw' file types
        @snippets.inject(html){ |h,(regexp,handler)| h.gsub( regexp ){ |str| handler[ str, page ] } }
end