• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

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

allura


Commit MetaInfo

修訂11a57546aa1bd9c195fe4738458e31ed049defe1 (tree)
時間2012-06-14 04:13:57
作者Dave Brondsema <dbrondsema@geek...>
CommiterYaroslav Luzin

Log Message

[#4254] disable [plain] handling for HTML import for now; improved [plain] insertion for plaintext

Change Summary

差異

--- a/ForgeBlog/forgeblog/command/rssfeeds.py
+++ b/ForgeBlog/forgeblog/command/rssfeeds.py
@@ -168,17 +168,25 @@ class RssFeedsCommand(base.BlogCommand):
168168 content = u''
169169 for ct in e.content:
170170 if ct.type != 'text/html':
171- content = u"%s<p>%s</p>" % (content, ct.value)
171+ content += '[plain]%s[/plain]' % ct.value
172172 else:
173- content = content + ct.value
173+ if False:
174+ # FIXME: disabled until https://sourceforge.net/p/allura/tickets/4345
175+ # because the bad formatting from [plain] is worse than bad formatting from unintentional markdown syntax
176+ parser = MDHTMLParser()
177+ parser.feed(ct.value)
178+ parser.close() # must be before using the result_doc
179+ markdown_content = html2text.html2text(parser.result_doc, baseurl=e.link)
180+ else:
181+ markdown_content = html2text.html2text(ct.value, baseurl=e.link)
182+
183+ content += markdown_content
174184 else:
175- content = e.summary
185+ content = '[plain]%s[/plain]' % getattr(e, 'summary',
186+ getattr(e, 'subtitle',
187+ getattr(e, 'title')))
176188
177- content = u'%s <a href="%s">link</a>' % (content, e.link)
178- parser = MDHTMLParser()
179- parser.feed(content)
180- parser.close()
181- content = html2text.html2text(parser.result_doc, e.link)
189+ content += u' [link](%s)' % e.link
182190
183191 updated = datetime.utcfromtimestamp(mktime(e.updated_parsed))
184192