Lines Matching full:parent

32     def lastChild(self, parent):  argument
34 if len(parent):
35 return parent[-1]
60 def test(self, parent, block): argument
68 expression. As the block type may be different depending on the parent
69 of the block (i.e. inside a list), the parent etree element is also
74 * ``parent``: A etree element which will be the parent of the block.
80 def run(self, parent, blocks): argument
88 Note that both the ``parent`` and ``etree`` keywords are pointers
94 to the parent, and should remove (``pop``) or add (``insert``) items to
99 * ``parent``: A etree element which is the parent of the current block.
120 def test(self, parent, block): argument
123 (parent.tag in self.ITEM_TYPES or \
124 (len(parent) and parent[-1] and \
125 (parent[-1].tag in self.LIST_TYPES)
129 def run(self, parent, blocks): argument
131 level, sibling = self.get_level(parent, block)
135 if parent.tag in self.ITEM_TYPES:
136 # The parent is already a li. Just parse the child block.
137 self.parser.parseBlocks(parent, [block])
139 # The sibling is a li. Use it as parent.
142 # The parent is a list (``ol`` or ``ul``) which has children.
143 # Assume the last child li is the parent of this block.
145 # If the parent li has text, that text needs to be moved to a p
153 def create_item(self, parent, block): argument
154 """ Create a new li and parse the block with it as the parent. """
155 li = markdown.etree.SubElement(parent, 'li')
158 def get_level(self, parent, block): argument
167 # We're in a tightlist - so we already are at correct parent.
170 # We're in a looselist - so we need to find parent.
174 child = self.lastChild(parent)
178 parent = child
183 return level, parent
189 def test(self, parent, block): argument
192 def run(self, parent, blocks): argument
193 sibling = self.lastChild(parent)
206 pre = markdown.etree.SubElement(parent, 'pre')
221 def test(self, parent, block): argument
224 def run(self, parent, blocks): argument
230 self.parser.parseBlocks(parent, [before])
234 sibling = self.lastChild(parent)
236 # Previous block was a blockquote so set that as this blocks parent
239 # This is a new blockquote. Create a new parent element.
240 quote = markdown.etree.SubElement(parent, 'blockquote')
241 # Recursively parse block with blockquote as parent.
265 def test(self, parent, block): argument
268 def run(self, parent, blocks): argument
271 sibling = self.lastChild(parent)
273 # Previous block was a list item, so set that as parent
287 # This is a new list so create parent with appropriate tag.
288 lst = markdown.etree.SubElement(parent, self.TAG)
291 # appropriate parent.
294 # Item is indented. Parse with last item as parent
297 # New item. Create li and parse with it as parent
336 def test(self, parent, block): argument
339 def run(self, parent, blocks): argument
349 self.parser.parseBlocks(parent, [before])
351 h = markdown.etree.SubElement(parent, 'h%d' % len(m.group('level')))
367 def test(self, parent, block): argument
370 def run(self, parent, blocks): argument
377 h = markdown.etree.SubElement(parent, 'h%d' % level)
393 def test(self, parent, block): argument
396 def run(self, parent, blocks): argument
408 self.parser.parseBlocks(parent, ['\n'.join(prelines)])
410 hr = markdown.etree.SubElement(parent, 'hr')
425 def test(self, parent, block): argument
428 def run(self, parent, blocks): argument
434 sibling = self.lastChild(parent)
444 def test(self, parent, block): argument
447 def run(self, parent, blocks): argument
450 # Not a blank block. Add to parent, otherwise throw it away.
452 # The parent is a tight-list. Append to parent.text
453 if parent.text:
454 parent.text = '%s\n%s' % (parent.text, block)
456 parent.text = block.lstrip()
459 p = markdown.etree.SubElement(parent, 'p')