public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Jonas Zohren <jonas.zohren-ncST9ati83jjhi9iKp3Nug@public.gmane.org>
To: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
Cc: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Lua-Filter, Span-text to metadata-text: How to get rid of linebreaks in metadata
Date: Thu, 10 Oct 2019 11:59:10 +0200	[thread overview]
Message-ID: <7538f86a-e1ac-d7b5-cee7-f67eb34f5127@tu-dortmund.de> (raw)
In-Reply-To: <m2a7a9nse8.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 2520 bytes --]

Yes, this helps to solve the problem, thanks for that.

But why do those metavalues get wrapped in the JSON-output in the first
place? Is there a specific rationale behind it?

On 10.10.19 06:20, John MacFarlane wrote:
> 
> If you don't want any line wrapping behavior, just use
> --wrap=none on the command line.
> 
> Alternatively, --wrap=preserve will preserve newlines
> in your source file.
> 
> Does that help or have I misunderstood the problem?
> 
> Jonas Zohren <jonas.zohren-ncST9ati83jjhi9iKp3Nug@public.gmane.org> writes:
> 
>> 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/7538f86a-e1ac-d7b5-cee7-f67eb34f5127%40tu-dortmund.de.

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

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2019-10-10  9:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09 16:56 Jonas Zohren
     [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 [this message]
     [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=7538f86a-e1ac-d7b5-cee7-f67eb34f5127@tu-dortmund.de \
    --to=jonas.zohren-ncst9ati83jjhi9ikp3nug@public.gmane.org \
    --cc=jgm-TVLZxgkOlNX2fBVCVOL8/A@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).