N:PyTpl 0.5.1 review

Download
by rbytes.net on

N:PyTpl comes from Nec's Python Template System and is a template script written in Python. It parses template files and creates e.g

License: MIT/X Consortium License
File size: 1K
Developer: Necoro d.M.
0 stars award from rbytes.net

N:PyTpl comes from Nec's Python Template System and is a template script written in Python.

It parses template files and creates e.g. HTML as output. Therefore, it is ideal to use for HTML pages, because it reduces redundancy to an absolute minimum.

Templates

Files

- file extension: .tpl

Comments

- comments start with a hash '#' - only a full line can be commented out

Tags

- tags are written in-between square brackets and have to take a whole line: [Tag]
- whitespaces in front of a tag are allowed
- everything following a tag is called "the arguments"; every single line is one argument
- TAG(arg1,arg2) shows the definition above
- Names of tags:
+ can held every char - umlauts should be avoided
+ should not start with a dollar sign '$' - these are handled by the system (differently)
+ should not consist of special characters
- in generally, newlines (n) are deleted from the arguments - these can be prevented by an exclamation mark '!' at the end of the tag: [Tag!]
- if an option-tag should be disabled (e.g. $PARENTS_LINK), a question mark '?' is used at the end of name: [Tag?] - alternatively you can state "NOT" as the argument
- should a tag be stated as a constant (ie. it isn't looked up during loops), append an equation sign '=' to the name of the tag: [Tag=]
- it is not possible to set multiple flags in one tag
- if arguments are given w/o a tag, they are said to belong to the tag $MAIN (q.v.)

Taggys

- taggys are these expressions, which are replaced by the arguments of the tag later on
- they are written in double curly braces: {{Taggy}}
- names of taggys:
+ _must_ have the same name as the corresponding tag
+ ==> same restrictions
- if a taggy cannnot be replaced, the whole argument is removed - this can be avoided by a terminating excl. mark: {{Taggy!}} - in this case the output will show {{Taggy}}
- if a taggy should not be processed during a loop, add an equation sign to the end: {{Taggy=}}

What's New in This Release:
Increased loop performance, a new loop type, and standard templates directly in the source.

N:PyTpl 0.5.1 search tags