public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* custom writer with haskell
@ 2021-12-17 14:05 denis.maier-NSENcxR/0n0
       [not found] ` <51f4c7e7b63344adb5967a8bfe3e50c8-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2021-12-17 14:05 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

Hi,

currently, custom readers and writers are written in Lua. Would it be possible to add support for custom writers and readers in Haskell ? In my case it's not that I knew Haskell better than Lua, but sometimes it would be nice if you could just tweak the default readers and writers a bit, say allow an additional attribute (see my question from yesterday). Adding this to the existing writer would be much easier than writing a complete custom writer. Sure, it's always possible to make the change and compile pandoc from source, but maybe there's an easier way ?

Best,
Denis

-- 
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/51f4c7e7b63344adb5967a8bfe3e50c8%40unibe.ch.

[-- Attachment #2: Type: text/html, Size: 2976 bytes --]

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

* Re: custom writer with haskell
       [not found] ` <51f4c7e7b63344adb5967a8bfe3e50c8-NSENcxR/0n0@public.gmane.org>
@ 2021-12-17 22:35   ` John MacFarlane
       [not found]     ` <yh480kfsqq2735.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2021-12-17 22:35 UTC (permalink / raw)
  To: denis.maier-NSENcxR/0n0, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


Well, we could build a Haskell interpreter into pandoc
(as well as a Lua one).  That is possible by including
hint: https://hackage.haskell.org/package/hint
This would add even more to the executable size and
compilation time, of course!  I did something like
this with gitit plugins, but there are complexities,
esp. involving package search paths and the like.



<denis.maier-NSENcxR/0n0@public.gmane.org> writes:

> Hi,
>
> currently, custom readers and writers are written in Lua. Would it be possible to add support for custom writers and readers in Haskell ? In my case it's not that I knew Haskell better than Lua, but sometimes it would be nice if you could just tweak the default readers and writers a bit, say allow an additional attribute (see my question from yesterday). Adding this to the existing writer would be much easier than writing a complete custom writer. Sure, it's always possible to make the change and compile pandoc from source, but maybe there's an easier way ?
>
> Best,
> Denis
>
> -- 
> 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/51f4c7e7b63344adb5967a8bfe3e50c8%40unibe.ch.

-- 
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/yh480kfsqq2735.fsf%40johnmacfarlane.net.


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

* AW: custom writer with haskell
       [not found]     ` <yh480kfsqq2735.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2021-12-18 12:06       ` denis.maier-NSENcxR/0n0
       [not found]         ` <ee9cbe9414d947799907c62bce1408a8-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2021-12-18 12:06 UTC (permalink / raw)
  To: jgm-TVLZxgkOlNX2fBVCVOL8/A, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Does that have to be included? Can't one rely on Haskell being available? I mean, just like with Haskell filters....
________________________________________
Von: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
Gesendet: Freitag, 17. Dezember 2021 23:35:10
An: Maier, Denis Christian (UB); pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Betreff: Re: custom writer with haskell

Well, we could build a Haskell interpreter into pandoc
(as well as a Lua one).  That is possible by including
hint: https://hackage.haskell.org/package/hint
This would add even more to the executable size and
compilation time, of course!  I did something like
this with gitit plugins, but there are complexities,
esp. involving package search paths and the like.



<denis.maier-NSENcxR/0n0@public.gmane.org> writes:

> Hi,
>
> currently, custom readers and writers are written in Lua. Would it be possible to add support for custom writers and readers in Haskell ? In my case it's not that I knew Haskell better than Lua, but sometimes it would be nice if you could just tweak the default readers and writers a bit, say allow an additional attribute (see my question from yesterday). Adding this to the existing writer would be much easier than writing a complete custom writer. Sure, it's always possible to make the change and compile pandoc from source, but maybe there's an easier way ?
>
> Best,
> Denis
>
> --
> 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/51f4c7e7b63344adb5967a8bfe3e50c8%40unibe.ch.

-- 
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/ee9cbe9414d947799907c62bce1408a8%40unibe.ch.


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

* AW: custom writer with haskell
       [not found]         ` <ee9cbe9414d947799907c62bce1408a8-NSENcxR/0n0@public.gmane.org>
@ 2021-12-18 12:32           ` denis.maier-NSENcxR/0n0
       [not found]             ` <4eb30ae54aea41cd9fdb2aa207f4b96e-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2021-12-18 12:32 UTC (permalink / raw)
  To: jgm-TVLZxgkOlNX2fBVCVOL8/A, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Needless to say, having Haskell available via pandoc without a local installation would be awesome. Also for filters. But maybe there are simpler ways if that entails to much additional complexity.
________________________________________
Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im Auftrag von denis.maier-NSENcxR/0n0@public.gmane.org <denis.maier-NSENcxR/0n0@public.gmane.org>
Gesendet: Samstag, 18. Dezember 2021 13:06:07
An: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org; pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Betreff: AW: custom writer with haskell

Does that have to be included? Can't one rely on Haskell being available? I mean, just like with Haskell filters....
________________________________________
Von: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
Gesendet: Freitag, 17. Dezember 2021 23:35:10
An: Maier, Denis Christian (UB); pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Betreff: Re: custom writer with haskell

Well, we could build a Haskell interpreter into pandoc
(as well as a Lua one).  That is possible by including
hint: https://hackage.haskell.org/package/hint
This would add even more to the executable size and
compilation time, of course!  I did something like
this with gitit plugins, but there are complexities,
esp. involving package search paths and the like.



<denis.maier-NSENcxR/0n0@public.gmane.org> writes:

> Hi,
>
> currently, custom readers and writers are written in Lua. Would it be possible to add support for custom writers and readers in Haskell ? In my case it's not that I knew Haskell better than Lua, but sometimes it would be nice if you could just tweak the default readers and writers a bit, say allow an additional attribute (see my question from yesterday). Adding this to the existing writer would be much easier than writing a complete custom writer. Sure, it's always possible to make the change and compile pandoc from source, but maybe there's an easier way ?
>
> Best,
> Denis
>
> --
> 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/51f4c7e7b63344adb5967a8bfe3e50c8%40unibe.ch.

--
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/ee9cbe9414d947799907c62bce1408a8%40unibe.ch.

-- 
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/4eb30ae54aea41cd9fdb2aa207f4b96e%40unibe.ch.


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

* Re: AW: custom writer with haskell
       [not found]             ` <4eb30ae54aea41cd9fdb2aa207f4b96e-NSENcxR/0n0@public.gmane.org>
@ 2021-12-18 19:45               ` John MacFarlane
       [not found]                 ` <m21r297l3x.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John MacFarlane @ 2021-12-18 19:45 UTC (permalink / raw)
  To: denis.maier-NSENcxR/0n0, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


<denis.maier-NSENcxR/0n0@public.gmane.org> writes:

> Does that have to be included? Can't one rely on Haskell being available? I mean, just like with Haskell filters....

By the time you've got your environment set up with ghc and all the
libraries installed properly, which you'd need to run interpreted
writers, you might as well just recompile pandoc with the revised
module.  I don't see a big advantage.


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

* AW: AW: custom writer with haskell
       [not found]                 ` <m21r297l3x.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
@ 2021-12-21  8:51                   ` denis.maier-NSENcxR/0n0
       [not found]                     ` <c8f145c9d80f470f9adea4e3df82aab4-NSENcxR/0n0@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2021-12-21  8:51 UTC (permalink / raw)
  To: jgm-TVLZxgkOlNX2fBVCVOL8/A, pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

That's maybe true. So what's your take on that? Do you think including a Haskell interpreter would be a good idea?

> -----Ursprüngliche Nachricht-----
> Von: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
> Gesendet: Samstag, 18. Dezember 2021 20:46
> An: Maier, Denis Christian (UB) <denis.maier-NSENcxR/0n0@public.gmane.org>; pandoc-
> discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> Betreff: Re: AW: custom writer with haskell
> 
> 
> <denis.maier-NSENcxR/0n0@public.gmane.org> writes:
> 
> > Does that have to be included? Can't one rely on Haskell being available? I
> mean, just like with Haskell filters....
> 
> By the time you've got your environment set up with ghc and all the libraries
> installed properly, which you'd need to run interpreted writers, you might as
> well just recompile pandoc with the revised module.  I don't see a big
> advantage.

-- 
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/c8f145c9d80f470f9adea4e3df82aab4%40unibe.ch.


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

* Re: AW: custom writer with haskell
       [not found]                     ` <c8f145c9d80f470f9adea4e3df82aab4-NSENcxR/0n0@public.gmane.org>
@ 2021-12-21 14:18                       ` BPJ
  0 siblings, 0 replies; 7+ messages in thread
From: BPJ @ 2021-12-21 14:18 UTC (permalink / raw)
  To: pandoc-discuss

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

A trick I have been using is to include custom bits as code/raw
spans/blocks with classes/'formats' and parse and convert them to an AST
fragment in a filter, which is way easier than writing a custom parser for
whole files (and used to be the only viable option.) TBH I have mostly done
so in JSON filters written in Perl, but now that lpeg and re are available
in Lua filters they are a serious contender too.

A tip: if custom bits in syntax X are much more common than actual code
elements it makes sense to leave the former unmarked and give the latter a
pseudo-class `.code` if you don't want them highlighted.

/bpj

Den tis 21 dec. 2021 09:52 <denis.maier-NSENcxR/0n0@public.gmane.org> skrev:

> That's maybe true. So what's your take on that? Do you think including a
> Haskell interpreter would be a good idea?
>
> > -----Ursprüngliche Nachricht-----
> > Von: John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
> > Gesendet: Samstag, 18. Dezember 2021 20:46
> > An: Maier, Denis Christian (UB) <denis.maier-NSENcxR/0n0@public.gmane.org>; pandoc-
> > discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> > Betreff: Re: AW: custom writer with haskell
> >
> >
> > <denis.maier-NSENcxR/0n0@public.gmane.org> writes:
> >
> > > Does that have to be included? Can't one rely on Haskell being
> available? I
> > mean, just like with Haskell filters....
> >
> > By the time you've got your environment set up with ghc and all the
> libraries
> > installed properly, which you'd need to run interpreted writers, you
> might as
> > well just recompile pandoc with the revised module.  I don't see a big
> > advantage.
>
> --
> 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/c8f145c9d80f470f9adea4e3df82aab4%40unibe.ch
> .
>

-- 
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/CADAJKhCa0EuqdOvnnrhC18N5RemA5KVdFmqQRajw8ZsMdfQeAA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 3927 bytes --]

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

end of thread, other threads:[~2021-12-21 14:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 14:05 custom writer with haskell denis.maier-NSENcxR/0n0
     [not found] ` <51f4c7e7b63344adb5967a8bfe3e50c8-NSENcxR/0n0@public.gmane.org>
2021-12-17 22:35   ` John MacFarlane
     [not found]     ` <yh480kfsqq2735.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2021-12-18 12:06       ` AW: " denis.maier-NSENcxR/0n0
     [not found]         ` <ee9cbe9414d947799907c62bce1408a8-NSENcxR/0n0@public.gmane.org>
2021-12-18 12:32           ` denis.maier-NSENcxR/0n0
     [not found]             ` <4eb30ae54aea41cd9fdb2aa207f4b96e-NSENcxR/0n0@public.gmane.org>
2021-12-18 19:45               ` John MacFarlane
     [not found]                 ` <m21r297l3x.fsf-d8241O7hbXoP5tpWdHSM3tPlBySK3R6THiGdP5j34PU@public.gmane.org>
2021-12-21  8:51                   ` AW: " denis.maier-NSENcxR/0n0
     [not found]                     ` <c8f145c9d80f470f9adea4e3df82aab4-NSENcxR/0n0@public.gmane.org>
2021-12-21 14:18                       ` BPJ

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