diff options
author | gbrandl <gbrandl@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-05-24 10:04:20 +0000 |
---|---|---|
committer | gbrandl <gbrandl@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2007-05-24 10:04:20 +0000 |
commit | dda70b103f8b739ed583e23e6fcd883cd9eea32f (patch) | |
tree | 2282fbe81602602e2e9adfbd89f16b33aa01c79d | |
parent | a58c1ae9d159c68937c2b46676aa9c65e371d3c1 (diff) | |
download | docutils-dda70b103f8b739ed583e23e6fcd883cd9eea32f.tar.gz |
Customize the smartypants routine for Sphinx. (for one, the input is not HTML...)
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@5116 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r-- | sandbox/py-rest-doc/sphinx/smartypants.py | 9 | ||||
-rw-r--r-- | sandbox/py-rest-doc/sphinx/writer.py | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sandbox/py-rest-doc/sphinx/smartypants.py b/sandbox/py-rest-doc/sphinx/smartypants.py index bf8ed0dcb..0264a4299 100644 --- a/sandbox/py-rest-doc/sphinx/smartypants.py +++ b/sandbox/py-rest-doc/sphinx/smartypants.py @@ -547,6 +547,15 @@ def smartyPants(text, attr=default_smartypants_attr): return "".join(result) +def sphinx_smarty_pants(t): + t = educateDashesOldSchool(t) + # Note: backticks need to be processed before quotes. + t = educateBackticks(t) + t = educateSingleBackticks(t) + t = educateQuotes(t) + return t + + def educateQuotes(str): """ Parameter: String. diff --git a/sandbox/py-rest-doc/sphinx/writer.py b/sandbox/py-rest-doc/sphinx/writer.py index d77418d69..e04951de3 100644 --- a/sandbox/py-rest-doc/sphinx/writer.py +++ b/sandbox/py-rest-doc/sphinx/writer.py @@ -12,7 +12,7 @@ from docutils import nodes from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator -from .smartypants import smartyPants +from .smartypants import sphinx_smarty_pants class HTMLWriter(Writer): @@ -210,5 +210,5 @@ class SmartyPantsHTMLTranslator(HTMLTranslator): def encode(self, text): text = HTMLTranslator.encode(self, text) if self.no_smarty <= 0: - text = smartyPants(text, "qBD") + text = sphinx_smarty_pants(text) return text |