如何在Sphinx/RestructuredText中上标注册商标?

3
我该如何在Sphinx/RestructuredText中上标®符号?
这种写法是不正确的,你会得到一个带有上标的|reg|。
bigNameBrand\ :sup:`|reg|`

1
“bigNameBrand\ :sup:®”不是您的选择吗? - Timotheus.Kampik
哦噢...我真的很想继续使用ASCII源文件。 - Jason S
1个回答

2

通过创建自定义角色找到了一种解决方法。唉,我不应该这样做。

在conf.py中:

def supsub_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
    node = docutils.nodes.superscript()
    node2 = docutils.nodes.substitution_reference(refname=text)
    node += [node2]
    return [node],[]

def setup(app):
    app.add_role('supsub', supsub_role)

然后:

.. |regsup| replace:: :supsub:`reg`

然后您可以使用|regsup|来获取上标注册商标。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接