Excerpt functionality *is* built in to the xmlrpc in wordpress, you just have to send it the mt_excerpt header, as mentioned on this list previously.
If you edit the blogging.rb file in the blogging bundle support directory (or make a copy in a new bundle) and add:
@post['mt_excerpt'] = @headers['excerpt'] if @headers['excerpt']
around line 224 (it's not especially important, as long as it's in that block) it will send a header in this format:
Excerpt: your text without line breaks
You'll want to edit the language file to include the [Ee]xcerpt header so it highlights properly.
Then you'll want to add
doc += "Excerpt: #{self.post['mt_excerpt']}\n" if self.post ['mt_excerpt'] && (self.post['mt_excerpt'] != '')
at about line 400 in blogging.rb so that it will retrieve the excerpts when you fetch the post or after posting.
That's it. Excerpts should work for you then.
Brett
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On 2. Nov 2006, at 04:29, Brett Terpstra wrote:
Excerpt functionality *is* built in to the xmlrpc in wordpress, you just have to send it the mt_excerpt header, as mentioned on this list previously. [...]
Sounds like we should add these changes to the default blogging.rb?
Brett, rather than give these “go to line n and add this” you should just run “diff -u oldfile newfile” or “svn diff” if you edited the checked out version.
This gives a nice patch file, where I (and pthers) can then simply do:
cd «directory with blogging.rb» patch < bretts_changes.patch
Unfortunately Mail mangles leading tabs/spaces, so you have to zip it to attach it here, but ideally one would just paste it in the letter body, then the receiver copies it to the clipboard and do:
pbpaste|patch
Much much easier than this “go to line this and do that” :)
My only concern here is that excerpts _can_ include newline characters. The blogging bundle doesn't support newlines in the header block currently. Perhaps it should, in the way that HTTP headers can have newlines, as long as the following lines are indented. The whitespace added for this should be stripped upon reposting. That would require some changes to the grammar as well though.
On Nov 3, 2006, at 3:36 PM, Allan Odgaard wrote:
On 2. Nov 2006, at 04:29, Brett Terpstra wrote:
Excerpt functionality *is* built in to the xmlrpc in wordpress, you just have to send it the mt_excerpt header, as mentioned on this list previously. [...]
Sounds like we should add these changes to the default blogging.rb?
Brett, rather than give these “go to line n and add this” you should just run “diff -u oldfile newfile” or “svn diff” if you edited the checked out version.
This gives a nice patch file, where I (and pthers) can then simply do:
cd «directory with blogging.rb» patch < bretts_changes.patch
Unfortunately Mail mangles leading tabs/spaces, so you have to zip it to attach it here, but ideally one would just paste it in the letter body, then the receiver copies it to the clipboard and do:
pbpaste|patch
Much much easier than this “go to line this and do that” :)
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
How about using some kind of separator like WordPress and Drupal are doing it in their respective editor interfaces? Something like <!--more--> or <!--break-->?
Regards, Horst
Brad Choate schrieb:
My only concern here is that excerpts _can_ include newline characters. The blogging bundle doesn't support newlines in the header block currently. Perhaps it should, in the way that HTTP headers can have newlines, as long as the following lines are indented. The whitespace added for this should be stripped upon reposting. That would require some changes to the grammar as well though.
On Nov 3, 2006, at 3:36 PM, Allan Odgaard wrote:
On 2. Nov 2006, at 04:29, Brett Terpstra wrote:
Excerpt functionality *is* built in to the xmlrpc in wordpress, you just have to send it the mt_excerpt header, as mentioned on this list previously. [...]
Sounds like we should add these changes to the default blogging.rb?
Brett, rather than give these “go to line n and add this” you should just run “diff -u oldfile newfile” or “svn diff” if you edited the checked out version.
This gives a nice patch file, where I (and pthers) can then simply do:
cd «directory with blogging.rb» patch < bretts_changes.patch
Unfortunately Mail mangles leading tabs/spaces, so you have to zip it to attach it here, but ideally one would just paste it in the letter body, then the receiver copies it to the clipboard and do:
pbpaste|patch
Much much easier than this “go to line this and do that” :)
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
If I were actually going to use this (I don't use excerpts) I would be using it with Wordpress, and it already uses the <!--more--> tag for paging posts, which is different from the excerpt. My personal opinion is that if newlines are necessary then there needs to be a delimiter in the header for the beginning and end of the excerpt. Or an ENDOFLINE or something to read until. KnowwhatImean?
Brett
On Nov 3, 2006, at 6:49 PM, Horst Gutmann wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
How about using some kind of separator like WordPress and Drupal are doing it in their respective editor interfaces? Something like
<!--more--> or <!--break-->?
Regards, Horst
Brad Choate schrieb:
My only concern here is that excerpts _can_ include newline characters. The blogging bundle doesn't support newlines in the header block currently. Perhaps it should, in the way that HTTP headers can have newlines, as long as the following lines are indented. The whitespace added for this should be stripped upon reposting. That would require some changes to the grammar as well though.
On Nov 3, 2006, at 3:36 PM, Allan Odgaard wrote:
On 2. Nov 2006, at 04:29, Brett Terpstra wrote:
Excerpt functionality *is* built in to the xmlrpc in wordpress, you just have to send it the mt_excerpt header, as mentioned on this list previously. [...]
Sounds like we should add these changes to the default blogging.rb?
Brett, rather than give these “go to line n and add this” you should just run “diff -u oldfile newfile” or “svn diff” if you edited the checked out version.
This gives a nice patch file, where I (and pthers) can then simply do:
cd «directory with blogging.rb» patch < bretts_changes.patch
Unfortunately Mail mangles leading tabs/spaces, so you have to zip it to attach it here, but ideally one would just paste it in the letter body, then the receiver copies it to the clipboard and do:
pbpaste|patch
Much much easier than this “go to line this and do that” :)
__ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin)
iD8DBQFFS+Oce3xiN2SrYecRArF1AJ0Top1MVGZzTFkTPQyZdsxgSAwFiACfYqjY Ol0ANp3qO3iwVYS4yraOobY= =o8MD -----END PGP SIGNATURE-----
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On 4. Nov 2006, at 02:04, Brett Terpstra wrote:
If I were actually going to use this (I don't use excerpts) I would be using it with Wordpress, and it already uses the <!--more--> tag for paging posts, which is different from the excerpt. My personal opinion is that if newlines are necessary then there needs to be a delimiter in the header for the beginning and end of the excerpt. Or an ENDOFLINE or something to read until. KnowwhatImean?
I think Brad’s suggestion about supporting multi-line headers like RFC 822 is good enough. Although with that, we can’t have an actual newline character in the header.
If I understand RFC 822 correctly, multi-line headers require specific syntax (CRLF followed by a single LWSP and terminated by a CR). I'll leave the details up to you, and I'm probably overlooking something simple, I just don't quite grasp how you're going to make it simple for the average blogger to add an excerpt which can be easily parsed as separate from the message body if there's nothing to terminate it. I'm just curious.
Brett
On Nov 3, 2006, at 7:53 PM, Allan Odgaard wrote:
On 4. Nov 2006, at 02:04, Brett Terpstra wrote:
If I were actually going to use this (I don't use excerpts) I would be using it with Wordpress, and it already uses the <!-- more--> tag for paging posts, which is different from the excerpt. My personal opinion is that if newlines are necessary then there needs to be a delimiter in the header for the beginning and end of the excerpt. Or an ENDOFLINE or something to read until. KnowwhatImean?
I think Brad’s suggestion about supporting multi-line headers like RFC 822 is good enough. Although with that, we can’t have an actual newline character in the header.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On 4. Nov 2006, at 10:38, Brett Terpstra wrote:
If I understand RFC 822 correctly, multi-line headers require specific syntax (CRLF followed by a single LWSP and terminated by a CR). I'll leave the details up to you, and I'm probably overlooking something simple, I just don't quite grasp how you're going to make it simple for the average blogger to add an excerpt which can be easily parsed as separate from the message body if there's nothing to terminate it. I'm just curious.
We wouldn’t follow it strictly, just the idea, so e.g. drop everything about CR.
It boils down to: a header starts with a word, then a colon. If the next line has indent, that indent is removed, and the header continues at that line.
So a simple post:
Title: foo Excerpt: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
And here is the actual body.
Or said another way, the header stops with the first non-indented and non-empty line.
A problem though is that we wouldn’t be able to support Markdown for the excerpt, at least not code blocks and hard wrapped list items.
Maybe we should go for the here-doc syntax. So it would be:
Title: foo Excerpt: <<EXCERPT Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. EXCERPT
And here is the actual body.
But then the question is if there should be a way to escape the << used to provide a token. Though probably just better to not allow arbitrary tokens, so the chance of a false positive is highly unlikely.
What I was getting at was not that I thought you would require the exact RFC 822 syntax, but that you would need a specific syntax in general, and it would be hard to guarantee that the user would follow that syntax and not screw things up before parsing. The <<EXCERPT idea is more along the lines of what I was thinking, and a snippet could insert the necessary code. Couldn't you just have the header start with a word and a colon, and then the excerpt be terminated by something like ENDEXCERPT?
Do you want to preserve the CR? Do they need to be escaped before posting, or are they stripped in parsing?
On Nov 4, 2006, at 5:15 AM, Allan Odgaard wrote:
On 4. Nov 2006, at 10:38, Brett Terpstra wrote:
If I understand RFC 822 correctly, multi-line headers require specific syntax (CRLF followed by a single LWSP and terminated by a CR). I'll leave the details up to you, and I'm probably overlooking something simple, I just don't quite grasp how you're going to make it simple for the average blogger to add an excerpt which can be easily parsed as separate from the message body if there's nothing to terminate it. I'm just curious.
We wouldn’t follow it strictly, just the idea, so e.g. drop everything about CR.
It boils down to: a header starts with a word, then a colon. If the next line has indent, that indent is removed, and the header continues at that line.
So a simple post:
Title: foo Excerpt: Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. And here is the actual body.
Or said another way, the header stops with the first non-indented and non-empty line.
A problem though is that we wouldn’t be able to support Markdown for the excerpt, at least not code blocks and hard wrapped list items.
Maybe we should go for the here-doc syntax. So it would be:
Title: foo Excerpt: <<EXCERPT Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. EXCERPT And here is the actual body.
But then the question is if there should be a way to escape the << used to provide a token. Though probably just better to not allow arbitrary tokens, so the chance of a false positive is highly unlikely.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................
On 4. Nov 2006, at 12:37, Brett Terpstra wrote:
What I was getting at was not that I thought you would require the exact RFC 822 syntax, but that you would need a specific syntax in general, and it would be hard to guarantee that the user would follow that syntax and not screw things up before parsing. The <<EXCERPT idea is more along the lines of what I was thinking, and a snippet could insert the necessary code.
And with syntax highlight, I am not too concerned the user would get it wrong.
Couldn't you just have the header start with a word and a colon, and then the excerpt be terminated by something like ENDEXCERPT?
Well, personally I have a strong dislike of special-casing an element (i.e. one of the headers). This should IMO be a general system for multi-line headers.
Do you want to preserve the CR? Do they need to be escaped before posting, or are they stripped in parsing?
With the here-doc syntax, the text should be taken verbatim, the excerpt could be multiple paragraphs, in markdown, etc. -- best not to do any transformation even on just the whitespace.
I'll polish up on diff and make sure to do that in the future. Thanks for the tip.
Brett
On Nov 3, 2006, at 5:36 PM, Allan Odgaard wrote:
On 2. Nov 2006, at 04:29, Brett Terpstra wrote:
Excerpt functionality *is* built in to the xmlrpc in wordpress, you just have to send it the mt_excerpt header, as mentioned on this list previously. [...]
Sounds like we should add these changes to the default blogging.rb?
Brett, rather than give these “go to line n and add this” you should just run “diff -u oldfile newfile” or “svn diff” if you edited the checked out version.
This gives a nice patch file, where I (and pthers) can then simply do:
cd «directory with blogging.rb» patch < bretts_changes.patch
Unfortunately Mail mangles leading tabs/spaces, so you have to zip it to attach it here, but ideally one would just paste it in the letter body, then the receiver copies it to the clipboard and do:
pbpaste|patch
Much much easier than this “go to line this and do that” :)
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Brett Terpstra : Art Director Circle Six Design, Inc. 111 Riverfront Dr, Suite 204 .................................................. p: 507.459.4398 877.858.4332 f: 1.866.540.3063 e: brett@circlesixdesign.com http://www.circlesixdesign.com ..................................................