public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Exception handling at writer end
@ 2022-09-12  9:28 Harsh Donga
       [not found] ` <ab7b37d0-be67-4e93-8298-31f7069fe2a8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Harsh Donga @ 2022-09-12  9:28 UTC (permalink / raw)
  To: pandoc-discuss


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

Hey folks,

Context : I am trying to convert Pandoc AST to HTML

I would like to know if there is any exception handling done if let's say a 
particular block in Pandoc AST is erroneous (wrongly structured or placed).
For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), 
returns 
err at block[x][y]
That is the whole conversion fails.

Can that particular element be skipped or something else can be done?


Thanks in advance!
Regards,
Harsh

-- 
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/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%40googlegroups.com.

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

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

* Re: Exception handling at writer end
       [not found] ` <ab7b37d0-be67-4e93-8298-31f7069fe2a8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-09-12 10:24   ` John MacFarlane
       [not found]     ` <F3D0065A-EA1D-469E-8AD5-0CF3AAD84AE2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2022-09-12 10:24 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Generally this shouldn't happen; writers should be able to handle arbitrary ASTs.
So let us know the particulars.  Give a short example sufficient to reproduce the issue you're seeing.

> On Sep 12, 2022, at 11:28 AM, Harsh Donga <harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> wrote:
> 
> Hey folks,
> 
> Context : I am trying to convert Pandoc AST to HTML
> 
> I would like to know if there is any exception handling done if let's say a particular block in Pandoc AST is erroneous (wrongly structured or placed).
> For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), returns 
> err at block[x][y]
> That is the whole conversion fails.
> 
> Can that particular element be skipped or something else can be done?
> 
> 
> Thanks in advance!
> Regards,
> Harsh
> 
> -- 
> 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/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%40googlegroups.com.


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

* Re: Exception handling at writer end
       [not found]     ` <F3D0065A-EA1D-469E-8AD5-0CF3AAD84AE2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-09-12 10:32       ` John MacFarlane
       [not found]         ` <9D045A47-71E6-402F-A420-91F38CCD7EA1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2022-09-12 10:37       ` Harsh Donga
  1 sibling, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2022-09-12 10:32 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Also, verify that your issue is not actually with reading the JSON.

Try pandoc -f json -t native

If this raises an error, then the issue is in how your JSON is formatted.

On Sep 12, 2022, at 12:24 PM, John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> Generally this shouldn't happen; writers should be able to handle arbitrary ASTs.
> So let us know the particulars.  Give a short example sufficient to reproduce the issue you're seeing.
> 
>> On Sep 12, 2022, at 11:28 AM, Harsh Donga <harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> wrote:
>> 
>> Hey folks,
>> 
>> Context : I am trying to convert Pandoc AST to HTML
>> 
>> I would like to know if there is any exception handling done if let's say a particular block in Pandoc AST is erroneous (wrongly structured or placed).
>> For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), returns 
>> err at block[x][y]
>> That is the whole conversion fails.
>> 
>> Can that particular element be skipped or something else can be done?
>> 
>> 
>> Thanks in advance!
>> Regards,
>> Harsh
>> 
>> -- 
>> 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/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%40googlegroups.com.
> 


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

* Re: Exception handling at writer end
       [not found]     ` <F3D0065A-EA1D-469E-8AD5-0CF3AAD84AE2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2022-09-12 10:32       ` John MacFarlane
@ 2022-09-12 10:37       ` Harsh Donga
  1 sibling, 0 replies; 7+ messages in thread
From: Harsh Donga @ 2022-09-12 10:37 UTC (permalink / raw)
  To: pandoc-discuss


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

There are several cases, let's say here i am trying to make a BulletList 
but insert a heading object in between (out of structure) (Please refer 
first heading object inside bulletlist)
It does not conform to : 
https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pandoc-Definition.html#t:Block 
(BulletList [[Block 
<https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pandoc-Definition.html#t:Block>
]])
My intention to ask the question is if i can skip this element and process 
the rest?

PFA : synthetically made Pandoc AST

On Monday, 12 September 2022 at 15:55:00 UTC+5:30 fiddlosopher wrote:

> Generally this shouldn't happen; writers should be able to handle 
> arbitrary ASTs.
> So let us know the particulars. Give a short example sufficient to 
> reproduce the issue you're seeing.
>
> > On Sep 12, 2022, at 11:28 AM, Harsh Donga <ha...-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> 
> wrote:
> > 
> > Hey folks,
> > 
> > Context : I am trying to convert Pandoc AST to HTML
> > 
> > I would like to know if there is any exception handling done if let's 
> say a particular block in Pandoc AST is erroneous (wrongly structured or 
> placed).
> > For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), 
> returns 
> > err at block[x][y]
> > That is the whole conversion fails.
> > 
> > Can that particular element be skipped or something else can be done?
> > 
> > 
> > Thanks in advance!
> > Regards,
> > Harsh
> > 
> > -- 
> > 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%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/55202b0f-9aa0-4182-bc74-193fd48af65an%40googlegroups.com.

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

[-- Attachment #2: outPandoc.json --]
[-- Type: application/json, Size: 11274 bytes --]

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

* Re: Exception handling at writer end
       [not found]         ` <9D045A47-71E6-402F-A420-91F38CCD7EA1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-09-12 10:40           ` Harsh Donga
       [not found]             ` <8e35756c-09ea-4050-9bf2-7c82c46e3e41n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Harsh Donga @ 2022-09-12 10:40 UTC (permalink / raw)
  To: pandoc-discuss


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

If it's related to that, are there any options in Pandoc to skip or resolve 
it?
I believe it might be a reading issue (Since i am talking about ill 
formatted structure)

Let's say here i am trying to make a BulletList but insert a heading object 
in between (out of structure) (Please refer first heading object inside 
bulletlist)
It does not conform to : 
https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pandoc-Definition.html#t:Block 
(BulletList [[Block]])
My intention to ask the question is if i can skip this element and process 
the rest to HTML?

PFA : synthetically made Pandoc AST

On Monday, 12 September 2022 at 16:02:58 UTC+5:30 fiddlosopher wrote:

> Also, verify that your issue is not actually with reading the JSON.
>
> Try pandoc -f json -t native
>
> If this raises an error, then the issue is in how your JSON is formatted.
>
> On Sep 12, 2022, at 12:24 PM, John MacFarlane <fiddlo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 
> > Generally this shouldn't happen; writers should be able to handle 
> arbitrary ASTs.
> > So let us know the particulars. Give a short example sufficient to 
> reproduce the issue you're seeing.
> > 
> >> On Sep 12, 2022, at 11:28 AM, Harsh Donga <ha...-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> 
> wrote:
> >> 
> >> Hey folks,
> >> 
> >> Context : I am trying to convert Pandoc AST to HTML
> >> 
> >> I would like to know if there is any exception handling done if let's 
> say a particular block in Pandoc AST is erroneous (wrongly structured or 
> placed).
> >> For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), 
> returns 
> >> err at block[x][y]
> >> That is the whole conversion fails.
> >> 
> >> Can that particular element be skipped or something else can be done?
> >> 
> >> 
> >> Thanks in advance!
> >> Regards,
> >> Harsh
> >> 
> >> -- 
> >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> >> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%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/8e35756c-09ea-4050-9bf2-7c82c46e3e41n%40googlegroups.com.

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

[-- Attachment #2: outPandoc.json --]
[-- Type: application/json, Size: 11274 bytes --]

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

* Re: Exception handling at writer end
       [not found]             ` <8e35756c-09ea-4050-9bf2-7c82c46e3e41n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-09-12 10:50               ` John MacFarlane
       [not found]                 ` <ACA07D6E-5281-4B5E-A11A-C1FF52F10A11-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2022-09-12 10:50 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Pandoc's `-f json` expects a JSON encoding of a Pandoc AST; it must conform to the constraints on the AST given by the types.
If `pandoc -f json -t native` fails, it means that you haven't got a valid JSON serialization of a pandoc AST.  So, you're not even getting to the writers. 


> On Sep 12, 2022, at 12:40 PM, Harsh Donga <harsh-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> wrote:
> 
> If it's related to that, are there any options in Pandoc to skip or resolve it?
> I believe it might be a reading issue (Since i am talking about ill formatted structure)
> 
> Let's say here i am trying to make a BulletList but insert a heading object in between (out of structure) (Please refer first heading object inside bulletlist)
> It does not conform to : https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pandoc-Definition.html#t:Block (BulletList [[Block]])
> My intention to ask the question is if i can skip this element and process the rest to HTML?
> 
> PFA : synthetically made Pandoc AST
> 
> On Monday, 12 September 2022 at 16:02:58 UTC+5:30 fiddlosopher wrote:
> Also, verify that your issue is not actually with reading the JSON. 
> 
> Try pandoc -f json -t native 
> 
> If this raises an error, then the issue is in how your JSON is formatted. 
> 
> On Sep 12, 2022, at 12:24 PM, John MacFarlane <fiddlo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: 
> > 
> > Generally this shouldn't happen; writers should be able to handle arbitrary ASTs. 
> > So let us know the particulars. Give a short example sufficient to reproduce the issue you're seeing. 
> > 
> >> On Sep 12, 2022, at 11:28 AM, Harsh Donga <ha...-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> wrote: 
> >> 
> >> Hey folks, 
> >> 
> >> Context : I am trying to convert Pandoc AST to HTML 
> >> 
> >> I would like to know if there is any exception handling done if let's say a particular block in Pandoc AST is erroneous (wrongly structured or placed). 
> >> For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), returns 
> >> err at block[x][y] 
> >> That is the whole conversion fails. 
> >> 
> >> Can that particular element be skipped or something else can be done? 
> >> 
> >> 
> >> Thanks in advance! 
> >> Regards, 
> >> Harsh 
> >> 
> >> -- 
> >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> >> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%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/8e35756c-09ea-4050-9bf2-7c82c46e3e41n%40googlegroups.com.
> <outPandoc.json>


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

* Re: Exception handling at writer end
       [not found]                 ` <ACA07D6E-5281-4B5E-A11A-C1FF52F10A11-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-09-12 10:54                   ` Harsh Donga
  0 siblings, 0 replies; 7+ messages in thread
From: Harsh Donga @ 2022-09-12 10:54 UTC (permalink / raw)
  To: pandoc-discuss


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

Alright, so having additional logic to check conformity beforehand is the 
key!

Thank you so much! Really appreciate the support I get always!
One of the best community!


On Monday, 12 September 2022 at 16:20:14 UTC+5:30 fiddlosopher wrote:

> Pandoc's `-f json` expects a JSON encoding of a Pandoc AST; it must 
> conform to the constraints on the AST given by the types.
> If `pandoc -f json -t native` fails, it means that you haven't got a valid 
> JSON serialization of a pandoc AST. So, you're not even getting to the 
> writers. 
>
>
> > On Sep 12, 2022, at 12:40 PM, Harsh Donga <ha...-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> 
> wrote:
> > 
> > If it's related to that, are there any options in Pandoc to skip or 
> resolve it?
> > I believe it might be a reading issue (Since i am talking about ill 
> formatted structure)
> > 
> > Let's say here i am trying to make a BulletList but insert a heading 
> object in between (out of structure) (Please refer first heading object 
> inside bulletlist)
> > It does not conform to : 
> https://hackage.haskell.org/package/pandoc-types-1.22/docs/Text-Pandoc-Definition.html#t:Block 
> (BulletList [[Block]])
> > My intention to ask the question is if i can skip this element and 
> process the rest to HTML?
> > 
> > PFA : synthetically made Pandoc AST
> > 
> > On Monday, 12 September 2022 at 16:02:58 UTC+5:30 fiddlosopher wrote:
> > Also, verify that your issue is not actually with reading the JSON. 
> > 
> > Try pandoc -f json -t native 
> > 
> > If this raises an error, then the issue is in how your JSON is 
> formatted. 
> > 
> > On Sep 12, 2022, at 12:24 PM, John MacFarlane <fiddlo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 
> wrote: 
> > > 
> > > Generally this shouldn't happen; writers should be able to handle 
> arbitrary ASTs. 
> > > So let us know the particulars. Give a short example sufficient to 
> reproduce the issue you're seeing. 
> > > 
> > >> On Sep 12, 2022, at 11:28 AM, Harsh Donga <ha...-7+aFW328pE6p1wGUEcWPqti2O/JbrIOy@public.gmane.org> 
> wrote: 
> > >> 
> > >> Hey folks, 
> > >> 
> > >> Context : I am trying to convert Pandoc AST to HTML 
> > >> 
> > >> I would like to know if there is any exception handling done if let's 
> say a particular block in Pandoc AST is erroneous (wrongly structured or 
> placed). 
> > >> For now, pandoc command (pandoc -t html pandoc.json -o pandoc.html), 
> returns 
> > >> err at block[x][y] 
> > >> That is the whole conversion fails. 
> > >> 
> > >> Can that particular element be skipped or something else can be done? 
> > >> 
> > >> 
> > >> Thanks in advance! 
> > >> Regards, 
> > >> Harsh 
> > >> 
> > >> -- 
> > >> 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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
> > >> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/ab7b37d0-be67-4e93-8298-31f7069fe2a8n%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-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/8e35756c-09ea-4050-9bf2-7c82c46e3e41n%40googlegroups.com
> .
> > <outPandoc.json>
>
>

-- 
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/3d3e093e-01a9-4d79-8ae4-4f402a88d69an%40googlegroups.com.

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

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

end of thread, other threads:[~2022-09-12 10:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12  9:28 Exception handling at writer end Harsh Donga
     [not found] ` <ab7b37d0-be67-4e93-8298-31f7069fe2a8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-12 10:24   ` John MacFarlane
     [not found]     ` <F3D0065A-EA1D-469E-8AD5-0CF3AAD84AE2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-09-12 10:32       ` John MacFarlane
     [not found]         ` <9D045A47-71E6-402F-A420-91F38CCD7EA1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-09-12 10:40           ` Harsh Donga
     [not found]             ` <8e35756c-09ea-4050-9bf2-7c82c46e3e41n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-09-12 10:50               ` John MacFarlane
     [not found]                 ` <ACA07D6E-5281-4B5E-A11A-C1FF52F10A11-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-09-12 10:54                   ` Harsh Donga
2022-09-12 10:37       ` Harsh Donga

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