From: Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Cc: Russ <info-ckBjHRpK5r9MPTj2movljOTW4wlIGRCZ@public.gmane.org>
Subject: Re: Reading a multi line yaml key - results in text surrounded in html <p> tags?
Date: Fri, 21 Jan 2022 10:35:17 +0100 [thread overview]
Message-ID: <874k5xmnhp.fsf@zeitkraut.de> (raw)
In-Reply-To: <cef14d70-eda9-4555-85ec-a39e71fabf29n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Russ <info-ckBjHRpK5r9MPTj2movljOTW4wlIGRCZ@public.gmane.org> writes:
> remove-meta-html.lua
>
> function Pandoc(doc)
> for k,v in pairs(doc.meta) do
> if v.t == 'MetaBlocks' then
> for i,x in ipairs(v) do
> if x.t == 'Para' then v[i] = pandoc.Plain(v[i].c) end
> end
> end
> end
> return doc
> end
Looks like you are affected by this change in pandoc 2.17:
> Elements of type `MetaValue` are no longer pushed as values which have
> `.t` and `.tag` properties. This was already true for `MetaString` and
> `MetaBool` values, which are still marshaled as Lua strings and
> booleans, respectively. Affected values:
>
> - `MetaBlocks` values are marshaled as a Blocks list;
> - `MetaInlines` values are marshaled as a Inlines list;
> - `MetaList` values are marshaled as a generic pandoc Lists.
> - `MetaMap` values are marshaled as plain tables and no longer given
> any metatable.
You can use the new function `pandoc.utils.type` to inspect the value:
``` lua
function Pandoc(doc)
for k, v in pairs(doc.meta) do
if pandoc.utils.type(v) == 'Blocks' then
doc.meta[k] = v:map(function(x)
return x.t == 'Para' and pandoc.Plain(x.content) or x
end)
end
end
return doc
end
```
--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
next prev parent reply other threads:[~2022-01-21 9:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-20 15:21 Russ
[not found] ` <e17cd72d-2900-476c-a945-77d9e2e722bcn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-01-20 21:37 ` John MacFarlane
2022-01-20 21:41 ` John MacFarlane
[not found] ` <yh480ksfti2igy.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2022-01-21 8:24 ` BPJ
[not found] ` <CADAJKhBEViWZsLRRtAr78yn3Q3fSZswg85vut21vkrpfsvszXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-01-21 9:01 ` Russ
[not found] ` <cef14d70-eda9-4555-85ec-a39e71fabf29n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-01-21 9:35 ` Albert Krewinkel [this message]
2022-01-21 10:27 ` Albert Krewinkel
[not found] ` <87zgnpl6wc.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-01-21 16:37 ` Russ
[not found] ` <899d9fd4-dfae-48d7-ab33-3d55b81f540cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-01-21 19:37 ` John MacFarlane
[not found] ` <yh480kwnis7udi.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2022-01-24 10:46 ` Russ
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=874k5xmnhp.fsf@zeitkraut.de \
--to=albert+pandoc-9eawchwdxg8hfhg+jk9f0w@public.gmane.org \
--cc=info-ckBjHRpK5r9MPTj2movljOTW4wlIGRCZ@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).