Class MediaWikiWalker
In: lib/mediacloth/mediawikiwalker.rb
Parent: Object

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

Methods

Public Instance methods

Walks through the AST

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 14
14:     def parse(ast)
15:         parse_wiki_ast(ast)
16:     end

Protected Instance methods

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 34
34:     def parse_formatted(ast)
35:         parse_wiki_ast(ast)
36:     end

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 43
43:     def parse_list(ast)
44:         ast.children.each do |c|
45:             parse_list_item(c) if c.class == ListItemAST
46:         end
47:     end

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 50
50:     def parse_list_item(ast)
51:         parse_wiki_ast(ast)
52:     end

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 55
55:     def parse_preformatted(ast)
56:     end

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 59
59:     def parse_section(ast)
60:     end

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 39
39:     def parse_text(ast)
40:     end

Reimplement this

[Source]

    # File lib/mediacloth/mediawikiwalker.rb, line 23
23:     def parse_wiki_ast(ast)
24:         ast.children.each do |c|
25:             parse_formatted(c) if c.class == FormattedAST
26:             parse_text(c) if c.class == TextAST
27:             parse_list(c) if c.class == ListAST
28:             parse_preformatted(c) if c.class == PreformattedAST
29:             parse_section(c) if c.class == SectionAST
30:         end
31:     end

[Validate]