This patch against PyTextile 2.0.8 prevents textile from adding a newline to the first line of a pre-block.
--- textile.py~ 2004-06-25 13:24:09.000000000 +0200
+++ textile.py 2004-09-03 14:00:53.000000000 +0200
@@ -1239,7 +1239,7 @@
attributes = self.parse_params(parameters, clear)
# Build the tag.
- open_tag = self.build_open_tag('pre', attributes) + '\n'
+ open_tag = self.build_open_tag('pre', attributes)
close_tag = '\n</pre>'
# Replace < and >.
This patch allows for metadata entries in .txtl files.
Example metadata:
title
#metakey metavalue
entry body text
The patch looks like this:
--- pyblosxom/contrib/entryparsers/txtl.py~ 2004-05-19 11:51:35.000000000 +0200
+++ pyblosxom/contrib/entryparsers/txtl.py 2004-08-16 17:51:49.000000000 +0200
@@ -190,11 +190,22 @@
def readfile(filename, request):
entryData = {}
- d = open(filename).read()
+ d = open(filename).readlines()
- # Grab title and body.
- title = d.split('\n')[0]
- body = d[len(title):]
+ # Grab title
+ entryData['title'] = d.pop(0).strip()
+
+ # this handles properties of the entry that are between
+ # the title and the body and start with a #
+ import re
+ while len(d) > 0:
+ match = re.match(r'^#(\w+)\s+(.*)', d[0])
+ if match:
+ d.pop(0)
+ entryData[match.groups()[0]] = match.groups()[1].strip()
+ else:
+ break
+ body = "\n" + ''.join(d)
# Grab textile configuration.
config = request.getConfiguration()
@@ -205,8 +216,7 @@
body = textile(body, head_offset=head_offset, validate=validate, output=output, encoding=encoding)
- entryData = {'title': title,
- 'body': body}
+ entryData['body'] = body
# Call the postformat callbacks
tools.run_callback('postformat',
The code is based on the standard pyblosxom entry parser for .txt-files.