public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Sean McDaniel <sean.m.mcdaniel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>,
	pandoc-discuss
	<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Prevent backslash escaping and kept YAML header in Pandoc Markdown to PHP Extra Markdown conversion
Date: Fri, 13 Aug 2021 17:06:39 -0400	[thread overview]
Message-ID: <CAML5wTV5_Zxz7_ABo+p-22AF9obc4aH1d8uMCc4bzGnyvcKENg@mail.gmail.com> (raw)
In-Reply-To: <CADAJKhDU-03GUEA3_5W7ThQMuMU9_bqPH0_ZsWHUm6ptq1HBsQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

BPJ, that did the trick. Thank you for your help!

On Fri, Aug 13, 2021 at 3:41 PM BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Sorry a typo on line 112: change `local keys` into `local keys = {}`
>
> I must have hit undo one time too many!
>
> Den fre 13 aug. 2021 19:01Sean McDaniel <sean.m.mcdaniel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
>
>> Thank you BP for the Lua filter and the explanation. I have attempted to
>> run your Lua filter without modifications as a test and I get the following
>> error:
>>
>> Error running filter meta-whitelist.lua:
>> meta-whitelist.lua:114: attempt to get length of a nil value (local
>> 'keys')
>> stack traceback:
>> meta-whitelist.lua:114: in function 'Meta'
>>
>> The issued pandoc command was (note that I put the Lua filter after the
>> crossref filter):
>>
>> pandoc -s --markdown-headings=atx \
>>     --filter=pandoc-crossref --lua-filter=meta-whitelist.lua \
>>     --from=markdown+raw_attribute+yaml_metadata_block \
>>     --to=markdown_phpextra+yaml_metadata_block \
>>     -o myfile_phpextra.md myfile.md
>>
>> I get the same error with or without the crossref filter.
>>
>> As you've explained (thanks) the metadata fields are created by the
>> pandoc-crossref filter. The following without filters works as
>> expected---both my YAML header and Markdown blocks are preserved:
>>
>> pandoc -s --markdown-headings=atx \
>>     --from=markdown+raw_attribute+yaml_metadata_block \
>>     --to=markdown_phpextra+yaml_metadata_block \
>>     -o myfile_phpextra.md myfile.md
>>
>> The above will probably work for most of my needs, but I was wondering if
>> there's a simple Lua filter fix to get it working for my case.
>>
>> Regards,
>>
>> Sean
>>
>> On Tue, Aug 10, 2021 at 3:47 PM John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:
>>
>>>
>>> I see. Well, messing with templates won't help.
>>> You could write a filter that is applied AFTER
>>> pandoc-crossref and removes these metadata fields.
>>>
>>> BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>>
>>> > They are pandoc-crossref configuration options, passed through the
>>> metadata
>>> > since that is the most convenient way to let the user "communicate"
>>> with
>>> > filters.
>>> >
>>> > Den tis 10 aug. 2021 20:09John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skrev:
>>> >
>>> >> Sean McDaniel <sean.m.mcdaniel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>> >>
>>> >> > Thank you John. Your suggestions got me most of the way there: the
>>> >> markdown
>>> >> > code blocks with the +raw_attribute processing are correctly passing
>>> >> > through the sections I want untouched and the +yaml_metadata_block
>>> is
>>> >> > keeping the header content I want.
>>> >> >
>>> >> > The remaining issue which is giving me trouble is that
>>> +yaml_header_block
>>> >> > is also including all other document metadata and not just the
>>> variables
>>> >> > I've defined, i.e. stuff like
>>> >> >
>>> >> > autoEqnLabels: false
>>> >> > autoSectionLabels: false
>>> >> > ccsDelim: ", "
>>> >> > ccsLabelSep:  —
>>> >> > ccsTemplate: |
>>> >> >   *i*
>>> >> >   *c**c**s**L**a**b**e**l**S**e**p*
>>> >> >   *t*
>>> >> > chapDelim: .
>>> >> >
>>> >> > and so forth.
>>> >>
>>> >> I'm not sure why these are going in the metadata -- what is
>>> >> setting these metadata elements, if you're not doing it?
>>> >> maybe I don't understand the issue.
>>> >>
>>> >> --
>>> >> 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/m21r71895k.fsf%40MacBook-Pro-2.hsd1.ca.comcast.net
>>> >> .
>>> >>
>>> >
>>> > --
>>> > 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/CADAJKhBhk%3DM15HuN-4b%2BbG8NCGBeS6A7YYa3Y2n3Dax22m8MJA%40mail.gmail.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/CAML5wTV5_Zxz7_ABo%2Bp-22AF9obc4aH1d8uMCc4bzGnyvcKENg%40mail.gmail.com.

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

      parent reply	other threads:[~2021-08-13 21:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 19:14 Sean McDaniel
     [not found] ` <0c95effe-7e6e-4974-a7b7-5981b6b46ed4n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-08-08 18:31   ` John MacFarlane
     [not found]     ` <m2h7fzaivs.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-08-09 20:56       ` Sean McDaniel
     [not found]         ` <CAML5wTUJ+svOhMUi2GwtPw0-_sx-GrRtG5teCihq6WmGXjZ8Cg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-10  8:44           ` BPJ
2021-08-10 18:08           ` John MacFarlane
     [not found]             ` <m21r71895k.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-08-10 19:04               ` BPJ
     [not found]                 ` <CADAJKhBhk=M15HuN-4b+bG8NCGBeS6A7YYa3Y2n3Dax22m8MJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-10 19:47                   ` John MacFarlane
     [not found]                     ` <yh480ktujxw08h.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-08-13 17:01                       ` Sean McDaniel
     [not found]                         ` <CAML5wTWbn0S2Ps+ROAOqjpHvv1ygfqWjx1FL0nj_2DiNSjjhdQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-13 17:03                           ` Sean McDaniel
2021-08-13 19:41                           ` BPJ
     [not found]                             ` <CADAJKhDU-03GUEA3_5W7ThQMuMU9_bqPH0_ZsWHUm6ptq1HBsQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-13 21:06                               ` Sean McDaniel [this message]

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=CAML5wTV5_Zxz7_ABo+p-22AF9obc4aH1d8uMCc4bzGnyvcKENg@mail.gmail.com \
    --to=sean.m.mcdaniel-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org \
    --cc=melroch-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).