clatex_sphinx.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:finite-element-course 作者: finite-element 项目源码 文件源码
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], []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号