Edgewall Software

Changes between Version 2 and Version 3 of GenshiRecipes/RecursiveIncludeScanner


Ignore:
Timestamp:
Sep 12, 2006, 12:24:23 PM (18 years ago)
Author:
cmlenz
Comment:

s/Markup/Genshi

Legend:

Unmodified
Added
Removed
Modified
  • GenshiRecipes/RecursiveIncludeScanner

    v2 v3  
     1= [GenshiRecipes Genshi Recipes]: Recursive Include Scanner =
     2
    13== Motivation ==
    24
    3 This recipe evolved after discussion of another recipe, [wiki:MarkupRecipes/SconsXIncludeScanner Implicit dependencies with scons], on [IrcChannel #markup]. The solution, and the source code used in this recipe, was kindly provided by Christopher Lenz (aka cmlenz).
     5This recipe evolved after discussion of another recipe, [wiki:GenshiRecipes/SconsXIncludeScanner Implicit dependencies with scons], on the IrcChannel. The solution, and the source code used in this recipe, was kindly provided by Christopher Lenz (aka cmlenz).
    46
    57When working with a relatively large set of xml sources that make use of XIncludes there is a common question that comes in two forms:
     
    810 * What files '''were''' included by a particular source ?
    911
    10 This recipe seeks to address the first sense as far as is possible. [wiki:MarkupRecipes/SconsXIncludeScanner Implicit dependencies with scons] could be used as a starting point for answering the second.
     12This recipe seeks to address the first sense as far as is possible. [wiki:GenshiRecipes/SconsXIncludeScanner Implicit dependencies with scons] could be used as a starting point for answering the second.
    1113
    1214== Code ==
     
    1517{{{
    1618#!python
    17 """Recursive xincludes scanner for Markup
     19"""Recursive xincludes scanner for Genshi
    1820
    1921This solution was kindly provided by Christopher Lenz <cmlenz@gmx.de>
     
    2123
    2224import os,sys
    23 from markup.core import START
    24 from markup.filters import IncludeFilter
    25 from markup.input import XMLParser
     25from genshi.core import START
     26from genshi.filters import IncludeFilter
     27from genshi.input import XMLParser
    2628 
    2729def scan_xincludes(filename):
     
    7678== Discussion ==
    7779
    78 Markup syntax supports conditional includes and includes whose target file names are dynamic. The latter makes it impossible to know for certain "before the show", which files '''will''' be included. Conditional includes that depend on static state could be determined before the show. This is, however, far from trivial.
     80The Genshi XML template language supports conditional includes and includes whose target file names are dynamic. The latter makes it impossible to know for certain "before the show", which files '''will''' be included. Conditional includes that depend on static state could be determined before the show. This is, however, far from trivial.
    7981
    80 Integrating Markup, or anything like it, into a build system is a typical scenario that prompts these questions. Typically you will want automatic dependencies, and reliable, but minimal, rebuilds in the event that any of your source files are changed.
     82Integrating Genshi, or anything like it, into a build system is a typical scenario that prompts these questions. Typically you will want automatic dependencies, and reliable, but minimal, rebuilds in the event that any of your source files are changed.
    8183
    8284For build system dependencies the consequence of false positives is often acceptable. The consequence being more sources are rebuilt than strictly necessary. And, answering the latter form of the question, "what files '''were''' included" is usually sufficient for ensuring re-builds are both minimal and correct.
    8385
    84 
     86----
     87See also GenshiRecipes, [wiki:GenshiRecipes/SconsXIncludeScanner]