On Sat, 11 Dec 2010, Poul wrote:
Does anyone know of a good, robust parser for tiddlywiki documents written in Python. I'm thinking one that produces python objects for each tiddler..? Using strict xml parsers doesn't seem to work quite well.
The tiddlyweb ecosystem has tools for reading in and parsing tiddlywiki documents and creating lists of tiddler objects. The most commonly used stuff is in tiddlywebplugins.twimport[1] which uses html5lib to traverse the document to get at the tiddler divs, and then generates TiddlyWeb Tiddler objects from them[2]. To get html5lib to work properly it's necessary to ensure that it is _not_ being strict. Then it is willing to spit out the necessary divs. FND also worked on a parsing library at some point, but for some reason I can't find it. Maybe he'll chime in. Are you aware of the ginsu[3]? It's ruby stuff that is used in TiddlyWiki development for cutting up tiddlywiki html files into a form usable by cook. I've not used it myself. Depending on your goals using, or copying, the twimport code is probably a fairly straightforward path. [1] https://github.com/tiddlyweb/tiddlywebplugins.twimport http://pypi.python.org/pypi/tiddlywebplugins.twimport [2] https://github.com/tiddlyweb/tiddlywebplugins.twimport/blob/master/tiddlywebplugins/twimport.py#L106 [3] http://trac.tiddlywiki.org/wiki/Ginsu -- Chris Dent http://burningchrome.com/ [...] -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/tiddlywikidev?hl=en.
