public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Layout Hooks in a JSON => PDF Pipeline
@ 2023-03-21 12:31 Matan Bendix Shenhav
       [not found] ` <9b05df21-d6cc-4312-963b-d706b24e4f38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matan Bendix Shenhav @ 2023-03-21 12:31 UTC (permalink / raw)
  To: pandoc-discuss


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

I'm looking to implement a web app which allows users to write articles 
which automatically get typeset into newspapers. I will be consuming JSON 
data and want to output PDFs, and want to understand how to provide limited 
control of element positioning (especially of images) through some sort of 
layout hooks.

Articles will be written in a simple linear rich-text format, but some 
limited settings would allow users to control elements of positioning, in 
particular whether images would appear inline inside a column or blown up 
to full page width.

Editing is highly contained to keep things simple. Users select a 
collection of articles and pick their preferred order, and the application 
can decide the details of how to position them. The output is a section of 
the newspaper, N pages long, as a PDF.

The web editor will output the content in some sort of JSON format 
(probably extending this API 
<https://editorjs.io/base-concepts/#what-is-clean-data>), but if necessary 
I can easily convert this into HTML (and indeed, I will have to anyway for 
the use to view the content in the editor).

If I understand correctly, the Pandoc pipeline should be something like 
this:

[image: Screenshot from 2023-03-21 13-25-28.png]

My main question is about provide element-level hooks to allow to input 
JSON to influence output layout. As a simple example, let's say the user 
adds some images into the markup. Some images should be inline, while 
others should be full page width or even full page.

How do I implement such hooks in this sort of Pandoc pipeline?

Thank you for your time!
             

-- 
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/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com.

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

[-- Attachment #2: Screenshot from 2023-03-21 13-25-28.png --]
[-- Type: image/png, Size: 56881 bytes --]

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

* Re: Layout Hooks in a JSON => PDF Pipeline
       [not found] ` <9b05df21-d6cc-4312-963b-d706b24e4f38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-03-21 13:31   ` Bastien DUMONT
  2023-03-21 16:12     ` Matan Bendix Shenhav
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien DUMONT @ 2023-03-21 13:31 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Your custom reader can store the required information in divs, spans or attributes (for the elements that support it). Then, when writing to LaTeX, you can use a custom filter to convert this information to LaTeX code.

A word of caution: in your figure, the LaTeX engine comes after Pandoc (Pandoc outputs a TeX file taking account of the custom template; then this TeX file is processed by the LaTeX engine). 

Le Tuesday 21 March 2023 à 05:31:48AM, Matan Bendix Shenhav a écrit :
> I'm looking to implement a web app which allows users to write articles which
> automatically get typeset into newspapers. I will be consuming JSON data and
> want to output PDFs, and want to understand how to provide limited control of
> element positioning (especially of images) through some sort of layout hooks.
> 
> Articles will be written in a simple linear rich-text format, but some limited
> settings would allow users to control elements of positioning, in particular
> whether images would appear inline inside a column or blown up to full page
> width.
> 
> Editing is highly contained to keep things simple. Users select a collection of
> articles and pick their preferred order, and the application can decide the
> details of how to position them. The output is a section of the newspaper, N
> pages long, as a PDF.
> 
> The web editor will output the content in some sort of JSON format (probably
> extending [1]this API), but if necessary I can easily convert this into HTML
> (and indeed, I will have to anyway for the use to view the content in the
> editor).
> 
> If I understand correctly, the Pandoc pipeline should be something like this:
> 
> Screenshot from 2023-03-21 13-25-28.png
> 
> My main question is about provide element-level hooks to allow to input JSON to
> influence output layout. As a simple example, let's say the user adds some
> images into the markup. Some images should be inline, while others should be
> full page width or even full page.
> 
> How do I implement such hooks in this sort of Pandoc pipeline?
> 
> Thank you for your time!
>             
> 
> --
> 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 [2]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [3]https://groups.google.com/d/msgid/
> pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com.
> 
> References:
> 
> [1] https://editorjs.io/base-concepts/#what-is-clean-data
> [2] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [3] https://groups.google.com/d/msgid/pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com?utm_medium=email&utm_source=footer


-- 
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/ZBmxm/na%2BwA129AO%40localhost.


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

* Re: Layout Hooks in a JSON => PDF Pipeline
  2023-03-21 13:31   ` Bastien DUMONT
@ 2023-03-21 16:12     ` Matan Bendix Shenhav
       [not found]       ` <f2109e96-b0b2-42da-b19a-0312a41f5952n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matan Bendix Shenhav @ 2023-03-21 16:12 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks for clarifying! Reading the docs on filters, if I understand 
correctly the idea is something like this:

    Input => Reader => AST => Filter => AST => Writer => Output

But if I need to write a custom reader anyway, why would I need to encode 
additional transformations in a filter? Couldn't I just encode it into the 
AST when I read it in in the first place?

On Tuesday, March 21, 2023 at 2:31:14 PM UTC+1 Bastien DUMONT wrote:

> Your custom reader can store the required information in divs, spans or 
> attributes (for the elements that support it). Then, when writing to LaTeX, 
> you can use a custom filter to convert this information to LaTeX code.
>
> A word of caution: in your figure, the LaTeX engine comes after Pandoc 
> (Pandoc outputs a TeX file taking account of the custom template; then this 
> TeX file is processed by the LaTeX engine). 
>
> Le Tuesday 21 March 2023 à 05:31:48AM, Matan Bendix Shenhav a écrit :
> > I'm looking to implement a web app which allows users to write articles 
> which
> > automatically get typeset into newspapers. I will be consuming JSON data 
> and
> > want to output PDFs, and want to understand how to provide limited 
> control of
> > element positioning (especially of images) through some sort of layout 
> hooks.
> > 
> > Articles will be written in a simple linear rich-text format, but some 
> limited
> > settings would allow users to control elements of positioning, in 
> particular
> > whether images would appear inline inside a column or blown up to full 
> page
> > width.
> > 
> > Editing is highly contained to keep things simple. Users select a 
> collection of
> > articles and pick their preferred order, and the application can decide 
> the
> > details of how to position them. The output is a section of the 
> newspaper, N
> > pages long, as a PDF.
> > 
> > The web editor will output the content in some sort of JSON format 
> (probably
> > extending [1]this API), but if necessary I can easily convert this into 
> HTML
> > (and indeed, I will have to anyway for the use to view the content in the
> > editor).
> > 
> > If I understand correctly, the Pandoc pipeline should be something like 
> this:
> > 
> > Screenshot from 2023-03-21 13-25-28.png
> > 
> > My main question is about provide element-level hooks to allow to input 
> JSON to
> > influence output layout. As a simple example, let's say the user adds 
> some
> > images into the markup. Some images should be inline, while others 
> should be
> > full page width or even full page.
> > 
> > How do I implement such hooks in this sort of Pandoc pipeline?
> > 
> > Thank you for your time!
> >             
> > 
> > --
> > 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 [2]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit [3]
> https://groups.google.com/d/msgid/
> > pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com.
> > 
> > References:
> > 
> > [1] https://editorjs.io/base-concepts/#what-is-clean-data
> > [2] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > [3] 
> https://groups.google.com/d/msgid/pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com?utm_medium=email&utm_source=footer
>
>
>

-- 
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/f2109e96-b0b2-42da-b19a-0312a41f5952n%40googlegroups.com.

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

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

* Re: Layout Hooks in a JSON => PDF Pipeline
       [not found]       ` <f2109e96-b0b2-42da-b19a-0312a41f5952n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-03-21 16:26         ` Bastien DUMONT
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien DUMONT @ 2023-03-21 16:26 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

If you are sure to convert this custom JSON format to LaTeX only, so yes. Separating the importation and the conversion tasks as I suggested would ease adding support for different input or output file formats in the future.

Le Tuesday 21 March 2023 à 09:12:39AM, Matan Bendix Shenhav a écrit :
> Thanks for clarifying! Reading the docs on filters, if I understand correctly
> the idea is something like this:
> 
>     Input => Reader => AST => Filter => AST => Writer => Output
> 
> But if I need to write a custom reader anyway, why would I need to encode
> additional transformations in a filter? Couldn't I just encode it into the AST
> when I read it in in the first place?
> 
> On Tuesday, March 21, 2023 at 2:31:14 PM UTC+1 Bastien DUMONT wrote:
> 
>     Your custom reader can store the required information in divs, spans or
>     attributes (for the elements that support it). Then, when writing to LaTeX,
>     you can use a custom filter to convert this information to LaTeX code.
> 
>     A word of caution: in your figure, the LaTeX engine comes after Pandoc
>     (Pandoc outputs a TeX file taking account of the custom template; then this
>     TeX file is processed by the LaTeX engine).
> 
>     Le Tuesday 21 March 2023 à 05:31:48AM, Matan Bendix Shenhav a écrit :
>     > I'm looking to implement a web app which allows users to write articles
>     which
>     > automatically get typeset into newspapers. I will be consuming JSON data
>     and
>     > want to output PDFs, and want to understand how to provide limited
>     control of
>     > element positioning (especially of images) through some sort of layout
>     hooks.
>     >
>     > Articles will be written in a simple linear rich-text format, but some
>     limited
>     > settings would allow users to control elements of positioning, in
>     particular
>     > whether images would appear inline inside a column or blown up to full
>     page
>     > width.
>     >
>     > Editing is highly contained to keep things simple. Users select a
>     collection of
>     > articles and pick their preferred order, and the application can decide
>     the
>     > details of how to position them. The output is a section of the
>     newspaper, N
>     > pages long, as a PDF.
>     >
>     > The web editor will output the content in some sort of JSON format
>     (probably
>     > extending [1]this API), but if necessary I can easily convert this into
>     HTML
>     > (and indeed, I will have to anyway for the use to view the content in the
>     > editor).
>     >
>     > If I understand correctly, the Pandoc pipeline should be something like
>     this:
>     >
>     > Screenshot from 2023-03-21 13-25-28.png
>     >
>     > My main question is about provide element-level hooks to allow to input
>     JSON to
>     > influence output layout. As a simple example, let's say the user adds
>     some
>     > images into the markup. Some images should be inline, while others should
>     be
>     > full page width or even full page.
>     >
>     > How do I implement such hooks in this sort of Pandoc pipeline?
>     >
>     > Thank you for your time!
>     >             
>     >
>     > --
>     > 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 [2]pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>     > To view this discussion on the web visit [3][1]https://groups.google.com/
>     d/msgid/
>     > pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%[2]
>     40googlegroups.com.
>     >
>     > References:
>     >
>     > [1] [3]https://editorjs.io/base-concepts/#what-is-clean-data
>     > [2] mailto:pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
>     > [3] [4]https://groups.google.com/d/msgid/pandoc-discuss/
>     9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com?utm_medium=email&
>     utm_source=footer
> 
> 
> 
> --
> 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 [5]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit [6]https://groups.google.com/d/msgid/
> pandoc-discuss/f2109e96-b0b2-42da-b19a-0312a41f5952n%40googlegroups.com.
> 
> References:
> 
> [1] https://groups.google.com/d/msgid/
> [2] http://40googlegroups.com/
> [3] https://editorjs.io/base-concepts/#what-is-clean-data
> [4] https://groups.google.com/d/msgid/pandoc-discuss/9b05df21-d6cc-4312-963b-d706b24e4f38n%40googlegroups.com?utm_medium=email&utm_source=footer
> [5] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [6] https://groups.google.com/d/msgid/pandoc-discuss/f2109e96-b0b2-42da-b19a-0312a41f5952n%40googlegroups.com?utm_medium=email&utm_source=footer

-- 
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/ZBnazYB5dmXAFMFb%40localhost.


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

end of thread, other threads:[~2023-03-21 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 12:31 Layout Hooks in a JSON => PDF Pipeline Matan Bendix Shenhav
     [not found] ` <9b05df21-d6cc-4312-963b-d706b24e4f38n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-21 13:31   ` Bastien DUMONT
2023-03-21 16:12     ` Matan Bendix Shenhav
     [not found]       ` <f2109e96-b0b2-42da-b19a-0312a41f5952n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-21 16:26         ` Bastien DUMONT

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