public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Interpolate a partial which is specified in a variable
@ 2020-12-02 21:01 Gabriel Nützi
       [not found] ` <CAA9rTueQ_f2U964Jhg=Ts=tdhzaMgu2e6-zA6KezRX2QbGcpqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Nützi @ 2020-12-02 21:01 UTC (permalink / raw)
  To: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Hi all,

I was wondering if it is possible to include a partial file in a template
where the file to be included is set in a variable: something like

${ $filePath$() }

The variable `filePath` would contain the path to the partial...

This syntax (interpolation inside ${...} is not supported right, I did not
found anything.
This would for example make it very easy to select another template, e.g.
for different title pages, just by setting the filepath in the Mardown yaml
frontmatter.

Is there a workaround?

BR

-- 
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/CAA9rTueQ_f2U964Jhg%3DTs%3DtdhzaMgu2e6-zA6KezRX2QbGcpqg%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 1363 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Interpolate a partial which is specified in a variable
       [not found] ` <CAA9rTueQ_f2U964Jhg=Ts=tdhzaMgu2e6-zA6KezRX2QbGcpqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-12-02 23:33   ` John MacFarlane
       [not found]     ` <m2y2ifok9u.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2020-12-02 23:33 UTC (permalink / raw)
  To: Gabriel Nützi, pandoc-discuss

Gabriel Nützi <gnuetzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hi all,
>
> I was wondering if it is possible to include a partial file in a template
> where the file to be included is set in a variable: something like
>
> ${ $filePath$() }
>
> The variable `filePath` would contain the path to the partial...

No.

> This syntax (interpolation inside ${...} is not supported right, I did not
> found anything.
> This would for example make it very easy to select another template, e.g.
> for different title pages, just by setting the filepath in the Mardown yaml
> frontmatter.
>
> Is there a workaround?

You can always have a boolean variable and do something like
this in your template

$if(specialtitle)$
special title stuff here
$else$
regular title here
$endif$

-- 
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/m2y2ifok9u.fsf%40MacBook-Pro.hsd1.ca.comcast.net.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Interpolate a partial which is specified in a variable
       [not found]     ` <m2y2ifok9u.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-12-03 13:22       ` Gabriel Nützi
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Nützi @ 2020-12-03 13:22 UTC (permalink / raw)
  To: John MacFarlane, pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]

Thanks for the response, thats how I solved it so far.
Would be a useful feature to have variables interpolated in the partial 
name (?).

  * ${ ${partialFileName}() }
  * ${ ${variable}:${partialFileName}() }


Am 03.12.2020 um 00:33 schrieb John MacFarlane:

> Gabriel Nützi <gnuetzi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
>> Hi all,
>>
>> I was wondering if it is possible to include a partial file in a template
>> where the file to be included is set in a variable: something like
>>
>> ${ $filePath$() }
>>
>> The variable `filePath` would contain the path to the partial...
> No.
>
>> This syntax (interpolation inside ${...} is not supported right, I did not
>> found anything.
>> This would for example make it very easy to select another template, e.g.
>> for different title pages, just by setting the filepath in the Mardown yaml
>> frontmatter.
>>
>> Is there a workaround?
> You can always have a boolean variable and do something like
> this in your template
>
> $if(specialtitle)$
> special title stuff here
> $else$
> regular title here
> $endif$

-- 
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/f44d5003-c29d-d8a6-3b76-5d78e05b4dd9%40gmail.com.

[-- Attachment #2: Type: text/html, Size: 2557 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-12-03 13:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 21:01 Interpolate a partial which is specified in a variable Gabriel Nützi
     [not found] ` <CAA9rTueQ_f2U964Jhg=Ts=tdhzaMgu2e6-zA6KezRX2QbGcpqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-12-02 23:33   ` John MacFarlane
     [not found]     ` <m2y2ifok9u.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-12-03 13:22       ` Gabriel Nützi

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).