MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / __processElementText

Method __processElementText

markdown/treeprocessors.py:143–170  ·  view source on GitHub ↗

Process placeholders in `Element.text` or `Element.tail` of Elements popped from `self.stashed_nodes`. Arguments: node: Parent node. subnode: Processing node. isText: Boolean variable, True - it's text, False - it's a tail.

(self, node: etree.Element, subnode: etree.Element, isText: bool = True)

Source from the content-addressed store, hash-verified

141 return data
142
143 def __processElementText(self, node: etree.Element, subnode: etree.Element, isText: bool = True) -> None:
144 """
145 Process placeholders in `Element.text` or `Element.tail`
146 of Elements popped from `self.stashed_nodes`.
147
148 Arguments:
149 node: Parent node.
150 subnode: Processing node.
151 isText: Boolean variable, True - it's text, False - it's a tail.
152
153 """
154 if isText:
155 text = subnode.text
156 subnode.text = None
157 else:
158 text = subnode.tail
159 subnode.tail = None
160
161 childResult = self.__processPlaceholders(text, subnode, isText)
162
163 if not isText and node is not subnode:
164 pos = list(node).index(subnode) + 1
165 else:
166 pos = 0
167
168 childResult.reverse()
169 for newChild in childResult:
170 node.insert(pos, newChild[0])
171
172 def __processPlaceholders(
173 self,

Callers 1

__processPlaceholdersMethod · 0.95

Calls 1

__processPlaceholdersMethod · 0.95

Tested by

no test coverage detected