|
From: chombee <ch...@la...> - 2010-02-23 23:33:10
|
I rewrote my tumblelog plugin: http://github.com/seanh/PyBlosxom-tumblelog I wasn't happy with the YAML-based approach for several reasons. It now registers several entry parser functions (one for each type of entry). The parser functions define custom file formats for each type of entry and do custom processing (so far passing bodies, captions and the like through markdown if it's available, but other types of processing for specific entry types are possible). The file formats are simple and try to emulate pyblosxom's default format. The idea was to make the file format as close as possible to how you'd write if you're were just noting something down to yourself in a text file, or emailing it to someone, it should be natural and with as little as possible to remember, avoid having to look up an example of the file format when you want to write an entry. For example, the file format of a link entry is like this: The link title http://www.example.com The rest of the file constitutes a multi-line caption for the entry. When this is rendered with the link template you get something like: <div class="entry link"> <a href="http://example.com" alt="The link title" title="The link title> The link title </a> <p>The rest of the file constitutes a multi-line caption for the entry.</p> <div class="date">Tue 23 Feb 2010</div> </div> As with the previous version, each entry type is rendered using its own template instead of the default story template. I'm much happier with this approach. When you look at your entries dir you can see what type of entry each file is from the filename extension: link, .quote, .picture, .text etc. instead of them all being .yaml. Entries should be easier to write in these custom file formats than in YAML, which was an order of magnitude more awkward than standard pyblosxom entries. And with a separate parse function in tumblelog.py for each entry type, flexible per-type processing is possible. |