Alan Hogan

Feed
  

Parsing order, caching, and formats

Order of Parsing

  1. Look out for [?php[ /uncached code/ ]?] occurances, and strip them out for now.
  2. Designated format(s), e.g. Markdown, are applied to the content.
  3. [include[contentId]] is looked for.

    Note: This means that exact sequences must make it through the specified format! It may be necessary to escape some characters! (This will not be a problem in markdown or plain HTML or bbCode.) (TODO: Verify & test)

  4. If any content was included, it is loaded recursively, so its own content is constructed from its own format(s). That is, for all included content, go back to step 1.

  5. The PHP stripped from the [?php[ /uncached code/ ]?] occurrances, is placed back into the content.
  6. If the caching system believes the result should be cached, it is now saved to cache.
  7. If there were uncached blocks, the whole file is now “included” (the PHP is executed). The final result is returned (to the user, or to the content into which the sub-content was included.)
  8. Any post-processing, like SmartyPants, or ensuring no long lines?
    • Earlier: Would enable caching, but wouldn’t get to process PHP output
    • Later: An extra burden on top of caching
    • Both: Sometimes might (if implemented so that it’s known when reading cache) only cache once. Def twice or more sometimes. Everything gets smartyPants’d. Unless running it twice introduces errors.
  9. Done!

Original content, graphics, and code © Alan J. Hogan 2000–2008. Contact me.

Other work © respective authors.

Site map