Parse a markdown document into an ElementTree. Given a list of lines, an ElementTree object (not just a parent Element) is created and the root element is passed to the parser as the parent. The ElementTree object is returned. This should only be c
(self, lines)
| 46 | self.state = State() |
| 47 | |
| 48 | def parseDocument(self, lines): |
| 49 | """ Parse a markdown document into an ElementTree. |
| 50 | |
| 51 | Given a list of lines, an ElementTree object (not just a parent Element) |
| 52 | is created and the root element is passed to the parser as the parent. |
| 53 | The ElementTree object is returned. |
| 54 | |
| 55 | This should only be called on an entire document, not pieces. |
| 56 | |
| 57 | """ |
| 58 | # Create a ElementTree from the lines |
| 59 | self.root = markdown.etree.Element(markdown.DOC_TAG) |
| 60 | self.parseChunk(self.root, '\n'.join(lines)) |
| 61 | return markdown.etree.ElementTree(self.root) |
| 62 | |
| 63 | def parseChunk(self, parent, text): |
| 64 | """ Parse a chunk of markdown text and attach to given etree node. |