STxT: The Book

A language for the web

Documents Without Namespace

I believe it’s already clear what documents without a namespace are like. Example:

Recipe: Macaroni Recipe
    Description:
        :This is the description of the macaroni recipe.
        :Bla, bla, bla
        :Bla, bla, bla
    Servings: 3
    Difficulty: easy
    Ingredients:
        Ingredient: (100g) Tomato
        Ingredient: (240g) Macaroni
    Steps:
        Step: (1) Make the sauce
        Step: (2) Boil the macaroni
        Step: (3) Mix the macaroni with the sauce and serve

Let's delve a little deeper.

Encoding

UTF-8 Encoding Always

The end. It’s a good rule, and I’m very happy with it. Nowadays, it’s the most acceptable, most universal, and most implemented encoding. I don’t think this will change in the coming years.

Identifiers

Identifiers are CASE-INSENSITIVE

Spaces are allowed in names.
Why not? Just to seem more technical?
Times are changing :-D

Escape Characters

There are no escape characters

I think this is the best thing I’ve heard in a long time. There are no escape characters because they aren’t necessary. Due to the structure, they aren’t needed.

Comments

All tech-savvy individuals know what comments are in any language. For any beginners, I’ll explain that comments are text that’s only there to comment or add some observation, but they don’t influence the document itself.

In STxT, comments are all lines that start with the character #

Comments don’t need any specific format; they’re free text that the document author can include. Moreover, they don’t need to be placed in any specific part of the document. Any line that starts with # will be treated as a comment, and won’t be considered by programs or in communications.

Example:

Recipe: Macaroni Recipe
# (1) This is a comment
# (2) This is also a comment
    # (3) This is also a comment
    Description:
        :This is the description of the macaroni recipe.
        :Bla, bla, bla
    # (4) This is a comment    
        :Bla, bla, bla
        # (5) This is NOT a comment
    Servings: 3
    Difficulty: easy
    Ingredients:
        Ingredient: (100g) Tomato
        Ingredient: (240g) Macaroni
    Steps:
        Step: (1) Make the sauce
        Step: (2) Boil the macaroni
        Step: (3) Mix the macaroni with the sauce and serve

It’s worth noting that (1),(2),(3) and (4) are comments, while (5) is not, as it is within the indented text.

Nodes and Indentation

We mentioned earlier that an STxT document is a set of nested nodes. Indentation is very similar to other languages, and tabs or spaces can be used.

4 spaces are equivalent to one tab It’s better not to mix documents with tabs and spaces

Multiline Nodes

These nodes allow for complete texts across multiple lines. In documents with namespaces, they will be equivalent to TEXT type nodes. They are constructed with lines that start with :, but without a preceding label. Example:

Recipe: Macaroni Recipe
    Description:
        :This is the description of the macaroni recipe.
        :Bla, bla, bla
        :Bla, bla, bla
    Servings: 3
    Difficulty: easy
    Ingredients:
        Ingredient: (100g) Tomato
        Ingredient: (240g) Macaroni
    Steps:
        Step: (1) Make the sauce
        Step: (2) Boil the macaroni
        Step: (3) Mix the macaroni with the sauce and serve

We’ve just seen that the Description node is a MULTILINE node.

(Prefix) Central (Suffix)

Although it’s not part of the language, it’s common practice that simple fields are structured with (prefix) central (suffix). All three can appear, or just 1 or 2 of them. Example:

Recipe: Macaroni Recipe
    Description:
        :This is the description of the macaroni recipe.
        :Bla, bla, bla
        :Bla, bla, bla
    Servings: 3
    Difficulty: easy
    Ingredients:
        Ingredient: (100g) Tomato
        Ingredient: (240g) Macaroni
    Steps:
        Step: (1) Make the sauce
        Step: (2) Boil the macaroni
        Step: (3) Mix the macaroni with the sauce and serve
This website uses cookies to ensure you get the best experience on our website. [cookies.html|Learn more] Got it! More info