[Pythonjp-checkins] [py33.python-doc-ja] push by nozom****@gmail***** - 脚注が含まれる段落が翻訳されない問題に暫定対応 on 2012-11-16 20:45 GMT

Zurück zum Archiv-Index

pytho****@googl***** pytho****@googl*****
2012年 11月 17日 (土) 05:45:46 JST


Revision: 2708c1ccc3f8
Branch:   default
Author:   Nozomu Kaneko <nozom****@gmail*****>
Date:     Fri Nov 16 12:38:14 2012
Log:      脚注が含まれる段落が翻訳されない問題に暫定対応
http://code.google.com/p/python-doc-ja/source/detail?r=2708c1ccc3f8&repo=py33

Modified:
  /tools/sphinxext/jpsupport.py

=======================================
--- /tools/sphinxext/jpsupport.py	Fri Oct 26 04:45:32 2012
+++ /tools/sphinxext/jpsupport.py	Fri Nov 16 12:38:14 2012
@@ -63,10 +63,26 @@
      source[0] = result


+def fix_reference(app, doctree, docname):
+    if not app.config.japanesesupport_fix_reference:
+        return
+    # Hot-fix for the issue #955
+    # "Can't build html with footnotes when using i18n"
+    # https://bitbucket.org/birkenfeld/sphinx/issue/955
+    from docutils import nodes
+    for node in doctree.traverse(nodes.footnote_reference):
+        if "refid" not in node.attributes:
+            node.attributes["refid"] = ""
+            if len(node.children) == 0:
+                node += nodes.Text("#")
+
+
  def setup(app):
      app.add_config_value('japanesesupport_trunc_whitespace', True, True)
      app.add_config_value('japanesesupport_separate_markup', True, True)
-    app.add_config_value('japanesesupport_hash_after', True, True)
+    # app.add_config_value('japanesesupport_hash_after', True, True)
+    app.add_config_value('japanesesupport_fix_reference', True, True)
      app.connect("doctree-resolved", trunc_whitespace)
      app.connect("source-read", separate_markup)
-    app.connect("source-read", hash_after)
+    # app.connect("source-read", hash_after)
+    app.connect("doctree-resolved", fix_reference)




Pythonjp-checkins メーリングリストの案内
Zurück zum Archiv-Index