Class: MediaWikiWalker

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

Overview

Default walker to traverse the parse tree.

The walker traverses the entire parse tree and does nothing. To implement some functionality during this process, reimplement parse… methods and don’t forget to call super() to not break the walk.

Current implementations: MediaWikiHTMLGenerator, DebugWalker

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#paramsObject



36
37
38
# File 'lib/mediacloth/mediawikiwalker.rb', line 36

def params
    @params ||= MediaWikiParams.new
end

#template_handlerObject



31
32
33
# File 'lib/mediacloth/mediawikiwalker.rb', line 31

def template_handler
  @template_handler ||= MediaWikiTemplateHandler.new
end

Instance Method Details

Returns’s this generator URL handler. If no handler was set, returns the default handler.



26
27
28
# File 'lib/mediacloth/mediawikiwalker.rb', line 26

def link_handler
  @link_handler ||= MediaWikiLinkHandler.new
end

Set generator’s URL handler.



20
21
22
# File 'lib/mediacloth/mediawikiwalker.rb', line 20

def link_handler=(handler)
  @link_handler = handler
end

#parse(ast) ⇒ Object

Walks through the AST



15
16
17
# File 'lib/mediacloth/mediawikiwalker.rb', line 15

def parse(ast)
    parse_wiki_ast(ast)
end