[TxMt] Blogging Bundle / Serendipity / Empty Fields
Philip Hofstetter
phofstetter at sensational.ch
Thu Mar 22 23:01:19 UTC 2007
Hi there,
after getting nagged at my blog (http://www.gnegg.ch/archives/354-
External-blogging-tools.html) to look into why TextMate's Blogging
Bundle behaves strangely with Serendipity blogs, I had a look into
the problem.
Actually, there are two problems, but so far, I've only fixed one
(it's getting late here):
1) When you have a Date:-Header in your Posting, s9y will interpret
the date wrongly and will assume it to be the beginning of the epoch
(1970-01-01). This is problably a flaw in s9y and I'll report it
there as soon as I know what's going on.
2) The Pings- and Comments-Headers were ignored and Pings/Comments
were turned off regardless of what the headers were set to. This is
what I've actually looked into this evening (GMT+1 here):
Basically it all comes down to the fact that parse_post (blogging.rb)
is unable to cope with empty headers of which s9y produces at least
one: s9y always sends an empty mt_convert_breaks-member in the post
record and when no tags are defined, it'll also send an empty
mt_keywords member.
With an unpatched blogging.rb, this will create something like this
(ignore the f*ed up date - that's caused by bug 1) above):
Type: Blog Post (Markdown)
Blog: s9y
Post: 1
Title: First entry
Date: 1970-01-01 02:00:00 +0100
Keywords:
Format:
Pings: On
Comments: On
This causes the parser to stop after the Keywords-header (lines
206/207) which will lead to the following headers to be ignored, thus
turning off comments (s9y assumes Comments=off if the information
isn't present in the RPC-call).
Now I'm not sure if s9y's behaviour is actually legal here (please
enlighten me), but I think the blogging bundle should be able to cope
with empty fields.
There are two possible fixes: One is to fix the fields-parser to make
it stop bailing out at empty fields. I've attached bb_fixparser.diff
which does that. The other way is to make post_to_document stop
adding empty format and keyword fields. bb_skipempty.diff does that.
I'm not sure which way is the correct way to go. fixparser has the
tendency of working with even more crude blogging engines, while
skipempty is what the bundle did so far (look at the handling of
mt_tags for example.
Anyways. Please consider merging one of the patches to make the
blogging bundle work better with serendipity.
Thanks
Philip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb_fixparser.diff
Type: application/octet-stream
Size: 1231 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070323/7d5f1c1c/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bb_skipempty.diff
Type: application/octet-stream
Size: 1098 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070323/7d5f1c1c/attachment-0001.diff>
-------------- next part --------------
More information about the textmate
mailing list