spyce
         
home     documentation     download     Spyce logo


Documentation - Language

Prev: 1.2 - Design Goals Up: Table of Contents Next: 2.1 - Plain HTML and Active Tags

2. LANGUAGE

The basic structure of a Spyce script is an HTML file with embeddings. There are six types of possible embeddings among the plain HTML text:

  • <taglib:name attr1=val1 ...>
    Active tags may include presentation and action code.
  • [[-- Spyce comment      --]]
    Enclosed code is elided from the compiled Spyce class.
  • [[\  Python chunk         ]]
    Embed python in your code.
  • [[!  Python class chunk  ]]
    Like chunks, but at the class level rather than the spyceProcess method.
  • [[   Python statement(s)  ]]
    Like chunks, but may include braces to indicate that the block should continue after the ]].
  • [[=  Python expression    ]]
    Output the result of evaluating the given expression.
  • [[.  Spyce directive      ]]
    Pass options to the Spyce compiler.
  • [[spy  lambda             ]]
    Allows dynamic compilation of Spyce code to a python function.
Each Spyce tag type has a unique beginning delimeter, namely [[, [[\, [[=, [[. or [[--. All tags end with ]], except comment tags, which end with --]].

Since [[ and ]] are special Spyce delimeters, one would escape them as \[[ and \]] for use in HTML text. They can not be escaped within Python code, but the string expressions ("["*2) and ("]"*2), or equivalent expressions, can be used instead, or the brackets can be conveniently separated with a space in the case of list or slicing expressions.


Prev: 1.2 - Design Goals Up: Table of Contents Next: 2.1 - Plain HTML and Active Tags

Sub-sections:


Spyce logo
Python Server Pages
version 2.1.3
Spyce Powered SourceForge Logo