ext.py 文件源码

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

项目:linotype 作者: lostatc 项目源码 文件源码
def run(self) -> List[nodes.Node]:
        """Run the directive.

        Returns:
            A list of Node objects.
        """
        root_item = self._retrieve_item()

        if "item_id" in self.options:
            root_item = root_item.get_item_by_id(
                self.options["item_id"], raising=True)

        if "children" in self.options:
            root_item.parent = None

        # Parse directive and get content to extend items with.
        nested_nodes = nodes.paragraph()
        self.state.nested_parse(
            self.content, self.content_offset, nested_nodes)
        def_list = _get_matching_child(
            nested_nodes, nodes.definition_list, last=False)
        if def_list is not None:
            definitions = _parse_definition_list(def_list)
        else:
            definitions = collections.defaultdict(lambda: None)

        return self._parse_tree(root_item, definitions)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号