[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-recutils] Slots in templates
From: |
Jose E. Marchesi |
Subject: |
[bug-recutils] Slots in templates |
Date: |
Sun, 26 Dec 2010 17:09:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) |
Hi.
In the latest release of the recutils (1.1) a new utility was put in
place: recfmt. The current support for templates includes the expansion
of selection expressions into its evaluated value. In its most basic
form it can be used to expand field names, like in the following
template:
{{Name}} ({{Id}})
--
{{Description}}
But any SEX can be used in slots, like in:
Surface: {{Width * Height}} square {{Unit}}s.
I am now pondering about introducing some "modifiers" in the slots.
Kind of parameters that would alter the way the value of the inner SEX
is inserted in the final text.
For example, the "i" modifier would indicate that we want the resulting
string to be indented into the template. So, the template:
Task {{Id}}
{{i|Description}}
would generate something like:
Task 100
This is a description composed by multiple
lines. It is indented because of the 'i'
modifier.
Note the usage of the i| just after the opening curly braces in the
slot.
Some modifiers could accept a parameter. For example, consider the 'f'
(fill) modifier. It would cause the substitued value to be filled to a
specified width. The width could be passed as a parameter in this way:
{{60f|Description}}
Several modifiers could be used together:
{{i60f|Description}}
This is just an initial brain-storming. The syntax is probably not the
best one. Any idea? :)
--
Jose E. Marchesi address@hidden
GNU Project http://www.gnu.org
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-recutils] Slots in templates,
Jose E. Marchesi <=