* Determining that a Pandoc Variable is the Empty String
@ 2023-03-08 4:41 S. Manning
[not found] ` <baea52e4f4b9a22d832faa30ab3fd116-aFO/2INALiozYggVrLCuDg@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: S. Manning @ 2023-03-08 4:41 UTC (permalink / raw)
To: Pandoc discuss
I would like to add a tag system to my static site which I generate with
Pandoc templates. Adding a tags: variable in myPage.yaml is easy, but
then I want to add links from pages with the tag to the page for that
tag. Code like:
$for(tags)$
<a href="https://mysite.org/tags/$tags$.html">⇐ back to $tags$</a>
$endfor$
adds a link even if the tags variable is empty ("tags: " in the YAML
file).
How can I check that the tag is not empty or a null string or however
Pandoc defines it?
https://pandoc.org/MANUAL.html#interpolated-variables alludes to
variable types such as string and list, but does not define them or
explain how to get the attributes of complex variables such as lists.
--
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/baea52e4f4b9a22d832faa30ab3fd116%40ageofdatini.info.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Determining that a Pandoc Variable is the Empty String
[not found] ` <baea52e4f4b9a22d832faa30ab3fd116-aFO/2INALiozYggVrLCuDg@public.gmane.org>
@ 2023-03-08 4:44 ` John MacFarlane
[not found] ` <DA455835-3B72-4022-A761-E7A96E904EEA-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2023-03-08 4:44 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Try
tags: []
in your YAML if you don't want the for loop to be executed.
> On Mar 7, 2023, at 8:41 PM, S. Manning <scriptor-aFO/2INALiozYggVrLCuDg@public.gmane.org> wrote:
>
> I would like to add a tag system to my static site which I generate with Pandoc templates. Adding a tags: variable in myPage.yaml is easy, but then I want to add links from pages with the tag to the page for that tag. Code like:
>
> $for(tags)$
> <a href="https://mysite.org/tags/$tags$.html">⇐ back to $tags$</a>
> $endfor$
>
> adds a link even if the tags variable is empty ("tags: " in the YAML file).
>
> How can I check that the tag is not empty or a null string or however Pandoc defines it?
>
> https://pandoc.org/MANUAL.html#interpolated-variables alludes to variable types such as string and list, but does not define them or explain how to get the attributes of complex variables such as lists.
>
> --
> 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/baea52e4f4b9a22d832faa30ab3fd116%40ageofdatini.info.
--
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/DA455835-3B72-4022-A761-E7A96E904EEA%40gmail.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Determining that a Pandoc Variable is the Empty String
[not found] ` <DA455835-3B72-4022-A761-E7A96E904EEA-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2023-03-08 4:50 ` S. Manning
0 siblings, 0 replies; 3+ messages in thread
From: S. Manning @ 2023-03-08 4:50 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
That works for me! I will add it to my 'lab notes'
On 2023-03-07 21:44, John MacFarlane wrote:
> Try
>
> tags: []
>
> in your YAML if you don't want the for loop to be executed.
>
>> On Mar 7, 2023, at 8:41 PM, S. Manning <scriptor-aFO/2INALiozYggVrLCuDg@public.gmane.org>
>> wrote:
>>
>> I would like to add a tag system to my static site which I generate
>> with Pandoc templates. Adding a tags: variable in myPage.yaml is
>> easy, but then I want to add links from pages with the tag to the page
>> for that tag. Code like:
>>
>> $for(tags)$
>> <a href="https://mysite.org/tags/$tags$.html">⇐ back to
>> $tags$</a>
>> $endfor$
>>
>> adds a link even if the tags variable is empty ("tags: " in the YAML
>> file).
>>
>> How can I check that the tag is not empty or a null string or however
>> Pandoc defines it?
>>
>> https://pandoc.org/MANUAL.html#interpolated-variables alludes to
>> variable types such as string and list, but does not define them or
>> explain how to get the attributes of complex variables such as lists.
>>
>> --
>> 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/baea52e4f4b9a22d832faa30ab3fd116%40ageofdatini.info.
--
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/27db87ff42ad3fe1822144a366498919%40ageofdatini.info.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-08 4:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 4:41 Determining that a Pandoc Variable is the Empty String S. Manning
[not found] ` <baea52e4f4b9a22d832faa30ab3fd116-aFO/2INALiozYggVrLCuDg@public.gmane.org>
2023-03-08 4:44 ` John MacFarlane
[not found] ` <DA455835-3B72-4022-A761-E7A96E904EEA-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-03-08 4:50 ` S. Manning
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).