Class: MediaWikiWalker
- Inherits:
-
Object
- Object
- MediaWikiWalker
- 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
Direct Known Subclasses
MediaWikiHTMLGenerator, MediaWikiHTMLGenerator::TextGenerator, MediaWikiSignedWikiGenerator
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#link_handler ⇒ Object
Returns’s this generator URL handler.
-
#link_handler=(handler) ⇒ Object
Set generator’s URL handler.
-
#parse(ast) ⇒ Object
Walks through the AST.
Instance Attribute Details
#params ⇒ Object
36 37 38 |
# File 'lib/mediacloth/mediawikiwalker.rb', line 36 def params @params ||= MediaWikiParams.new end |
#template_handler ⇒ Object
31 32 33 |
# File 'lib/mediacloth/mediawikiwalker.rb', line 31 def template_handler @template_handler ||= MediaWikiTemplateHandler.new end |
Instance Method Details
#link_handler ⇒ Object
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 |
#link_handler=(handler) ⇒ Object
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 |