From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31710 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jcr Newsgroups: gmane.text.pandoc Subject: Re: command-line pandoc on iOS Date: Mon, 7 Nov 2022 08:56:13 -0800 (PST) Message-ID: <626e5a36-6440-4be0-a5f6-9910f551ffc0n@googlegroups.com> References: <5346511C-4B5D-42E9-B287-DB005CB4D005@gmail.com> <8FB22757-A6A4-432C-80F3-E770F0567E89@gmail.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_9460_1368277637.1667840173223" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18425"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDQLFNXWVILBBLXRUSNQMGQECNQEODA-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Nov 07 17:56:19 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oi1-f192.google.com ([209.85.167.192]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1os5Q2-0004aJ-Nf for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 07 Nov 2022 17:56:18 +0100 Original-Received: by mail-oi1-f192.google.com with SMTP id o12-20020a056808124c00b00353f308fb4bsf4752437oiv.22 for ; Mon, 07 Nov 2022 08:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=EBIordTJFeM/6yG4b5dmcYnlNfyA5aydBUAuVHBpPrg=; b=UgGkeaVUWibRkyX42pTqqWCh9yXQU0TtDtFMo4FtUoevnoclUSpjdeRVxpBbKVriSe xUNGJU3jHJ87/GniaO2Rlh+7qWixW4AGirZKbV16dbqU8NbZRYmqetTAz9Rbre2shypf r4UrQb5xkoTezVRqPCjK0CWKIzUhPN9CJPrwrkoHEFYxnwKHglXLK7uMdN0g7mEY999b S6eQxtwBq+OKc2lNLP031svJPOWQNxD8KdqFD4mCUF2NPUEIRrpv9SgvJkTfwhnm8J/3 wFoUbY69byY3NDUi91SajbxCsySLNHh2fdYUqgsx6aMywkDm0kXxkPl6hmK+rPsmVJ5L dsrQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=EBIordTJFeM/6yG4b5dmcYnlNfyA5aydBUAuVHBpPrg=; b=SYezOTl4ZT9tUbA1K3G59FG2TeY98ZpbOrJmYvycfPgq0zGBxsWNijqSkWjiRY9IIY cJLbZNfRiyuEF+/g08RgtjuWLqrBRq/KqLhAD9QxsCn6E9FlE1NWcedw1kRBBX77Utfp DX18ExMCv15JarItzjbva0Mj1sDGCEHUKIOMeII2VUKTZOyxerIyKo3XMDMzCelckQ7W Ke+p7Laaje94YBGwtHM693lsLvF8+GAxLqkI4K6NLqwyf0ddjgfDTE0DE6KV+GmQog7X tT46qiVLMbfEuJRsyrBvAfgo8vNmtFR5mV4MSoTYchS4Pbxt2LGd7eltZuBFC4dIXdjJ GmIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=EBIordTJFeM/6yG4b5dmcYnlNfyA5aydBUAuVHBpPrg=; b=ClCY6ByMX800xfx64GRE18jbMvGDQnYfgryggcD5BXg0GwgqZyCirIsMFmrROkYo8H lf1U6me5j99enawmdexK/eo81SeBd1j3qYYUocuwLNzkl36ZZf2MAg7UFMZ6MFk93DOs 73EnY5gxGMB4VLRHFCoNjx7XYRCVT+FAHjcKUCWHHFehXnGJDLqq/qKpDAGS9ZtsKikn xrXGqGdvUtyYGxQ4UwWYCoBv+C+nGIbW+OR6TUzcwxSYCq3G4sHIuUzCC/RflZIdVzxO hy9rljBHAV2Z5RE4yC6Bt4pIa/+kgfFuYWWZNUG/S33CnSCdVxQ9qP2joHsQOI55au4+ juiQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf268RkKLN1Tqju2Lztt+ws7Wiu7rutY+sJHJ4dgAZo6yo1iQByE O25g+BuLEs0o8mOQHkq7mbI= X-Google-Smtp-Source: AMsMyM7Pv8wt3zn96JDD7WA0IJZruxWwYDuqg69IZmQNXJ/QEevGMcetsiauL2aUk5TGi4b7a0XDFQ== X-Received: by 2002:a05:6808:151:b0:35a:dba:1163 with SMTP id h17-20020a056808015100b0035a0dba1163mr22680982oie.89.1667840177547; Mon, 07 Nov 2022 08:56:17 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:93d5:b0:132:a931:6a46 with SMTP id c21-20020a05687093d500b00132a9316a46ls3959299oal.9.-pod-prod-gmail; Mon, 07 Nov 2022 08:56:14 -0800 (PST) X-Received: by 2002:a05:6870:7885:b0:13d:9452:c9dd with SMTP id hc5-20020a056870788500b0013d9452c9ddmr14316519oab.189.1667840174093; Mon, 07 Nov 2022 08:56:14 -0800 (PST) In-Reply-To: <8FB22757-A6A4-432C-80F3-E770F0567E89-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> X-Original-Sender: ffi.appdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:31710 Archived-At: ------=_Part_9460_1368277637.1667840173223 Content-Type: multipart/alternative; boundary="----=_Part_9461_2102084259.1667840173223" ------=_Part_9461_2102084259.1667840173223 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've looked at this a couple of times since I last wrote. It turns out the= =20 latest Docker image is 2 years old, and apparently=20 contains pandoc 2.9.2.1. So it looks like I have to do the full pandoc build with ahc-cabal. I=20 installed the prerequisites, and started following the instructions to=20 build Asterius, but immediately hit a snag when it asked me to run a script= =20 that isn't provided in the repo. It turns out the project now uses bazel,= =20 whatever that is, but the person who discovered this ran it and found that= =20 he couldn't execute the resulting binaries (see Asterius issue 894=20 ). So I don't feel encouraged= =20 to follow his example. I've had the idea of writing a stub in Python that would parse pandoc=20 command line arguments and then use pandoc-server to do the actual=20 processing. I'd just ignore options like -L that can't be implemented this= =20 way. It wouldn't be a great solution, but it would be adequate for some=20 cases. If I do that, Lua filter support in pandoc-server would be very useful=20 (most of my filters are indeed safe), but I see from the referenced issue= =20 that it's not coming soon. On Monday, October 17, 2022 at 4:47:08 PM UTC+2 fiddlosopher wrote: > If we could implement > https://github.com/jgm/pandoc/issues/8273 "safe mode for Lua filters" > then we could add Lua support to pandoc-server. (Of course, this assumes= =20 > that > you wouldn't need to use any unsafe functions in your Lua filters.) > > > > On Oct 17, 2022, at 2:15 AM, ffi.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote: > >=20 > > I was playing around with pandoc-server before I decided I needed the= =20 > command-line program. It would work for some cases, but without Lua=20 > scripting, it wouldn't be adequate for the document builds. In theory, I= =20 > could use pandoc-server to convert to a JSON AST, run a filter locally, a= nd=20 > then send it back to the server for the next stage of conversion, but tha= t=20 > seems slow and conplex. > >=20 > > I probably won't work quickly on building pandoc with Asterius. > >=20 > >> On Oct 16, 2022, at 7:58 PM, John MacFarlane =20 > wrote: > >>=20 > >> =EF=BB=BFThis would be cool, so let us know if you have any success wi= th=20 > asterius. I haven't tried it myself. If you run into Haskell-specific=20 > problems, let us know and perhaps we can help. > >>=20 > >> Note: for your iPad purposes, another alternative would be to run=20 > pandoc as a server somewhere. This is now very easy with `pandoc-server`.= =20 > It is fairly full-featured, with the caveat that it runs in "safe mode," = so=20 > you have to explicitly send all resources needed for compilation to the= =20 > server (it won't be able to look for them on your local file system). > >>=20 > >>> On Oct 16, 2022, at 8:20 AM, jcr wrote: > >>>=20 > >>> I would like to be able to run pandoc-based document builds on an=20 > iPad. This seems to be possible with the [a-Shell app]( > https://holzschu.github.io/a-Shell_iOS/). It provides a Unix-like shell= =20 > with LaTeX (additional 1.3GB download), Python, Lua, and many command lin= e=20 > utilities. C and C++ programs can be compiled to WebAssembly on the devic= e=20 > and run there. It is also possible to cross-compile for a-Shell, using a= =20 > [customized WASI-SDK](https://github.com/holzschu/wasi-sdk). > >>>=20 > >>> [Asterius](https://github.com/tweag/asterius) compiles Haskell to=20 > WebAssembly, and there are a couple of demos that use it to run pandoc in= a=20 > webpage, but the WebAssembly files they use offer a simple JavaScript=20 > interface to the Haskell pandoc function: (input, from format, to format)= =20 > -> output. I need the full command line interface to run document builds.= =20 > It looks possible, but since I've never used Haskell, its build tools, or= =20 > WASI-SDK, I'm not sure how to go about this. There's a pre-built Docker= =20 > container for Asterius with about 2000 packages from Stockage (I think I= =20 > can guess what that is), but I don't know if I can use that, or if I have= =20 > to rebuild everything from scratch using the customized WASI-SDK. After= =20 > that, I guess I would download the pandoc source and follow the=20 > instructions for building it with cabal, using `ahc-cabal` in place of=20 > `cabal`. But if anything goes wrong with the cabal build, I'll be lost. > >>>=20 > >>> Has anyone already done this? > >>>=20 > >>>=20 > >>> --=20 > >>> You received this message because you are subscribed to the Google=20 > Groups "pandoc-discuss" group. > >>> To unsubscribe from this group and stop receiving emails from it, sen= d=20 > an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >>> To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/pandoc-discuss/bfa54f4a-eedc-4e8e-8671-= 1aa9f6c63e1dn%40googlegroups.com > . > >>=20 > >> --=20 > >> You received this message because you are subscribed to a topic in the= =20 > Google Groups "pandoc-discuss" group. > >> To unsubscribe from this topic, visit=20 > https://groups.google.com/d/topic/pandoc-discuss/ivgH7zNPlNs/unsubscribe. > >> To unsubscribe from this group and all its topics, send an email to=20 > pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > >> To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/pandoc-discuss/5346511C-4B5D-42E9-B287-= DB005CB4D005%40gmail.com > . > >=20 > > --=20 > > You received this message because you are subscribed to the Google=20 > Groups "pandoc-discuss" group. > > To unsubscribe from this group and stop receiving emails from it, send= =20 > an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/pandoc-discuss/ADB72C63-745E-4D50-9045-= E60813FA08EB%40gmail.com > . > > --=20 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 e= mail 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/626e5a36-6440-4be0-a5f6-9910f551ffc0n%40googlegroups.com. ------=_Part_9461_2102084259.1667840173223 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've looked at this a couple of times since I last wrote. It turns out= the latest Docker image is 2 years old, and apparently contains pandoc 2.9.2.1.

So it looks like I have to do the full pandoc build with a= hc-cabal. I installed the prerequisites, and started following the instruct= ions to build Asterius, but immediately hit a snag when it asked me to run = a script that isn't provided in the repo. It turns out the project now uses= bazel, whatever that is, but the person who discovered this ran it and fou= nd that he couldn't execute the resulting binaries (see Asterius issue 894). So I don't f= eel encouraged to follow his example.

I've had= the idea of writing a stub in Python that would parse pandoc command line = arguments and then use pandoc-server to do the actual processing. I'd just = ignore options like -L that can't be implemented this way. It wouldn't be a= great solution, but it would be adequate for some cases.
If I do that, Lua filter support in pandoc-server would be very= useful (most of my filters are indeed safe), but I see from the referenced= issue that it's not coming soon.

On Monday, October 17, 202= 2 at 4:47:08 PM UTC+2 fiddlosopher wrote:
If we could implement
https://gith= ub.com/jgm/pandoc/issues/8273 "safe mode for Lua filters"
then we could add Lua support to pandoc-server. (Of course, this assum= es that
you wouldn't need to use any unsafe functions in your Lua filters.)


> On Oct 17, 2022, at 2:15 AM, ffi.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
>=20
> I was playing around with pandoc-server before I decided I needed = the command-line program. It would work for some cases, but without Lua scr= ipting, it wouldn't be adequate for the document builds. In theory, I c= ould use pandoc-server to convert to a JSON AST, run a filter locally, and = then send it back to the server for the next stage of conversion, but that = seems slow and conplex.
>=20
> I probably won't work quickly on building pandoc with Asterius= .
>=20
>> On Oct 16, 2022, at 7:58 PM, John MacFarlane <fiddlo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>=20
>> =EF=BB=BFThis would be cool, so let us know if you have any su= ccess with asterius. I haven't tried it myself. If you run into Haskel= l-specific problems, let us know and perhaps we can help.
>>=20
>> Note: for your iPad purposes, another alternative would be to = run pandoc as a server somewhere. This is now very easy with `pandoc-server= `. It is fairly full-featured, with the caveat that it runs in "safe = mode," so you have to explicitly send all resources needed for compila= tion to the server (it won't be able to look for them on your local fil= e system).
>>=20
>>> On Oct 16, 2022, at 8:20 AM, jcr <ffi.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>>>=20
>>> I would like to be able to run pandoc-based document build= s on an iPad. This seems to be possible with the [a-Shell app](https://holzschu.github.io/a-She= ll_iOS/). It provides a Unix-like shell with LaTeX (additional 1.3GB do= wnload), Python, Lua, and many command line utilities. C and C++ programs c= an be compiled to WebAssembly on the device and run there. It is also possi= ble to cross-compile for a-Shell, using a [customized WASI-SDK](https://github.com/holzschu/wasi-sdk<= /a>).
>>>=20
>>> [Asterius](
http= s://github.com/tweag/asterius) compiles Haskell to WebAssembly, and the= re are a couple of demos that use it to run pandoc in a webpage, but the We= bAssembly files they use offer a simple JavaScript interface to the Haskell= pandoc function: (input, from format, to format) -> output. I need the = full command line interface to run document builds. It looks possible, but = since I've never used Haskell, its build tools, or WASI-SDK, I'm no= t sure how to go about this. There's a pre-built Docker container for A= sterius with about 2000 packages from Stockage (I think I can guess what th= at is), but I don't know if I can use that, or if I have to rebuild eve= rything from scratch using the customized WASI-SDK. After that, I guess I w= ould download the pandoc source and follow the instructions for building it= with cabal, using `ahc-cabal` in place of `cabal`. But if anything goes wr= ong with the cabal build, I'll be lost.
>>>=20
>>> Has anyone already done this?
>>>=20
>>>=20
>>> --=20
>>> You received this message because you are subscribed to th= e Google Groups "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails f= rom it, send an email to pandoc-= discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/bfa5= 4f4a-eedc-4e8e-8671-1aa9f6c63e1dn%40googlegroups.com.
>>=20
>> --=20
>> You received this message because you are subscribed to a topi= c in the Google Groups "pandoc-discuss" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pandoc-discuss/ivg= H7zNPlNs/unsubscribe.
>> To unsubscribe from this group and all its topics, send an ema= il to pandoc-discus...@googlegro= ups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5346511C-4B5D-42E9-B287-= DB005CB4D005%40gmail.com.
>=20
> --=20
> 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..= .@googlegroups.com.
> To view this discussion on the web visit ht= tps://groups.google.com/d/msgid/pandoc-discuss/ADB72C63-745E-4D50-9045-E608= 13FA08EB%40gmail.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/626e5a36-6440-4be0-a5f6-9910f551ffc0n%40googlegroups.= com.
------=_Part_9461_2102084259.1667840173223-- ------=_Part_9460_1368277637.1667840173223--