a patch for WeblogTool.py
MATSUI Fe2+ Tetsushi <[email protected]> Mon, 14 Mar 2005 12:41:12 +0900
| Newsgroups | gmane.comp.pythin.pyds.devel |
|---|---|
| Message-ID | <sa6is3urj1j.wl%[email protected]> |
--Multipart_Mon_Mar_14_12:41:12_2005-1
Content-Type: text/plain; charset=US-ASCII
Hello,
This is a patch for WeblogTool.py to prevent PyDS from including a whole
article into RSS. With languages not separating words by spaces, CJK
languages for example, the first space after 200 characters does not
make sense. Then, the patch makes a line break be an end point of
inclusion besides a space.
--
MATSUI Fe2+ Tetsushi
http://homepage3.nifty.com/text/
(http://lowlife.jp/mft/ for blog)
--Multipart_Mon_Mar_14_12:41:12_2005-1
Content-Type: text/plain; charset=US-ASCII
--- WeblogTool.py.orig 2005-03-14 11:53:57.000000000 +0900
+++ WeblogTool.py 2005-03-14 11:54:25.000000000 +0900
@@ -1142,7 +1142,7 @@
excerpt = macros.safeHTML(excerpt)
if len(excerpt) > 200 and not(full):
pos = 200
- while (pos < len(excerpt)) and (excerpt[pos] != ' '):
+ while (pos < len(excerpt)) and (excerpt[pos] not in ' \r\n'):
pos += 1
excerpt = macros.safeHTML(excerpt[:pos])
excerpt += ' ... <a href="%s">%s</a>' % (el['guid'], _('read more'))
--Multipart_Mon_Mar_14_12:41:12_2005-1--