Artefact:Template/org/oogenerator/examples/tutorial/Example0060 PrettySyntax

From OOModels
Jump to navigationJump to search
Classification
Type Type:org/oogenerator/Template/2.0
Domain Domain:it/development/formatting
Category Type:org/oomodels/wiki/Template
Maturity final
More
Download Code
Namespace (more)

OOGenerator main package

create new pages

Do not edit manually!

Code[edit]

G-2.0-plain_java-1.0
⊰

   This template demonstrates how to make your templates look good.

   There are two tiny syntactic helpers to solve two frequently encountered
   problems.

⊱
⊰
   To illustrate the first problem, note that between the first comment and
   the second one (this one) there is a line break. In templates, it is often
   desirable to have nicely layouted template code, while at the same time
   nicely layouted results. How to achieve this?

   First, note the three tiny continuation dots '' behind the following comment
   end delimiter:
⊱
⊰
   They simple say: please ignore the line break (they are comparable to the
   use of a backslash in programming languages like C or C++).
⊱
⊰
   Another problem often encountered is the indentation depth mismatch between
   template code and result code. E.g.
⊱
                              Hello, world!
⊰
   is of course indented in the output by 30 spaces. How to avoid this,
   without compromising template layout? That's the purpose of the indentation
   character '⋮', like here
⊱
Hello, world!
⊰
   The '⋮' character says: please ignore every whitespace between me and the
   beginning of the line.

   So, if you combine these concepts, you might e.g. write
⊱
Hello, 
◂"world"▸
!
⊰
   which creates again "Hello, world!", without any additional spaces or line
   breaks before, after of within the output.
⊱