我使用restructuredText,我喜歡Smartypants爲Markdown所做的一切。有沒有辦法爲restructuredText啓用相同的東西?我可以將「Smartypants」添加到restructuredText中嗎?
5
A
回答
1
正如Alex Martelli所說,smartyPants就是我所需要的。不過,我正在尋找一些關於如何使用它的更詳細的信息。因此,下面是一個Python腳本,它讀取第一個命令行參數中指定的文件,將其轉換爲HTML,使用Pygments代替sourcecode
,然後通過smartypants將其傳遞給美化。
#!/usr/bin/python
# EASY-INSTALL-SCRIPT: 'docutils==0.5','rst2html.py'
"""
A minimal front end to the Docutils Publisher, producing HTML.
"""
try:
from ulif.rest import directives_plain
from ulif.rest import roles_plain
from ulif.rest import pygments_directive
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_doctree, publish_from_doctree
from smartypants import smartyPants
import sys
description = ('Personal docutils parser with extra features.')
doctree = publish_doctree(file(sys.argv[1]).read())
result = publish_from_doctree(doctree, writer_name='html')
result = smartyPants(result)
print result
2
你試過smartypants.py?我不知道它的實現效果如何,更不用說它對於特定用例的效果如何,但它似乎確實針對您的目標,對一些ascii構造進行unicode化(但是,它運行在HTML上,所以我猜你可以在restructuredText
之後運行它或其他任何「HTML製作者」組件)。
如果這對你不太好,用戶已經提交patch到python-markdown2,他稱之爲「這個SmartyPants補丁」 - 它已被接受,並且自從一個月前它是當前源樹的一部分python-markdown2(r259或更好)。這可能會提供更流暢的航行(例如,如果您只是將python-markdown2構建爲只讀svn tree)。或者,您可以等待下一個可下載的版本(自5月以來沒有一個版本,並且這個補丁在7月中旬被接受),但是誰知道何時會發生。
相關問題
- 1. 我可以將IBActions添加到NSArray嗎?
- 2. 我可以將JInternalFrames添加到JPanel嗎?
- 3. 如何將Google Analytics添加到reStructuredText?
- 4. 我可以在Swift中將方法添加到Realm類中嗎?
- 5. 我可以將DataMember添加到WCF中的CollectionDataContract中嗎?
- 6. 我可以將一個節點添加到樹而不添加到dataProvider中嗎?
- 7. 將AdSense添加到App Engine可以嗎?
- 8. 可以將JLabel添加到JTextArea嗎?
- 9. 我們可以將C++文件添加到iOS項目中嗎?
- 10. 我可以在Libgdx中將底層添加到底層嗎?
- 11. 我們可以將UITableView添加到自定義UITableViewcell中嗎?
- 12. 在android中,我可以將子視圖添加到ImageView嗎?
- 13. 我可以將一組ArrayList添加到單個ArrayList中嗎?
- 14. 我可以將Web鏈接添加到XML文檔中嗎?
- 15. 我可以將操作添加到Python中的列表嗎?
- 16. 我可以將「導入熊貓」添加到%pylab魔術中嗎?
- 17. 我可以將自定義存儲庫添加到gradle.properties中嗎?
- 18. 我可以將不是ListItem的控件添加到RadioButtonList中嗎?
- 19. 我可以在Android中將Clicklistener添加到LinearLayout嗎?
- 20. 我可以將我的緩存行添加到global.asax嗎?
- 21. 我可以在reStructuredText中使用編號鏈接嗎?
- 22. 我可以在UITabBarController中添加UITabBarController嗎?
- 23. 我可以將HTML標籤添加到jQuery attr()嗎?
- 24. 我可以將cookie添加到webpack dev服務器代理嗎?
- 25. 我可以將Google Moderator添加到MediaWiki嗎?
- 26. 我可以將音樂庫添加到Xcode iOS模擬器嗎?
- 27. 我可以使用AAPT將版本代碼添加到APK嗎?
- 28. 我可以將藝術家圖像添加到Android MediaStore嗎?
- 29. 我可以將Parametercollection添加到另一個Parametercollection嗎?
- 30. 我可以將非持久性字段添加到模型嗎?
看起來你被切斷了傳輸中...:P – 2010-08-20 01:54:46
@Nick:謝謝。我甚至不知道我在那裏想說什麼。 – 2010-08-20 14:33:52