pytho****@googl*****
pytho****@googl*****
2012年 11月 24日 (土) 07:12:28 JST
Revision: ad0a52699487 Branch: default Author: Nozomu Kaneko <nozom****@gmail*****> Date: Fri Nov 23 14:10:41 2012 Log: Add support for docfields in I18nDoctreeFixer. http://code.google.com/p/python-doc-ja/source/detail?r=ad0a52699487&repo=py33 Modified: /tools/sphinxext/jpsupport.py ======================================= --- /tools/sphinxext/jpsupport.py Fri Nov 23 10:41:20 2012 +++ /tools/sphinxext/jpsupport.py Fri Nov 23 14:10:41 2012 @@ -109,6 +109,31 @@ node.clear() node += para + # docfields - generated by sphinx.util.docfields.DocFieldTransformer + for node in self.document.traverse(nodes.field_list): + for field_body in node.traverse(nodes.field_body): + if field_body.rawsource: + continue + for para in field_body.traverse(nodes.paragraph): + if para.rawsource: + continue + assert len(para.children) > 2 + assert unicode(para.children[1]) == ' -- ' + xref, sep = para.children[:2] + contents = para.children[2:] + rawsource = "" + if isinstance(xref, nodes.emphasis): + rawsource += "*%s*" % xref.rawsource + elif isinstance(xref, nodes.strong): + rawsource += "**%s**" % xref.rawsource + else: + rawsource += xref.rawsource + rawsource += unicode(sep) + rawsource += "".join([c.rawsource for c in contents]) + para.rawsource = rawsource + para.source = node.source + para.line = node.line + def setup(app): app.add_config_value('japanesesupport_trunc_whitespace', True, True)