public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* include an abitrary variable values at rendering time.
@ 2019-01-09 18:33 Vang Le Quy
       [not found] ` <b4ac7cef-2d1d-4b19-b11a-60a64635ccc6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Vang Le Quy @ 2019-01-09 18:33 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1650 bytes --]


pandoc -v
pandoc 2.3.1
Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.1, skylighting 0.7.3
Default user data directory: /Users/vle/.pandoc
Copyright (C) 2006-2018 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

pandoc -h says that there is `-V` and `--varaible KEY[:VALUE]` flag. I want 
to include some value at rendering time (document version). So I did this:

pandoc  --variable gitcommit:xxxxxyyy -o markdowndoc.pdf markdowdoc.md

---
title: Test Variables
output: pdf_document
header-includes:
    - \usepackage{hyperref}
    - \usepackage{datetime}
    - \usepackage{fancyhdr}
    - \pagestyle{fancy}
    - \fancyhead[LE,LO]{}
    - \fancyfoot[CO,CE]{Template Version \pdfdate| Git Commit:$gitcommit$}
    - \fancyfoot[LE,RO]{\thepage}
---

Variable value, gitcommit: $gitcommit$


This however did not result in expected value in the finale PDF document. 
So is it possible at all to do this kind of thing at the moment?

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b4ac7cef-2d1d-4b19-b11a-60a64635ccc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 13830 bytes --]

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

* Re: include an abitrary variable values at rendering time.
       [not found] ` <b4ac7cef-2d1d-4b19-b11a-60a64635ccc6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-01-09 20:03   ` John MacFarlane
  2019-01-10 11:02   ` Vang Le Quy
  1 sibling, 0 replies; 4+ messages in thread
From: John MacFarlane @ 2019-01-09 20:03 UTC (permalink / raw)
  To: Vang Le Quy, pandoc-discuss


Variable are only resolved in the templates
themselves, not in material (like header-includes)
that will itself be put in templates.

For your purposes you'll have to use a custom
template.

Vang Le Quy <lqvang79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> pandoc -v
> pandoc 2.3.1
> Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.1, skylighting 0.7.3
> Default user data directory: /Users/vle/.pandoc
> Copyright (C) 2006-2018 John MacFarlane
> Web:  http://pandoc.org
> This is free software; see the source for copying conditions.
> There is no warranty, not even for merchantability or fitness
> for a particular purpose.
>
> pandoc -h says that there is `-V` and `--varaible KEY[:VALUE]` flag. I want 
> to include some value at rendering time (document version). So I did this:
>
> pandoc  --variable gitcommit:xxxxxyyy -o markdowndoc.pdf markdowdoc.md
>
> ---
> title: Test Variables
> output: pdf_document
> header-includes:
>     - \usepackage{hyperref}
>     - \usepackage{datetime}
>     - \usepackage{fancyhdr}
>     - \pagestyle{fancy}
>     - \fancyhead[LE,LO]{}
>     - \fancyfoot[CO,CE]{Template Version \pdfdate| Git Commit:$gitcommit$}
>     - \fancyfoot[LE,RO]{\thepage}
> ---
>
> Variable value, gitcommit: $gitcommit$
>
>
> This however did not result in expected value in the finale PDF document. 
> So is it possible at all to do this kind of thing at the moment?
>
> -- 
> 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b4ac7cef-2d1d-4b19-b11a-60a64635ccc6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


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

* Re: include an abitrary variable values at rendering time.
       [not found] ` <b4ac7cef-2d1d-4b19-b11a-60a64635ccc6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-01-09 20:03   ` John MacFarlane
@ 2019-01-10 11:02   ` Vang Le Quy
       [not found]     ` <e78bf33c-698a-4094-a4f2-7eedbfe5709e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Vang Le Quy @ 2019-01-10 11:02 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1936 bytes --]

Thanks for your comment, John. For now I chose to use a bash script which 
runs a `sed` command before rendering with pandoc, and it works fine.

On Wednesday, January 9, 2019 at 7:33:09 PM UTC+1, Vang Le Quy wrote:
>
>
> pandoc -v
> pandoc 2.3.1
> Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.1, skylighting 0.7.3
> Default user data directory: /Users/vle/.pandoc
> Copyright (C) 2006-2018 John MacFarlane
> Web:  http://pandoc.org
> This is free software; see the source for copying conditions.
> There is no warranty, not even for merchantability or fitness
> for a particular purpose.
>
> pandoc -h says that there is `-V` and `--varaible KEY[:VALUE]` flag. I 
> want to include some value at rendering time (document version). So I did 
> this:
>
> pandoc  --variable gitcommit:xxxxxyyy -o markdowndoc.pdf markdowdoc.md
>
> ---
> title: Test Variables
> output: pdf_document
> header-includes:
>     - \usepackage{hyperref}
>     - \usepackage{datetime}
>     - \usepackage{fancyhdr}
>     - \pagestyle{fancy}
>     - \fancyhead[LE,LO]{}
>     - \fancyfoot[CO,CE]{Template Version \pdfdate| Git Commit:$gitcommit$}
>     - \fancyfoot[LE,RO]{\thepage}
> ---
>
> Variable value, gitcommit: $gitcommit$
>
>
> This however did not result in expected value in the finale PDF document. 
> So is it possible at all to do this kind of thing at the moment?
>
>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e78bf33c-698a-4094-a4f2-7eedbfe5709e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 9137 bytes --]

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

* Re: include an abitrary variable values at rendering time.
       [not found]     ` <e78bf33c-698a-4094-a4f2-7eedbfe5709e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-01-10 17:51       ` mb21
  0 siblings, 0 replies; 4+ messages in thread
From: mb21 @ 2019-01-10 17:51 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2154 bytes --]

see 
also https://pandoc.org/lua-filters.html#replacing-placeholders-with-their-metadata-value

On Thursday, January 10, 2019 at 12:02:42 PM UTC+1, Vang Le Quy wrote:
>
> Thanks for your comment, John. For now I chose to use a bash script which 
> runs a `sed` command before rendering with pandoc, and it works fine.
>
> On Wednesday, January 9, 2019 at 7:33:09 PM UTC+1, Vang Le Quy wrote:
>>
>>
>> pandoc -v
>> pandoc 2.3.1
>> Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.1, skylighting 0.7.3
>> Default user data directory: /Users/vle/.pandoc
>> Copyright (C) 2006-2018 John MacFarlane
>> Web:  http://pandoc.org
>> This is free software; see the source for copying conditions.
>> There is no warranty, not even for merchantability or fitness
>> for a particular purpose.
>>
>> pandoc -h says that there is `-V` and `--varaible KEY[:VALUE]` flag. I 
>> want to include some value at rendering time (document version). So I did 
>> this:
>>
>> pandoc  --variable gitcommit:xxxxxyyy -o markdowndoc.pdf markdowdoc.md
>>
>> ---
>> title: Test Variables
>> output: pdf_document
>> header-includes:
>>     - \usepackage{hyperref}
>>     - \usepackage{datetime}
>>     - \usepackage{fancyhdr}
>>     - \pagestyle{fancy}
>>     - \fancyhead[LE,LO]{}
>>     - \fancyfoot[CO,CE]{Template Version \pdfdate| Git Commit:$gitcommit$
>> }
>>     - \fancyfoot[LE,RO]{\thepage}
>> ---
>>
>> Variable value, gitcommit: $gitcommit$
>>
>>
>> This however did not result in expected value in the finale PDF document. 
>> So is it possible at all to do this kind of thing at the moment?
>>
>>

-- 
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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/587465b1-8773-4654-8be9-16afe5e42217%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 9454 bytes --]

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

end of thread, other threads:[~2019-01-10 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 18:33 include an abitrary variable values at rendering time Vang Le Quy
     [not found] ` <b4ac7cef-2d1d-4b19-b11a-60a64635ccc6-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-09 20:03   ` John MacFarlane
2019-01-10 11:02   ` Vang Le Quy
     [not found]     ` <e78bf33c-698a-4094-a4f2-7eedbfe5709e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-01-10 17:51       ` mb21

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