mdown.py 文件源码

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

项目:markdown-xblock 作者: hastexo 项目源码 文件源码
def parse_xml(cls, node, runtime, keys, id_generator):
        """
        Parses the source XML in a way that preserves indenting, needed for markdown.

        """
        block = runtime.construct_xblock_from_class(cls, keys)

        # Load the data
        for name, value in node.items():
            if name in block.fields:
                value = (block.fields[name]).from_string(value)
                setattr(block, name, value)

        # Load content
        text = node.text
        if text:
            # Fix up whitespace.
            if text[0] == "\n":
                text = text[1:]
            text.rstrip()
            text = textwrap.dedent(text)
            if text:
                block.content = text

        return block
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号