public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Jonas Zohren <jonas.zohren-ncST9ati83jjhi9iKp3Nug@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Lua-Filter, Span-text to metadata-text: How to get rid of linebreaks in metadata
Date: Wed, 9 Oct 2019 18:56:49 +0200	[thread overview]
Message-ID: <a2955f67-6668-c9a6-3f46-ff100088759d@tu-dortmund.de> (raw)

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

Dear list!

Setup:
PandocMarkdown transcript of meeting with specially tagged spans. E.g.

```md
[Let's declare war on those other guys over there which we don't want to
live.]{.resolution}

[Let's buy a tank.]{.resolution}
```

I want to extract those resolutions out of the document and store them
as metadata for further processing. I managed to do so with a lua filter
using `pandoc.utils.stringify(span)`. As a result the strings get stored
in metadata:
```yaml
date: 0000-00-00
resolutions:
- text: |
      Let's declare war on those other guys over there which
      we don't want to live on.

```

And here is my problem: It gets split up into multiple lines, even
though the original text did not have line breaks. In markdown this
wouldn't be a huge problem, as it ignores this, but when I now output
the metadata as json with the template

```md
$meta-json$
```

and `pandoc -t markdown -s` the resulting json contains those line
break, which originally weren't there:

```json
{text: "Let's declare war on those other guys over there which\nwe don't
want to live on."}
```

AFAIK PandocMarkdown treats the yaml metadata strings as regular
markdown strings and might auto line break them up as a result, but why
does this leak into the JSON-output? The raw JSON-AST (`pandoc -t JSON`)
does not containt those line breaks.

How can I avoid that and export my metadata as JSON with _clean_ strings?


Kind Regards

Jonas


-- 
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/a2955f67-6668-c9a6-3f46-ff100088759d%40tu-dortmund.de.

[-- Attachment #2: 0xD8879970EF182C4B.asc --]
[-- Type: application/pgp-keys, Size: 4841 bytes --]

             reply	other threads:[~2019-10-09 16:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 16:56 Jonas Zohren [this message]
     [not found] ` <a2955f67-6668-c9a6-3f46-ff100088759d-ncST9ati83jjhi9iKp3Nug@public.gmane.org>
2019-10-10  4:20   ` John MacFarlane
     [not found]     ` <m2a7a9nse8.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-10-10  9:59       ` Jonas Zohren
     [not found]         ` <7538f86a-e1ac-d7b5-cee7-f67eb34f5127-ncST9ati83jjhi9iKp3Nug@public.gmane.org>
2019-10-12  7:27           ` BPJ
2019-10-10  8:43   ` BPJ

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=a2955f67-6668-c9a6-3f46-ff100088759d@tu-dortmund.de \
    --to=jonas.zohren-ncst9ati83jjhi9ikp3nug@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).