Curly braces should be escaped with a backslash (i.e., \{ and \}), as they usually mark macros:
{COMMAND [OPTIONS]: ARGS...}
NOTE: Macros cannot cross paragraph boundaries, i.e., they must not contain empty lines. Using newlines in a macro argument is useless, as the macro text will be collapsed to one single line.
NOTE: These aren’t macros in the
sense of read-time expansions/replacements. They are called
macros here because the (original) term
commands is now used for #CMD type of
commands only.
NOTE: If the macro name is unknown, a clip or a variable will be used instead. The order is: macros > clips > variables.
NOTE: Some macros parse their arguments,
which then can contain other macros – e.g.,
list and item. “Parsing” is done
with a simple nested regular expression. This appears to work quite well
but could yield unintended results in some situations. The maximum of
nested macros currently is 5 (which should really
enough due to the primitivity of the macro
language). If you want more (e.g., 10), add this to your config file:
Deplate::Particle::Macro.build_rx(10)
#Ruby context=ruby <<--
class Deplate::Macro::Test < Deplate::Macro
register_as 'test'
def setup(text)
@elt = @deplate.parse(@container, '<' + text + '>')
end
end
--
Bla {test: [1
{test: 2
{test: 3
{test: 4}
}
}
inner bla
{test: a
{test: b
{test: c
{test: d}
}
}
}]
}
Bla
Output:
Bla <[1 <2 <3 <4>>> inner bla <a <b <c <d>>>>]> Bla
NOTE: You could run into problems if an macro argument contains unbalanced curly braces. It should work by preceding them with a backslash, but …
#OPT does for block
elements
arg macro. The
difference between var and arg is that the
var macro returns a value in a
format can read.
{varname} which will
expand to {arg: varname}. {varname!} will
expand to {var: varname}. Thus,
{varname capitalize!} is equivalent to
{arg capitalize!: varname}.
. allow flag is set, the NAME
may have the form NAME[METHOD] to send methods to an
object.
''CODE''
__TEXT__)
mark1stStyle is defined,
this style will be used. Otherwise, the string’s first occurrence
will be printed in upper case letters. Arguments
Footnotes:
Foo bar{fn: x} foo bar.
#Fn: x <<EOFN
Ceci n'est pas une note.
EOFN
Reference:
Bar is bar.
#bar
Foo is foo (see also{ref: bar}).
Citation:
#BIB: deplate.bib
Mynona's{cite y! n=e.g.,: mynona:p1} real name was Salomo Friedlaender.
% You can find the bibliography down below. The command is commented out
% in order not to confuse nervous docbook tools.
% #MAKEBIB plain!: cbib-apa-1
Comments:
This line{cmt: here} contains a comment.
Date:
{date: today}
Ruby:
{ruby alt=ruby disabled: 1 + 1}
Image:
An inline {img rotate=90 h=40: linked} image (which is rotated in LaTeX
output).
LaTeX:
Test ({ltx: $\sum_{i=n}^{n} x_{i}$}) the ltx macro.
Text formatting:
Foo{,bar & bar} is foo, but bar{^foo & foo} is bar.
Foo {\__with__} or {plain: ''without''} bar.
{~Tom} says: "My name is {~Tom}."
{upcase: Foo bar}, {downcase: Foo bar}, {capitalize: Foo bar}.
x{%{:2}{:a}} = 1
#IF: fmt!=latex
Small lists (this example doesn't work in latex):
| {list: {item: foo} {item: bar}} \
| {list type=dl: {term id=Foo: Foo is foo} {term id=Bar: Bar is bar}} \
|
| {list: {item: here} {item: there}} \
| {list type=dl: {term id=Here: Here is here} {term id=There: There is there}} \
|
#ENDIF
If you allow ".", you can could do something like this: This is the
paragraph with the id ''testParagraph1''.
#OPT: id=testParagraph1
The element with id=testParagraph1 is a {let t=object(id=testParagraph1):
{arg asString!: t.class}}.
#VAR: varname=Lala
#CLIP id=theSinger: __Maestro__ Maximo
{varname} is foo. {arg: varname} is foo.
{varname!} is bar. {var: varname} is bar.
{theSinger} sings {varname!}.
Output:
Footnotes: Foo bar2 foo bar.
Reference: Bar is bar.
Foo is foo (see also 13.5).
Citation: Mynona’s (e.g., 1980) real name was Salomo Friedlaender.
Comments: This line contains a comment.
Date: 29. Nov 2008
Ruby: 2
Image: An inline
image (which is rotated in LaTeX output).
Text formatting: Foobar & bar is foo, but barfoo & foo is bar. Foo __with__ or ''without'' bar.
TOM says: “My name is Tom.”
FOO BAR, foo bar, Foo bar.
x2a = 1
Small lists (this example doesn’t work in latex):
|
|
|
|
If you allow “.”, you can could do
something like this: This is the paragraph with the id
testParagraph1.
The element with id=testParagraph1 is a Deplate::Element::Paragraph.
Lala is foo. Lala is foo.
"Lala" is bar. "Lala" is bar.
Maestro Maximo sings "Lala".
2Ceci n’est pas une note.