public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Use json-ld schema.org format as input
@ 2019-07-21 10:55 Jacopo Apunto
       [not found] ` <a81bbb0b-4cde-4249-ade9-6f365e994be5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Jacopo Apunto @ 2019-07-21 10:55 UTC (permalink / raw)
  To: pandoc-discuss


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

Hi everyone,
I am trying to use pandoc to create a pdf file from a json file formatted 
following the schema.org structured data format. Let's take, as example, 
this: https://schema.org/Recipe
Unfortunately, the output of 
pandoc -o recipe.pdf recipe.json --template custom
is "JSON parse error".
For what I understand, pandoc handles a particular json format but I wasn't 
able to find proper documentation on how to structure it.
I was looking at this example, but it seems to be a different approach: 
https://pandoc.org/using-the-pandoc-api.html#builder

Do you have any suggestion on how to achieve this?

I was also thinking of writing a converter from schema.org to markdown and 
yaml frontmatter and then serve it to pandoc.

Thanks!
Jacopo

-- 
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/a81bbb0b-4cde-4249-ade9-6f365e994be5%40googlegroups.com.

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

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

* Re: Use json-ld schema.org format as input
       [not found] ` <a81bbb0b-4cde-4249-ade9-6f365e994be5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-07-21 16:30   ` John MacFarlane
       [not found]     ` <m27e8bgxk5.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  2019-07-22 12:14   ` Rich Traube
  1 sibling, 1 reply; 4+ messages in thread
From: John MacFarlane @ 2019-07-21 16:30 UTC (permalink / raw)
  To: Jacopo Apunto, pandoc-discuss


Yes, json input is for a pandoc document serialized to json.
To see what the serialization looks like, just do pandoc -t json
on a document.

You could write a converter from your json format to pandoc's,
and let pandoc handle the markdown rendering; that would be
more reliable than going directly to markdown.

Jacopo Apunto <jacopander-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hi everyone,
> I am trying to use pandoc to create a pdf file from a json file formatted 
> following the schema.org structured data format. Let's take, as example, 
> this: https://schema.org/Recipe
> Unfortunately, the output of 
> pandoc -o recipe.pdf recipe.json --template custom
> is "JSON parse error".
> For what I understand, pandoc handles a particular json format but I wasn't 
> able to find proper documentation on how to structure it.
> I was looking at this example, but it seems to be a different approach: 
> https://pandoc.org/using-the-pandoc-api.html#builder
>
> Do you have any suggestion on how to achieve this?
>
> I was also thinking of writing a converter from schema.org to markdown and 
> yaml frontmatter and then serve it to pandoc.
>
> Thanks!
> Jacopo
>
> -- 
> 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/a81bbb0b-4cde-4249-ade9-6f365e994be5%40googlegroups.com.


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

* Re: Use json-ld schema.org format as input
       [not found]     ` <m27e8bgxk5.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2019-07-22  8:14       ` Agustín Martín
  0 siblings, 0 replies; 4+ messages in thread
From: Agustín Martín @ 2019-07-22  8:14 UTC (permalink / raw)
  To: pandoc-discuss


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

If you don't feel like writing a converter, there might be an easier way.

For a similar problem (my CV instead of recipes), I found that using YAML 
makes things easier (going from your structured JSON to YAML should be 
easy).

YAML can be understood by pandoc as metadata, and I use it with a markdown 
template to generate the contents of the document I want, using pandoc's 
templating features (variable substutution, conditionals, loops...) then I 
pass that markdown again through pandoc to create the docx, or pdf.

A.M.

On Sunday, July 21, 2019 at 6:30:35 PM UTC+2, John MacFarlane wrote:
>
>
> Yes, json input is for a pandoc document serialized to json. 
> To see what the serialization looks like, just do pandoc -t json 
> on a document. 
>
> You could write a converter from your json format to pandoc's, 
> and let pandoc handle the markdown rendering; that would be 
> more reliable than going directly to markdown. 
>
> Jacopo Apunto <jacop...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> writes: 
>
> > Hi everyone, 
> > I am trying to use pandoc to create a pdf file from a json file 
> formatted 
> > following the schema.org structured data format. Let's take, as 
> example, 
> > this: https://schema.org/Recipe 
> > Unfortunately, the output of 
> > pandoc -o recipe.pdf recipe.json --template custom 
> > is "JSON parse error". 
> > For what I understand, pandoc handles a particular json format but I 
> wasn't 
> > able to find proper documentation on how to structure it. 
> > I was looking at this example, but it seems to be a different approach: 
> > https://pandoc.org/using-the-pandoc-api.html#builder 
> > 
> > Do you have any suggestion on how to achieve this? 
> > 
> > I was also thinking of writing a converter from schema.org to markdown 
> and 
> > yaml frontmatter and then serve it to pandoc. 
> > 
> > Thanks! 
> > Jacopo 
> > 
> > -- 
> > 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-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. 
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/a81bbb0b-4cde-4249-ade9-6f365e994be5%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/eda2241e-237c-42d7-845b-222572b87e4f%40googlegroups.com.

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

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

* Re: Use json-ld schema.org format as input
       [not found] ` <a81bbb0b-4cde-4249-ade9-6f365e994be5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2019-07-21 16:30   ` John MacFarlane
@ 2019-07-22 12:14   ` Rich Traube
  1 sibling, 0 replies; 4+ messages in thread
From: Rich Traube @ 2019-07-22 12:14 UTC (permalink / raw)
  To: pandoc-discuss


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



On Sunday, July 21, 2019 at 6:55:01 AM UTC-4, Jacopo Apunto wrote:
>
> Hi everyone,
> I am trying to use pandoc to create a pdf file from a json file formatted 
> following the schema.org structured data format. Let's take, as example, 
> this: https://schema.org/Recipe
> ...
>
 
You can convert json to yaml using ruby or python. See 
https://www.commandlinefu.com/commands/matching/json-to-yaml/anNvbiB0byB5YW1s/sort-by-votes 
for one liners. Then it's just a matter of writing a pandoc template. I've 
done this for my resume, converting data from https://jsonresume.org/ for 
use with pandoc.


/rich

-- 
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/0d8f5b43-58c8-4010-acf5-7c0788521822%40googlegroups.com.

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

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

end of thread, other threads:[~2019-07-22 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-21 10:55 Use json-ld schema.org format as input Jacopo Apunto
     [not found] ` <a81bbb0b-4cde-4249-ade9-6f365e994be5-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-07-21 16:30   ` John MacFarlane
     [not found]     ` <m27e8bgxk5.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-07-22  8:14       ` Agustín Martín
2019-07-22 12:14   ` Rich Traube

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).