Difference between revisions of "Artefact:Template/org/oogenerator/examples/tutorial/Example0060 PrettySyntax"
From OOModels
< Artefact:Template | org | oogenerator | examples | tutorial
Jump to navigationJump to search
AndreasLeue (talk | contribs) m |
AndreasLeue (talk | contribs) m (Artefact:Template/org/oogenerator/examples/Example0060 PrettySyntax moved to Artefact:Template/org/oogenerator/examples/tutorial/Example0060 PrettySyntax) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
| Meta_Maturity = final | | Meta_Maturity = final | ||
}} | }} | ||
{{AutoUpload}} | |||
==Code== | ==Code== | ||
Line 14: | Line 16: | ||
This template demonstrates how to make your templates look good. | This template demonstrates how to make your templates look good. | ||
There are two tiny syntactic helpers to solve two frequently encountered | |||
problems. | |||
⊱</span> | ⊱</span> | ||
Line 41: | Line 46: | ||
<span class="oogindentation"> ⋮</span>Hello, world! | <span class="oogindentation"> ⋮</span>Hello, world! | ||
<span class="oogcomment">⊰ | <span class="oogcomment">⊰ | ||
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 | So, if you combine these concepts, you might e.g. write | ||
⊱</span><span class="oogcontinuation">…</span> | ⊱</span><span class="oogcontinuation">…</span> |
Latest revision as of 16:05, 17 July 2008
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 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. ⊱