Logo Search packages:      
Sourcecode: zine version File versions  Download package

def markdown_parser::markdown::Markdown::_transform (   self  )  [private]

Transforms the Markdown text into a XHTML body document

   @returns: A NanoDom Document 

Definition at line 1237 of file markdown.py.

01237                         :
        """Transforms the Markdown text into a XHTML body document

           @returns: A NanoDom Document """

        # Setup the document

        self.doc = Document()
        self.top_element = self.doc.createElement("span")
        self.top_element.setAttribute('class', 'markdown')

        # Fixup the source text
        text = self.source
        text = text.replace("\r\n", "\n").replace("\r", "\n")
        text += "\n\n"
        text = text.expandtabs(TAB_LENGTH)

        # Split into lines and run the preprocessors that will work with
        # self.lines

        self.lines = text.split("\n")

        # Run the pre-processors on the lines
        for prep in self.preprocessors :
            self.lines = prep.run(self.lines)

        # Create a NanoDom tree from the lines and attach it to Document

        buffer = []
        for line in self.lines:
            if line.startswith("#"):
                self._processSection(self.top_element, buffer)
                buffer = [line]
        self._processSection(self.top_element, buffer)

        #self._processSection(self.top_element, self.lines)

        # Not sure why I put this in but let's leave it for now.

        # Run the post-processors
        for postprocessor in self.postprocessors:

        return self.doc

    def _processSection(self, parent_elem, lines,

Generated by  Doxygen 1.6.0   Back to index