Syntax of dislines

version 1.0
23-07-2005. Daniel Clemente.
Español Català English Esperanto

This is the syntax used by the program dislines, http://www.danielclemente.com/dislines/index.en.html



1. General rules

2. Basic tags

  @en This line will only appear at file.en.ext
  @eo And this one, at file.eo.ext
  
  Lines without tag are common to all files.

The valid characters for a tag name are: all which are allowed for a file name, except these: @ ,{}/\

3. Multiple tags

To assign two or more tags to a line, separate them with commas:

  @it,es,fr 50 euros
  @en $60

Note: don't put spaces between commas. Remember that the real line starts from the first space.

4. Blocks

If you're going to write several lines with the same tag, it's not necessary to repeat it at each line. You can use blocks:

  @{en
  All these lines
  are only
  in the English version.
  @}en

Several tags can also be used:

  @{es,en,it
  aaaa
  bbbb
  @}es,en,it

There are several ways to write the start and end tags for a block:

The shortest and most comfortable is possibly:

  @en{
  aaaa
  bbbb
  @}

Blocks can't be nested.

5. Conveniences

Some techniques are allowed to make this language easier to use.

5.1. Last used tag

If you want to write several lines with the same tag, blocks do work. But if there are few lines, you can just repeat @tag at each line, or also use @ followed by one or more double quotes (") to reuse the previous tag. Ex.:

  @en Tag 'en'
  @"" Same tag (en)
  @"" The same (en)
  @fr Tag 'fr'
  @"" The same (fr)

5.2. Comments

You can insert comments:

  @-- This line will not appear in any version

The number of dashes (-) can be anything. Example:

  @--------------- also works

You can also use comment blocks:

  @{---
  several
  lines
  @}---

5.3. Indentation

If you want to maintain the same margin on each line, there are several ways:

You can put more than one at (@) at the beginning of a command:

  @@@català |--- prova --|
  @@@@@@esp |-- prueba --|
  @@english |--- test ---|
  @@@@@@@eo |--- provo --|
  
  @very_long_tag_name 123456789
  @@@@@@@@@@@@@@short 987654321

Common lines can also be written with several ats at the beginning, and they mean nothing special:

  @en English line
  @es Línea en español
  @@@ This line is common

The comments (@--) and the tag repetition (@"") can use any number of - or ".

6. Strange cases

It's not necessary that you know this except if you have ever found with one of these problems.

6.1. Write @ at the beginning of word in a common line

Common lines can be written directly, but if they start by @ they will be interpreted as a tag assignation.

The solution is to use the useless ats, explained at the previous section. Ex.: to write @echo on:

  This isn't correct, it's assigning the tag "echo"
  @echo on
  
  The correct one is:
  @ @echo on
  @@@@@ @echo on
  @@@@@@@@@ @echo on
  etc.

This also applies to blocks: you must put @ @echo on inside a block so that it doesn't get interpreted as a tag assignation.

6.2. Rest of line when opening/closing a block

When using blocks, it's recommended to leave the opening and closing lines with no more text than the own tag. For instance:

  @{es
  aaaaaaa
  bbbbbb
  ccccccc
  @}es

If you included text, for instance,

  @{es aaa
  bbb
  ccc
  @}es ddd

then both the first (aaa) and the last (ddd) would be ignored. The reason for not including aaa is that we don`t want to be adding a blank line if you opened a block just with @{es.

6.3. Commands inside a block

The only commands accepted inside a block are the one-line comments (@----) and the useless ats at the start of the line:

  @{fr
  
  @---- comment; doesn't appear at 'fr' nor anywhere
  @---- it would be incorrect to write now: @en Hello
  
  All this is equivalent:
  a b c
  @ a b c
  @@@@@@ a b c
  
  @}fr

The rest of commands will give error.

Since blocks can't nest, the block comments (@{--) don't work to comment other blocks. You must use @-- at each line.

The reasons for interpreting lines inside a block are: be consistent with that about "all lines which started by @ at the original file have to be protected by an initial @", allow comments inside a block, and allow to write @} without closing it unwillingly.

6.4. Use of @"" at special places

@"" (repeat the last used tag) only works with simple tags, not for blocks. Just enlarging it should work.

If you write @"" at the first line (there's no previous tag), it's interpreted as if it were a common line.

6.5. Block without tag

This:

  @{
  aa
  bb
  @}

is useless and incorrect. The same with @{, and others.

6.6. Comments and tags together

It isn't necessary to write this:

  @---,aa,---,-,---,bb lalala

It's the same as @aa,bb lalala (comments are ignored). Same with blocks.

6.7. Same tag several times

This isn't recommended and has an undefined result:

  @en,en Double? Maybe yes, maybe not.

7. Ideas for the next version

For version 2 of this specification (if it's necessary to do it), I may include things like:

7.1. Special commands

They are written at the beginning of the file:

  @! instruction

They would do a lot of things. For instance:

  @! ExecuteAfter: txt2tags $BASENAME.en.t2t
  @! Encoding(es): iso-8859-1

7.2. Groups of tags

  @! Group euros es,fr,it

And then:

  @euros 6 euros
  ( equal to @es,fr,it )

7.3. Inverse tag selection

You can assign to a line "all tags except these ones". Ex.:

  @ˆen Everything except en
  @ˆen,it Everything except en,it
  @ˆ{en
  everything except en
  ....
  ..
  @ˆ}en

7.4. Repetition of lines and blocks

This:

  @{en,en
  ab
  cd
  @}en,en

should it repeat that block two times? It doesn't seem useful, and makes the program more complex.

8. I'm waiting for comments

Tell me what do you think about this language and program, and what can I add, remove or simplify. I want it to be simple, useful, and suitable for being written manually.


July 2005, Daniel Clemente Laboreo. ( n142857 {at/- g-m-a-i-l- .-c-o-m )

http://www.danielclemente.com/dislines/