• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

news4 - RSS aggrigation system


Commit MetaInfo

Révisioned712d441a3abeb61f516c2d82775e85a118b734 (tree)
l'heure2012-10-04 04:21:36
Auteurhylom <hylom@hylo...>
Commiterhylom

Message de Log

add auto breaking with p tag in slashdotjp filter

Change Summary

Modification

--- a/filters/slashdotjp.py
+++ b/filters/slashdotjp.py
@@ -7,6 +7,8 @@ re_read_all = re.compile(ur'''<p>\s*<a href=['"][^'"]+['"]>\s*すべて読む\s*
77 re_related = re.compile(ur'''<p>\s*関連ストーリー:.*?</p>''')
88 re_topics = re.compile(ur'''<a href="http://slashdot.jp/stories/\w+">(.*?)</a>''')
99
10+re_break = re.compile(r'''\n\n(.*?)\n''')
11+
1012 def entry_filter(entry):
1113 # すべて読む、関連ストーリーを削除
1214 body = entry['body']
@@ -17,6 +19,9 @@ def entry_filter(entry):
1719 itr = re_topics.findall(s)
1820 for items in itr:
1921 topics.append(items)
22+
23+ while re_break.search(body):
24+ body = re_break.sub(r'</p><p>\1</p><p>', body)
2025
2126 body = re_read_all.sub('', body)
2227 body = re_related.sub('', body)