DOM->Moinwiki converter implementing
First version will not have attributes controller and footnote support.
DFS algorithm will use two stacks: for opened nodes and for their children.
Two types of actions: When visiting node first time: open_<namespace>_<name>(node) When all children are visited: close_<namespace>_<name>(node)
Example:
1 class moinwiki:
2 moinwiki.emphasis = "''"
3
4 class Converter:
5 ...
6
7 def open_moinpage_emphasis(self, node):
8 if not node.children:
9 return moinwiki.emphasis + self.close_moinpage_emphasis(node)
10 else:
11 self.children.append(list(node.children))
12 self.opened_nodes.append(node)
13 return moinwiki.emphasis
14
15 def close_moinpage_emphasis(self, node):
16 return moinwiki.emphasis
I think i can done with this today at night.
If you see some limitations of this approach you are welcome to leave a message.
Sorry for just leaving a nitpicking note, but please remember PEP8.