public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Custom lua writers and standalone documents
@ 2020-10-04 14:32 William Lupton
       [not found] ` <66e3e0f4-a77c-4ff6-b71e-68182d95ac2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: William Lupton @ 2020-10-04 14:32 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello,

% pandoc --version
pandoc 2.9.2.1

I want to generate modified HTML for headers (to be specific, I want to add 
a link to each header, like Sphinx does), so I decided to create a custom 
lua writer.

I started with the supplied sample.lua and modified the Header() function, 
but I find (when I run with --standalone --table-of-contents) that I don't 
get a ToC. And when I look at the variables in the Doc() function I don't 
see 'toc' or 'table-of-contents'.

Should I be able do this, or do I have to use my custom writer to generate 
a fragment and then run pandoc again to process the fragment and generate 
the ToC (I've tried this and it works)?

Note: I tried to parse this comment in sample.lua Doc(), but am not clear 
whether it's saying that I can use --template in the _same_ pandoc 
invocation or whether I need to use a separate invocation:
* You could use the metadata table to fill variables in a custom lua 
template.  Or, pass `--template=...` to pandoc, and pandoc will do the 
template processing as usual.

I can supply more detailed info on request.

Thanks,
William Lupton

-- 
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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com.

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

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

* Re: Custom lua writers and standalone documents
       [not found] ` <66e3e0f4-a77c-4ff6-b71e-68182d95ac2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-10-04 15:12   ` John MacFarlane
       [not found]     ` <m2362ut47x.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2020-10-04 15:12 UTC (permalink / raw)
  To: William Lupton, pandoc-discuss


The table of contents is generated by the HTML writer.
So, if you create a custom writer, you'll have to reproduce
this functionality in your writer.

William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> Hello,
>
> % pandoc --version
> pandoc 2.9.2.1
>
> I want to generate modified HTML for headers (to be specific, I want to add 
> a link to each header, like Sphinx does), so I decided to create a custom 
> lua writer.
>
> I started with the supplied sample.lua and modified the Header() function, 
> but I find (when I run with --standalone --table-of-contents) that I don't 
> get a ToC. And when I look at the variables in the Doc() function I don't 
> see 'toc' or 'table-of-contents'.
>
> Should I be able do this, or do I have to use my custom writer to generate 
> a fragment and then run pandoc again to process the fragment and generate 
> the ToC (I've tried this and it works)?
>
> Note: I tried to parse this comment in sample.lua Doc(), but am not clear 
> whether it's saying that I can use --template in the _same_ pandoc 
> invocation or whether I need to use a separate invocation:
> * You could use the metadata table to fill variables in a custom lua 
> template.  Or, pass `--template=...` to pandoc, and pandoc will do the 
> template processing as usual.
>
> I can supply more detailed info on request.
>
> Thanks,
> William Lupton
>
> -- 
> 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com.


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

* Re: Custom lua writers and standalone documents
       [not found]     ` <m2362ut47x.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-10-04 15:54       ` William Lupton
       [not found]         ` <CAEe_xxjxAsHgd3nQtL+-Nrsfgk9tbOmhYz_8JJ2dMkCMAJ1aRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: William Lupton @ 2020-10-04 15:54 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

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

Great. Thanks. I can do this.

But can I then use a template? I didn't mention this earlier, but I tried
setting some variables in the Doc() function (e.g. 'toc') and they didn't
seem to be seen by the template.

On Sun, 4 Oct 2020, 16:12 John MacFarlane, <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

>
> The table of contents is generated by the HTML writer.
> So, if you create a custom writer, you'll have to reproduce
> this functionality in your writer.
>
> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:
>
> > Hello,
> >
> > % pandoc --version
> > pandoc 2.9.2.1
> >
> > I want to generate modified HTML for headers (to be specific, I want to
> add
> > a link to each header, like Sphinx does), so I decided to create a
> custom
> > lua writer.
> >
> > I started with the supplied sample.lua and modified the Header()
> function,
> > but I find (when I run with --standalone --table-of-contents) that I
> don't
> > get a ToC. And when I look at the variables in the Doc() function I
> don't
> > see 'toc' or 'table-of-contents'.
> >
> > Should I be able do this, or do I have to use my custom writer to
> generate
> > a fragment and then run pandoc again to process the fragment and
> generate
> > the ToC (I've tried this and it works)?
> >
> > Note: I tried to parse this comment in sample.lua Doc(), but am not
> clear
> > whether it's saying that I can use --template in the _same_ pandoc
> > invocation or whether I need to use a separate invocation:
> > * You could use the metadata table to fill variables in a custom lua
> > template.  Or, pass `--template=...` to pandoc, and pandoc will do the
> > template processing as usual.
> >
> > I can supply more detailed info on request.
> >
> > Thanks,
> > William Lupton
> >
> > --
> > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com
> .
>

-- 
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/CAEe_xxjxAsHgd3nQtL%2B-Nrsfgk9tbOmhYz_8JJ2dMkCMAJ1aRA%40mail.gmail.com.

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

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

* Re: Custom lua writers and standalone documents
       [not found]         ` <CAEe_xxjxAsHgd3nQtL+-Nrsfgk9tbOmhYz_8JJ2dMkCMAJ1aRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-10-04 15:56           ` William Lupton
       [not found]             ` <CAEe_xxijXFxtfTzRJNp_wmT93ERdFDm_9oauEkrPmjWjT9zfPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: William Lupton @ 2020-10-04 15:56 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

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

Also, I specified --table-of-contents on the command line, but didn't see
it set in the writer's Doc() function. Should I have expected to see it?

On Sun, 4 Oct 2020, 16:54 William Lupton, <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
wrote:

> Great. Thanks. I can do this.
>
> But can I then use a template? I didn't mention this earlier, but I tried
> setting some variables in the Doc() function (e.g. 'toc') and they didn't
> seem to be seen by the template.
>
> On Sun, 4 Oct 2020, 16:12 John MacFarlane, <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
>
>>
>> The table of contents is generated by the HTML writer.
>> So, if you create a custom writer, you'll have to reproduce
>> this functionality in your writer.
>>
>> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:
>>
>> > Hello,
>> >
>> > % pandoc --version
>> > pandoc 2.9.2.1
>> >
>> > I want to generate modified HTML for headers (to be specific, I want to
>> add
>> > a link to each header, like Sphinx does), so I decided to create a
>> custom
>> > lua writer.
>> >
>> > I started with the supplied sample.lua and modified the Header()
>> function,
>> > but I find (when I run with --standalone --table-of-contents) that I
>> don't
>> > get a ToC. And when I look at the variables in the Doc() function I
>> don't
>> > see 'toc' or 'table-of-contents'.
>> >
>> > Should I be able do this, or do I have to use my custom writer to
>> generate
>> > a fragment and then run pandoc again to process the fragment and
>> generate
>> > the ToC (I've tried this and it works)?
>> >
>> > Note: I tried to parse this comment in sample.lua Doc(), but am not
>> clear
>> > whether it's saying that I can use --template in the _same_ pandoc
>> > invocation or whether I need to use a separate invocation:
>> > * You could use the metadata table to fill variables in a custom lua
>> > template.  Or, pass `--template=...` to pandoc, and pandoc will do the
>> > template processing as usual.
>> >
>> > I can supply more detailed info on request.
>> >
>> > Thanks,
>> > William Lupton
>> >
>> > --
>> > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com
>> .
>>
>

-- 
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/CAEe_xxijXFxtfTzRJNp_wmT93ERdFDm_9oauEkrPmjWjT9zfPw%40mail.gmail.com.

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

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

* Re: Custom lua writers and standalone documents
       [not found]             ` <CAEe_xxijXFxtfTzRJNp_wmT93ERdFDm_9oauEkrPmjWjT9zfPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-10-04 16:25               ` William Lupton
  2020-10-04 18:41               ` John MacFarlane
  1 sibling, 0 replies; 8+ messages in thread
From: William Lupton @ 2020-10-04 16:25 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

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

[sorry for so many short posts]

(continued) ...so can I (in the custom writer) tell that
--table-of-contents was specified?

(For another application, I resorted to passing --toc-depth as metadata in
order to pick it up in a custom writer, so I guess I could do the same here
for --table-of-contents, but perhaps there's a way to avoid the need?)

On Sun, 4 Oct 2020 at 16:56, William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
wrote:

> Also, I specified --table-of-contents on the command line, but didn't see
> it set in the writer's Doc() function. Should I have expected to see it?
>
> On Sun, 4 Oct 2020, 16:54 William Lupton, <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
> wrote:
>
>> Great. Thanks. I can do this.
>>
>> But can I then use a template? I didn't mention this earlier, but I tried
>> setting some variables in the Doc() function (e.g. 'toc') and they didn't
>> seem to be seen by the template.
>>
>> On Sun, 4 Oct 2020, 16:12 John MacFarlane, <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
>>
>>>
>>> The table of contents is generated by the HTML writer.
>>> So, if you create a custom writer, you'll have to reproduce
>>> this functionality in your writer.
>>>
>>> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:
>>>
>>> > Hello,
>>> >
>>> > % pandoc --version
>>> > pandoc 2.9.2.1
>>> >
>>> > I want to generate modified HTML for headers (to be specific, I want
>>> to add
>>> > a link to each header, like Sphinx does), so I decided to create a
>>> custom
>>> > lua writer.
>>> >
>>> > I started with the supplied sample.lua and modified the Header()
>>> function,
>>> > but I find (when I run with --standalone --table-of-contents) that I
>>> don't
>>> > get a ToC. And when I look at the variables in the Doc() function I
>>> don't
>>> > see 'toc' or 'table-of-contents'.
>>> >
>>> > Should I be able do this, or do I have to use my custom writer to
>>> generate
>>> > a fragment and then run pandoc again to process the fragment and
>>> generate
>>> > the ToC (I've tried this and it works)?
>>> >
>>> > Note: I tried to parse this comment in sample.lua Doc(), but am not
>>> clear
>>> > whether it's saying that I can use --template in the _same_ pandoc
>>> > invocation or whether I need to use a separate invocation:
>>> > * You could use the metadata table to fill variables in a custom lua
>>> > template.  Or, pass `--template=...` to pandoc, and pandoc will do the
>>> > template processing as usual.
>>> >
>>> > I can supply more detailed info on request.
>>> >
>>> > Thanks,
>>> > William Lupton
>>> >
>>> > --
>>> > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com
>>> .
>>>
>>

-- 
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/CAEe_xxiqrjVZo70FaLC%3DfOfb-12DTpcjeuSCofoNCaPwo6tz_g%40mail.gmail.com.

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

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

* Re: Custom lua writers and standalone documents
       [not found]             ` <CAEe_xxijXFxtfTzRJNp_wmT93ERdFDm_9oauEkrPmjWjT9zfPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2020-10-04 16:25               ` William Lupton
@ 2020-10-04 18:41               ` John MacFarlane
       [not found]                 ` <m2imbpsuk7.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2020-10-04 18:41 UTC (permalink / raw)
  To: William Lupton; +Cc: pandoc-discuss


You can specify a template.  However, I don't think there's
a way to _set_ template variables from within a custom writer,
though your writer can see the variables that were set on
the command line via the 'variables' parameter.

If you want to propose modifying the custom writing code
so writers can set variables, that would be a reasonable
request to make at the pandoc bug tracker.

The only thing from the command line the custom writer
will see is the variables, so the writer can't tell
if --table-of-contents was specified.  Making writer
options available to the custom writers would be another
reasonable enhanchement.

William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> Also, I specified --table-of-contents on the command line, but didn't see
> it set in the writer's Doc() function. Should I have expected to see it?
>
> On Sun, 4 Oct 2020, 16:54 William Lupton, <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
> wrote:
>
>> Great. Thanks. I can do this.
>>
>> But can I then use a template? I didn't mention this earlier, but I tried
>> setting some variables in the Doc() function (e.g. 'toc') and they didn't
>> seem to be seen by the template.
>>
>> On Sun, 4 Oct 2020, 16:12 John MacFarlane, <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
>>
>>>
>>> The table of contents is generated by the HTML writer.
>>> So, if you create a custom writer, you'll have to reproduce
>>> this functionality in your writer.
>>>
>>> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:
>>>
>>> > Hello,
>>> >
>>> > % pandoc --version
>>> > pandoc 2.9.2.1
>>> >
>>> > I want to generate modified HTML for headers (to be specific, I want to
>>> add
>>> > a link to each header, like Sphinx does), so I decided to create a
>>> custom
>>> > lua writer.
>>> >
>>> > I started with the supplied sample.lua and modified the Header()
>>> function,
>>> > but I find (when I run with --standalone --table-of-contents) that I
>>> don't
>>> > get a ToC. And when I look at the variables in the Doc() function I
>>> don't
>>> > see 'toc' or 'table-of-contents'.
>>> >
>>> > Should I be able do this, or do I have to use my custom writer to
>>> generate
>>> > a fragment and then run pandoc again to process the fragment and
>>> generate
>>> > the ToC (I've tried this and it works)?
>>> >
>>> > Note: I tried to parse this comment in sample.lua Doc(), but am not
>>> clear
>>> > whether it's saying that I can use --template in the _same_ pandoc
>>> > invocation or whether I need to use a separate invocation:
>>> > * You could use the metadata table to fill variables in a custom lua
>>> > template.  Or, pass `--template=...` to pandoc, and pandoc will do the
>>> > template processing as usual.
>>> >
>>> > I can supply more detailed info on request.
>>> >
>>> > Thanks,
>>> > William Lupton
>>> >
>>> > --
>>> > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com
>>> .
>>>
>>


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

* Re: Custom lua writers and standalone documents
       [not found]                 ` <m2imbpsuk7.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-10-05  8:42                   ` William Lupton
       [not found]                     ` <CAEe_xxinvW1OkUm8QGTuFU_yoitz97XqYmdQO4pyUhKSL=dWCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: William Lupton @ 2020-10-05  8:42 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

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

Thanks very much. I will create GitHub issues as you suggest (and will also
cover the comment in the next paragraph).

One comment re the lua writer Doc() function's 'variables' argument: This
seems by default to contain the curdir, outputfile and sourcefile
variables, which are three of the
https://pandoc.org/MANUAL.html#variables-set-automatically. I understand
that not all of these variables could be set at this point (e.g., body
couldn't, and meta-json probably shouldn't), but arguably most of the rest
of these variables could be set, including toc?

On Sun, 4 Oct 2020 at 19:41, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

>
> You can specify a template.  However, I don't think there's
> a way to _set_ template variables from within a custom writer,
> though your writer can see the variables that were set on
> the command line via the 'variables' parameter.
>
> If you want to propose modifying the custom writing code
> so writers can set variables, that would be a reasonable
> request to make at the pandoc bug tracker.
>
> The only thing from the command line the custom writer
> will see is the variables, so the writer can't tell
> if --table-of-contents was specified.  Making writer
> options available to the custom writers would be another
> reasonable enhanchement.
>
> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:
>
> > Also, I specified --table-of-contents on the command line, but didn't see
> > it set in the writer's Doc() function. Should I have expected to see it?
> >
> > On Sun, 4 Oct 2020, 16:54 William Lupton, <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org>
> > wrote:
> >
> >> Great. Thanks. I can do this.
> >>
> >> But can I then use a template? I didn't mention this earlier, but I
> tried
> >> setting some variables in the Doc() function (e.g. 'toc') and they
> didn't
> >> seem to be seen by the template.
> >>
> >> On Sun, 4 Oct 2020, 16:12 John MacFarlane, <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
> >>
> >>>
> >>> The table of contents is generated by the HTML writer.
> >>> So, if you create a custom writer, you'll have to reproduce
> >>> this functionality in your writer.
> >>>
> >>> William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:
> >>>
> >>> > Hello,
> >>> >
> >>> > % pandoc --version
> >>> > pandoc 2.9.2.1
> >>> >
> >>> > I want to generate modified HTML for headers (to be specific, I want
> to
> >>> add
> >>> > a link to each header, like Sphinx does), so I decided to create a
> >>> custom
> >>> > lua writer.
> >>> >
> >>> > I started with the supplied sample.lua and modified the Header()
> >>> function,
> >>> > but I find (when I run with --standalone --table-of-contents) that I
> >>> don't
> >>> > get a ToC. And when I look at the variables in the Doc() function I
> >>> don't
> >>> > see 'toc' or 'table-of-contents'.
> >>> >
> >>> > Should I be able do this, or do I have to use my custom writer to
> >>> generate
> >>> > a fragment and then run pandoc again to process the fragment and
> >>> generate
> >>> > the ToC (I've tried this and it works)?
> >>> >
> >>> > Note: I tried to parse this comment in sample.lua Doc(), but am not
> >>> clear
> >>> > whether it's saying that I can use --template in the _same_ pandoc
> >>> > invocation or whether I need to use a separate invocation:
> >>> > * You could use the metadata table to fill variables in a custom lua
> >>> > template.  Or, pass `--template=...` to pandoc, and pandoc will do
> the
> >>> > template processing as usual.
> >>> >
> >>> > I can supply more detailed info on request.
> >>> >
> >>> > Thanks,
> >>> > William Lupton
> >>> >
> >>> > --
> >>> > 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/66e3e0f4-a77c-4ff6-b71e-68182d95ac2an%40googlegroups.com
> >>> .
> >>>
> >>
>

-- 
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/CAEe_xxinvW1OkUm8QGTuFU_yoitz97XqYmdQO4pyUhKSL%3DdWCQ%40mail.gmail.com.

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

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

* Re: Custom lua writers and standalone documents
       [not found]                     ` <CAEe_xxinvW1OkUm8QGTuFU_yoitz97XqYmdQO4pyUhKSL=dWCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-10-05 17:10                       ` John MacFarlane
  0 siblings, 0 replies; 8+ messages in thread
From: John MacFarlane @ 2020-10-05 17:10 UTC (permalink / raw)
  To: William Lupton; +Cc: pandoc-discuss

William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> One comment re the lua writer Doc() function's 'variables' argument: This
> seems by default to contain the curdir, outputfile and sourcefile
> variables, which are three of the
> https://pandoc.org/MANUAL.html#variables-set-automatically. I understand
> that not all of these variables could be set at this point (e.g., body
> couldn't, and meta-json probably shouldn't), but arguably most of the rest
> of these variables could be set, including toc?

Maybe toc could be set before calling the writers.  This wasn't
the case earlier, since we used to populate toc with the table
of contents itself, which was constructed by the writer.
But we now use table-of-contents for that.

Please submit an issue requesting this, so it won't be forgotten.


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

end of thread, other threads:[~2020-10-05 17:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 14:32 Custom lua writers and standalone documents William Lupton
     [not found] ` <66e3e0f4-a77c-4ff6-b71e-68182d95ac2an-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-10-04 15:12   ` John MacFarlane
     [not found]     ` <m2362ut47x.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-10-04 15:54       ` William Lupton
     [not found]         ` <CAEe_xxjxAsHgd3nQtL+-Nrsfgk9tbOmhYz_8JJ2dMkCMAJ1aRA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-10-04 15:56           ` William Lupton
     [not found]             ` <CAEe_xxijXFxtfTzRJNp_wmT93ERdFDm_9oauEkrPmjWjT9zfPw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-10-04 16:25               ` William Lupton
2020-10-04 18:41               ` John MacFarlane
     [not found]                 ` <m2imbpsuk7.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-10-05  8:42                   ` William Lupton
     [not found]                     ` <CAEe_xxinvW1OkUm8QGTuFU_yoitz97XqYmdQO4pyUhKSL=dWCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-10-05 17:10                       ` 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).