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 revisionPrevious revision
Next revisionBoth sides next revision
devel:parser [2015-09-13 12:02] – old revision restored (2014-01-08 22:01) achdevel:parser [2016-05-08 06:52] – [Renderer] correct link to Wikipedia 84.142.137.15
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: 2023-09-18 16:38 by 69.14.68.110

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki