def copy(self):
'''sphinx.util.nodes (function _new_copy) monkey-patches the Element.copy method
to include the source and line, however, it calls the Element constructor with
a positional argument rawsource instead of using keyword arguments.
That is changed here so that the constructor of this class can use other
positional parameters.
'''
newnode = self.__class__(self.tagname, self.attributes, self.no_write,
self.skip_html, *self.children)
if isinstance(self, nodes.Element):
newnode.source = self.source
newnode.line = self.line
return newnode
评论列表
文章目录