* nested iteration over variables
@ 2021-10-07 15:20 'Jan Ulrich Hasecke' via pandoc-discuss
[not found] ` <8fa0e255-4ed7-4db7-eb28-a9aaa8b55613-cl+VPiYnx/1AfugRpC6u6w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: 'Jan Ulrich Hasecke' via pandoc-discuss @ 2021-10-07 15:20 UTC (permalink / raw)
To: pandoc-discuss
Hi,
consider this as a markdown frontmatter:
---
positions:
- foo:
name: Foo
feature1: 2
feature2: 4
- foo:
name: Bar
feature1: 4
feature2: 8
- baz:
name: Blibb
feature1: 25
---
Is it possible to do something like this:
$for(positions)$
$for(foo)$
$foo.name$
$foo.feature1$
$foo.feature2$
$endfor$
$for(baz)$
$baz.name$
$baz.feature1$
$endfor$
$endfor$
I tried it and it does not work.
Background: I want to create a complex tender (bid) document, where I
have to create tables for each position.foo and each position.baz, where
each foo and baz has several features.
Any hints?
TIA
juh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nested iteration over variables
[not found] ` <8fa0e255-4ed7-4db7-eb28-a9aaa8b55613-cl+VPiYnx/1AfugRpC6u6w@public.gmane.org>
@ 2021-10-07 16:13 ` John MacFarlane
[not found] ` <m2o880hkyu.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2021-10-07 16:13 UTC (permalink / raw)
To: 'Jan Ulrich Hasecke' via pandoc-discuss, pandoc-discuss
Set up the metadata like this:
```
---
positions:
foo:
- name: Foo
feature: 2
- name: Bar
feature: 3
bar:
- name: Bar
feature: 55
...
```
You can use the anaphoric variable name "it".
```
$for(positions)$
Foos:
$for(it.foo)$
$it.name$, $it.feature$
$endfor$
Bars:
$for(it.bar)$
$it.name$, $it.feature$
$endfor$
$endfor$
```
"'Jan Ulrich Hasecke' via pandoc-discuss"
<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> writes:
> Hi,
>
> consider this as a markdown frontmatter:
>
> ---
> positions:
> - foo:
> name: Foo
> feature1: 2
> feature2: 4
> - foo:
> name: Bar
> feature1: 4
> feature2: 8
> - baz:
> name: Blibb
> feature1: 25
> ---
>
> Is it possible to do something like this:
>
> $for(positions)$
>
> $for(foo)$
> $foo.name$
> $foo.feature1$
> $foo.feature2$
> $endfor$
>
> $for(baz)$
> $baz.name$
> $baz.feature1$
> $endfor$
>
> $endfor$
>
> I tried it and it does not work.
>
> Background: I want to create a complex tender (bid) document, where I
> have to create tables for each position.foo and each position.baz, where
> each foo and baz has several features.
>
> Any hints?
> TIA
> juh
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8fa0e255-4ed7-4db7-eb28-a9aaa8b55613%40mailbox.org.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nested iteration over variables
[not found] ` <m2o880hkyu.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
@ 2021-10-11 12:54 ` 'juh' via pandoc-discuss
2021-10-11 15:39 ` John MacFarlane
0 siblings, 1 reply; 4+ messages in thread
From: 'juh' via pandoc-discuss @ 2021-10-11 12:54 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1: Type: text/plain, Size: 669 bytes --]
Dear John,
thanks a lot.
Am Thu, Oct 07, 2021 at 09:13:13AM -0700 schrieb John MacFarlane:
>
> Set up the metadata like this:
>
> ```
> ---
> positions:
> foo:
> - name: Foo
> feature: 2
> - name: Bar
> feature: 3
> bar:
> - name: Bar
> feature: 55
> ...
> ```
>
> You can use the anaphoric variable name "it".
>
> ```
> $for(positions)$
> Foos:
> $for(it.foo)$
> $it.name$, $it.feature$
> $endfor$
> Bars:
> $for(it.bar)$
> $it.name$, $it.feature$
> $endfor$
> $endfor$
> ```
Additional question. Is it possible to use some logic in if-statements?
$if(foo=2)$
Foo is Two.
$elseif(foo=1)$
Foo is One.
$else$
No Foo left.
$endif$
TIA
juh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: nested iteration over variables
2021-10-11 12:54 ` 'juh' via pandoc-discuss
@ 2021-10-11 15:39 ` John MacFarlane
0 siblings, 0 replies; 4+ messages in thread
From: John MacFarlane @ 2021-10-11 15:39 UTC (permalink / raw)
To: 'juh' via pandoc-discuss, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
No logic, sorry.
"'juh' via pandoc-discuss" <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
writes:
> Dear John,
>
> thanks a lot.
>
> Am Thu, Oct 07, 2021 at 09:13:13AM -0700 schrieb John MacFarlane:
>>
>> Set up the metadata like this:
>>
>> ```
>> ---
>> positions:
>> foo:
>> - name: Foo
>> feature: 2
>> - name: Bar
>> feature: 3
>> bar:
>> - name: Bar
>> feature: 55
>> ...
>> ```
>>
>> You can use the anaphoric variable name "it".
>>
>> ```
>> $for(positions)$
>> Foos:
>> $for(it.foo)$
>> $it.name$, $it.feature$
>> $endfor$
>> Bars:
>> $for(it.bar)$
>> $it.name$, $it.feature$
>> $endfor$
>> $endfor$
>> ```
>
> Additional question. Is it possible to use some logic in if-statements?
>
> $if(foo=2)$
> Foo is Two.
> $elseif(foo=1)$
> Foo is One.
> $else$
> No Foo left.
> $endif$
>
>
> TIA
> juh
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YWQz%2BzPweCOgd31D%40sokrates.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-11 15:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-07 15:20 nested iteration over variables 'Jan Ulrich Hasecke' via pandoc-discuss
[not found] ` <8fa0e255-4ed7-4db7-eb28-a9aaa8b55613-cl+VPiYnx/1AfugRpC6u6w@public.gmane.org>
2021-10-07 16:13 ` John MacFarlane
[not found] ` <m2o880hkyu.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
2021-10-11 12:54 ` 'juh' via pandoc-discuss
2021-10-11 15:39 ` John MacFarlane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).