Syntactic DifferencesΒΆ

Plim is not the exact port of Slim. Here is the full list of differences.

  1. Slim has the ( ' ), ( =' ), and ( ==' ) line indicators. In Plim, single quote has been replaced by the comma char ( , ):

    , value
    =, value
    ==, value

    The change was made in order to get rid of the syntactic ambiguities like these:

    / Is this an empty python string or a syntax error caused by the unclosed single quote?
    / Is this a python string 'u' ('u''' is the correct python syntax) or
      a syntax error caused by the unclosed unicode docstring?

    Meanwhile, the comma char is not allowed at the beginning of python expression, therefore the following code samples are consistent:

    / Syntax error at mako runtime caused by the unclosed single quote
    / Correct and consistent. Produces an empty unicode string followed by an
      explicit trailing whitespace

    In addition, the comma syntax seems more natural, since in formal writing we also add a whitespace between a comma and the following word (in contrast to apostrophes, which may be written together with some parts of words - “I’m”, “it’s” etc).

  2. Unlike Slim, Plim does not support square or curly braces for wrapping tag attributes. You can use only parentheses ():

    / For attributes wrapping we can use only parentheses
    p(title="Link Title")
      h1 class=( == 1 and 'one' or 'unknown') Title
      / Square and curly braces are allowed only in Python and Mako expressions
      a#idx-${} href=item.get_link(
                   **{'argument': 'value'}) = item.attrs['title']
  3. In Plim, all html tags MUST be written in lowercase.

    This restriction was introduced to support Implicit Litaral Blocks feature.

    doctype 5
        title Page Title
          | Hello, Explicit Literal Block!
          Hello, Implicit Literal Block!
  4. You do not have to use the | (pipe) indicator in style and script tags.

  5. Plim does not make distinctions between control structures and embedded filters.

    For example, in Slim you would write -if, -for, and coffee: (without preceding dash, but with the colon sign at the tail). But in Plim, you must write -if, -for, and -coffee.

  6. In contrast to Slim, Plim does not support the /! line indicator which is used as an HTML-comment. You can use raw HTML-comments instead.