DokuWiki

It's better when it's simple

User Tools

Site Tools


devel:parser

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
devel:parser [2015-09-13 12:02]
ach old revision restored (2014-01-08 22:01)
devel:parser [2016-05-08 06:52] (current)
84.142.137.15 [Renderer] correct link to Wikipedia
Line 903: Line 903:
 It is used to document the Renderer although it could be also be extended if you wanted to write a Renderer which only captures certain calls. It is used to document the Renderer although it could be also be extended if you wanted to write a Renderer which only captures certain calls.
  
-The basic principle for how the instructions, returned from the parser, are used against a Renderer is similar to the notion of a [[wp>SAX XML API]] - the instructions are a list of function / method names and their arguments. Looping through the list of instructions, each instruction can be called against the Renderer (i.e. the methods provided by the Renderer are [[wp>Callback_(computer_science)|callbacks]]). Unlike the SAX API, where only a few, fairly general, callbacks are available (e.g. tag_start, tag_end, cdata etc.), the Renderer defines a more explicit API, where the methods typically correspond one-to-one with the act of generating the output.+The basic principle for how the instructions, returned from the parser, are used against a Renderer is similar to the notion of a [[wp>Simple_API_for_XML|SAX XML API]] - the instructions are a list of function / method names and their arguments. Looping through the list of instructions, each instruction can be called against the Renderer (i.e. the methods provided by the Renderer are [[wp>Callback_(computer_science)|callbacks]]). Unlike the SAX API, where only a few, fairly general, callbacks are available (e.g. tag_start, tag_end, cdata etc.), the Renderer defines a more explicit API, where the methods typically correspond one-to-one with the act of generating the output.
 In the section of the Renderer shown above, the ''p_open'' and ''p_close'' methods would be used to output the tags ''%%<p>%%'' and ''%%</p>%%'' in XHTML, respectively, while the ''header'' function takes two arguments - some text to display and the "level" of the header so a call like ''%%header('Some Title',1)%%'' would be output in XHTML like ''%%<h1>Some Title</h1>%%''. In the section of the Renderer shown above, the ''p_open'' and ''p_close'' methods would be used to output the tags ''%%<p>%%'' and ''%%</p>%%'' in XHTML, respectively, while the ''header'' function takes two arguments - some text to display and the "level" of the header so a call like ''%%header('Some Title',1)%%'' would be output in XHTML like ''%%<h1>Some Title</h1>%%''.
  
devel/parser.txt · Last modified: 2016-05-08 06:52 by 84.142.137.15