Artefact:Template/org/oogenerator/examples/tutorial/Example0060 PrettySyntax
From OOModels
< Artefact:Template | org | oogenerator | examples | tutorial
Jump to navigationJump to search
Revision as of 19:21, 2 July 2008 by AndreasLeue (talk | contribs) (New page: {{Metabox | Meta_Type = Type:org/oogenerator/Template/2.0 | Meta_Domain = Domain:it/development/formatting | Meta_Category = Type:org/oomodels/wiki/Template | Meta_Download = true | ...)
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 |
Code[edit]
G-2.0-plain_java-1.0 ⊰ This templates demonstrates how to make your template look good. ⊱ ⊰ 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! ⊰ 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. ⊱