Ignore:
Timestamp:
11/25/08 00:57:30 (4 years ago)
Author:
KennethLavrsen
Message:

Item221: Finish the TWiki:Codev to Foswiki:xxx conv
Had to leave a few behind in docs that were to hard to convert
old extensions that probably are out of date

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/TemplateToolkitPlugin/data/TWiki/TemplateToolkitPlugin.txt

    r878 r929  
    55 
    66This is a rather slim glue to Andy Wardley's Template Toolkit 
    7 (see http://www.template-toolkit.org/ or TWiki:Codev.TemplateToolkit 
    8 for more, though the latter is pretty stale). 
     7(see http://www.template-toolkit.org/ for more. 
    98 
    109I myself have here and then argued that TT is too heavyweight for use 
    11 as a template system for TWiki, but this does only prevent using TT as 
    12 the _only_ template system for TWiki. 
     10as a template system for Foswiki, but this does only prevent using TT as 
     11the _only_ template system for Foswiki. 
    1312 
    1413If, on the other hand, you _do_ have TT installed anyway, and 
    1514especially if you have it running in a mod_perl environment where 
    1615module compilation time is no longer an issue, then you might want to 
    17 share your TT blocks or layouts with TWiki. 
     16share your TT blocks or layouts with Foswiki. 
    1817 
    1918The implementation as a plugin does not allow to install TT 
    20 as a drop-in replacement for TWiki's own templating system.  But I 
     19as a drop-in replacement for Foswiki's own templating system.  But I 
    2120think that for first experiments it is possible to emulate that: Use 
    22 very slim TWiki templates to get TWiki's template system out of 
     21very slim Foswiki templates to get Foswiki's template system out of 
    2322the way, and run your topics through TT instead. 
    2423 
    2524To be honest, I am using this plugin as both a first step to evaluate 
    26 TT as a TWiki template machine, and as a real-life hands-on example 
     25TT as a Foswiki template machine, and as a real-life hands-on example 
    2726for BenchmarkContrib to play with. 
    2827 
     
    3130---++ Syntax Rules 
    3231 
    33 The plugin has just one TWiki tag in the TWiki sense: 
     32The plugin has just one Foswiki tag in the Foswiki sense: 
    3433 
    3534%STARTSECTION{"VarTEMPLATETOOLKIT"}% 
     
    3837     processed by TT. 
    3938   * A configuration variable named 
    40      =$TWiki::cfg{Plugins}{TemplateToolkitPlugin}{UseTT}= can be used 
     39     =$Foswiki::cfg{Plugins}{TemplateToolkitPlugin}{UseTT}= can be used 
    4140     to set a site-wide default 
    4241   * Supported Parameters: 
     
    5251 
    5352All configuration variables for this plugin are collected under 
    54 =$TWiki::cfg{Plugins}{TemplateToolkitPlugin}=. 
     53=$Foswiki::cfg{Plugins}{TemplateToolkitPlugin}=. 
    5554 
    5655| *Configuration Variable* | *Description* | 
    5756| ={UseTT}= | Sitewide default for TT usage.  Can be overridden in a topic with the =%<nop>TEMPLATETOOLKIT{...}%= tag. | 
    58 | ={TToptions}= | Hash reference passed as =\%config= parameter to =Template->new()=.  Refer to the TT documentation for details.%BR%Per default, the current topic's attachment directory is used as =INCLUDE_PATH=, and the =START_TAG= option is basically the familiar =[&#37;=, but adjusted to take care for TWiki forced link/variable combinations. | 
     57| ={TToptions}= | Hash reference passed as =\%config= parameter to =Template->new()=.  Refer to the TT documentation for details.%BR%Per default, the current topic's attachment directory is used as =INCLUDE_PATH=, and the =START_TAG= option is basically the familiar =[&#37;=, but adjusted to take care for Foswiki forced link/variable combinations. | 
    5958 
    6059---++ Notes on Template Toolkit Syntax 
     
    6463=[&#37;= and =%]=.  As almost everything in TT this is configurable, 
    6564but the default delimiters are used quite frequently because they usually 
    66 don't occur in "normal text".  _Usually_.  In TWiki, there is a syntax 
     65don't occur in "normal text".  _Usually_.  In Foswiki, there is a syntax 
    6766construction which is quite popular, but makes TT croak: Forced links, 
    68 with an embedded TWiki variable.  Example: 
     67with an embedded Foswiki macro.  Example: 
    6968<verbatim> 
    7069[[%SYSTEMWEB%.%STATISTICSTOPIC%]] 
    7170</verbatim> 
    72 This is a valid TWiki link pointing to 
     71This is a valid Foswiki link pointing to 
    7372[[%SYSTEMWEB%.%STATISTICSTOPIC%]], but an invalid TT construct 
    7473=[&#37; SYSTEMWEB%.%STATISTICSTOPIC %]= within an additional set of square 
     
    7978   * It is good practice to write your TT constructs as =[&#37; tt_directive %]=, 
    8079     i.e. with surrounding spaces around directives.  By doing so, 
    81      you'll make sure to never clash with a possible TWiki variable name 
     80     you'll make sure to never clash with a possible Foswiki macro name 
    8281     =%<nop>tt_directive%=. 
    83    * Separate TT stuff from heavy TWiki lifting or you'll get severe bracketiquotitis. 
     82   * Separate TT stuff from heavy Foswiki lifting or you'll get severe bracketiquotitis. 
    8483   * If you want to use different delimiters, define both ={TToptions}{START_TAG}= and 
    85      ={TToptions}{END_TAG}= in =$TWiki::cfg{Plugins}{TemplateToolkitPlugin}=. 
     84     ={TToptions}{END_TAG}= in =$Foswiki::cfg{Plugins}{TemplateToolkitPlugin}=. 
    8685   * When writing TT wrappers for use with this plugin, keep in mind that they are 
    8786     TT-expanded, but not TML-processed. 
     
    101100---++ Security Considerations 
    102101 
    103 Unlike in typical TT web applications, in a TWiki many people can edit 
     102Unlike in typical TT web applications, in a Foswiki many people can edit 
    104103the templates, and so they can introduce TT directives.  To keep your 
    105 TWiki unharmed, some precautions should be made: 
     104Foswiki unharmed, some precautions should be made: 
    106105   1 Do not enable EVAL_PERL (it is off per default). 
    107106   1 Do not pass critical data structures like the configuration hash 
     
    114113 
    115114If time permits, I'll try to: 
    116    * create a TWiki skin and a TT layout in parallel and run 
     115   * create a Foswiki skin and a TT layout in parallel and run 
    117116     benchmarks on both. 
    118117   * document (and extend) configuration items 
    119    * Add a =TWiki= filter for TT templates so that wrappers can use TWiki variables 
     118   * Add a =Foswiki= filter for TT templates so that wrappers can use Foswiki macros 
    120119   * ... 
    121120 
Note: See TracChangeset for help on using the changeset viewer.