From 53f95cde694975e556db7569d3bd89f84459e7bb Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 19 Oct 2008 23:22:05 -0400 Subject: Made InlineProcessor a TreeProcessor. Now an extension can manipulate the tree either before or after InlinePatterns are run. Updated docs as well. This change should not affect existing extensions. --- docs/writing_extensions.txt | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/writing_extensions.txt b/docs/writing_extensions.txt index a97dfdb..617b92e 100755 --- a/docs/writing_extensions.txt +++ b/docs/writing_extensions.txt @@ -22,8 +22,8 @@ features documented here. * [TextPreprocessors][] * [Line Preprocessors][] * [InlinePatterns][] -* [Treeprocessors][] -* [Prostprocessors][] +* [Treeprocessors][] +* [Postprocessors][] * [MarkdownParser][] * [Working with the ElementTree][] * [Integrating your code into Markdown][] @@ -147,17 +147,13 @@ or use as well. Read through the source and see if there is anything you can use. You might even get a few ideas for different approaches to your specific situation. -

Postprocessors

- -Postprocessors manipulate a document after it has passed through the Markdown -core. This is were stored text gets added back in; such as a list of footnotes, -a table of contents, or raw html. - -There are two types of postprocessors: [ElementTree Postprocessors][] and -[TextPostprocessors][]. -

Treeprocessors

+Treeprocessors manipulate an ElemenTree object after it has passed through the +core MarkdownParser. This is where additional manipulation of the tree takes +place. Additionaly, the InlineProcessor is a Treeprocessor which steps through +the tree and runs the InlinePatterns on the text of each Element in the tree. + An Treeprocessor should inherit from ``markdown.Treeprocessor``, over-ride the ``run`` method which takes one argument ``root`` (an Elementree object) and returns either that root element or a modified root element. @@ -174,6 +170,10 @@ For specifics on manipulating the ElementTree, see

Postprocessors

+Postprocessors manipulate the document after the ElementTree has been +serialized into a string. Postprocessors should be used to work with the +text just before output. + A Postprocessor should inherit from ``markdown.Postprocessor`` and over-ride the ``run`` method which takes one argument ``text`` and returns a Unicode string. @@ -310,8 +310,8 @@ arguments: * ``md.textPreprocessors`` * ``md.preprocessors`` * ``md.inlinePatterns`` - * ``md.postpreprocessors`` - * ``md.textPostprocessors`` + * ``md.treepreprocessors`` + * ``md.postprocessors`` Some other things you may want to access in the markdown instance are: -- cgit v1.2.3