public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Determining that a Pandoc Variable is the Empty String
Date: Tue, 7 Mar 2023 20:44:20 -0800	[thread overview]
Message-ID: <DA455835-3B72-4022-A761-E7A96E904EEA@gmail.com> (raw)
In-Reply-To: <baea52e4f4b9a22d832faa30ab3fd116-aFO/2INALiozYggVrLCuDg@public.gmane.org>

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>&nbsp;
> $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.


  parent reply	other threads:[~2023-03-08  4:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08  4:41 S. Manning
     [not found] ` <baea52e4f4b9a22d832faa30ab3fd116-aFO/2INALiozYggVrLCuDg@public.gmane.org>
2023-03-08  4:44   ` John MacFarlane [this message]
     [not found]     ` <DA455835-3B72-4022-A761-E7A96E904EEA-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-03-08  4:50       ` S. Manning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DA455835-3B72-4022-A761-E7A96E904EEA@gmail.com \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).