def textcolor_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
"""\
This role is interpreted in the following way:
:textcolor:`<color_spec> text `
where color spec is in HTML model, e.g. #FFFFFF, ...
in latex:
\\textcolor[HTML]{color_spec}{text}
(the leading # is removed from color_spec)
in html
<font color="color_spec">text</font>
"""
color_spec = text[1:text.index('>')]
text = (text[text.index('>')+1:]).strip()
textcolor_node = textcolor()
textcolor_node.children.append(nodes.Text(text))
textcolor_node['color_spec'] = color_spec
return [textcolor_node], []
clatex_sphinx.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录