From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/29145 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Rory Byrne Newsgroups: gmane.text.pandoc Subject: Re: How can I process custom LaTeX commands? Date: Tue, 31 Aug 2021 03:16:05 -0700 (PDT) Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_808_977003866.1630404965153" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8555"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCW2ZNUJ34JBBZUCXCEQMGQEVA5JEPI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Aug 31 12:16:09 2021 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f59.google.com ([209.85.210.59]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mL0oK-0001zD-UD for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 31 Aug 2021 12:16:08 +0200 Original-Received: by mail-ot1-f59.google.com with SMTP id i7-20020a9d6507000000b0051c10643794sf194422otl.22 for ; Tue, 31 Aug 2021 03:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=n2SVKArbeJBC8mg/AKLYHlDxyCyxmmw/h76ob4SjRu8=; b=LqtZXnI5mIqcTstZ45pf4NGxQ93oT0DgMOrS2r1dXneZs/tj/AM811ZXwql+Riz6eH A0ZzbFb/rjARr7n7UHjMtVsMwzRMbP6jzfhOUSqsto8FoO8jwLRWSyR4mi9SZ20t/O6v APpJpxdSixCmISeln9jgrNpwpTXHsX60tf48htuE+fqz1XGzPyCyUOS4g/ZhA5xUkQfj HkrSQfZx5jrqvp085QspGD8RHhY4vg6LCMPQzo/iYdSK/Y4wFvXcpHBzg2DHxON8jvUG 9a0e7e43XCWfm4jdODBJUJ5YMcNjhROS8PyG446V8CjWHAsY9bhWolr1nWDChaFqeywE edzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rory-bio.20150623.gappssmtp.com; s=20150623; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=n2SVKArbeJBC8mg/AKLYHlDxyCyxmmw/h76ob4SjRu8=; b=nAdRst8iygFUh4MOSgpT7j407goVPtB7qTFMM0Xnvs7wTdF5uul47ZUxsrqiXO+N1d VqPCdPfwAmS0M1YBRwwr+K00KfKF5AtCEIZIO6MhpWsIAoYQtYcymRGuSFTkA8RX55Ox Fm5F0svdgV0sHHLD93dUc+sY8Zzkp/neYDfZN2Jx5/t+6REY8SSRJaXgdM2ueaZ1dbiQ U0Ykh7avVYECPxTifPYNKRy+Es4sRNKsE+E2Qs2Ly2zRahEgXsjXbQ2NBCQIer9xd0ia IIagv7MnyOvY6TBwdByQCoMQvcVr7fehzXIvyVwDNsGlM612d2vXq2wSTG6KN6hdzc67 jI/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=n2SVKArbeJBC8mg/AKLYHlDxyCyxmmw/h76ob4SjRu8=; b=fpjb0Jmp0vNTi0hw90MM7U8vkx1yfWwNxtFjxqg2KB1QsntblTJ8STCgXi4BXSrtcw 86FPkDT5EcScKmEJ5dKSbQ0pTmi2gNWnIBkKiLgdSgnsYAPpiFqvrGhCtNYznU0fBjWv JZ8M7qtDebxLePn5qoWaQhJ2KYTOVkLpRF+x7Shpn96W3yopMY6pkODEMLUgD5NZLub8 YjX/Bp7Q6FqqdLAbBnjcgjA/tgAR570Pj21FuPtN2YFE2UJpBOyq67bsYqiRzAQKXnAd 8xYJMHuQtb1wh1vdSJQ0ugG/T77zOLeWv4+J9HwVkCs7tnia+cRxdH2KlAoSgMXRCHCc gy+g== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM53197gGZktXgq3WY8e9Okg1NbJviPkLxaXtNnhnWSnUUXwTJL5HN +L3LYYNPpMHypOMvuLpsV0c= X-Google-Smtp-Source: ABdhPJwEZm4ycxEuc6GGb2k6gd9kmChL8jfuyN/nLQe9eT1RbAL2ebUNlex5quoPVoROtXJtb4u8cg== X-Received: by 2002:a05:6808:214:: with SMTP id l20mr2614303oie.134.1630404967444; Tue, 31 Aug 2021 03:16:07 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a4a:d1c1:: with SMTP id a1ls1289880oos.4.gmail; Tue, 31 Aug 2021 03:16:06 -0700 (PDT) X-Received: by 2002:a4a:a9ce:: with SMTP id h14mr10150435oon.89.1630404965834; Tue, 31 Aug 2021 03:16:05 -0700 (PDT) In-Reply-To: X-Original-Sender: rory-v7nxjtxOdhc@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:29145 Archived-At: ------=_Part_808_977003866.1630404965153 Content-Type: multipart/alternative; boundary="----=_Part_809_1612591962.1630404965153" ------=_Part_809_1612591962.1630404965153 Content-Type: text/plain; charset="UTF-8" I've found that I can use `+raw_tex` which at least allows me to manually process the custom commands: `pandoc -f latex+raw_tex -F filter.py -t native test.tex` ``` #!/usr/bin/env python from pandocfilters import Para, Str, toJSONFilter def foo(key, value, format, meta): if key == 'RawBlock': return Para([Str(value[1])]) if __name__ == "__main__": toJSONFilter(foo) ``` If there's any other approach to this kind of thing then I'd love to hear it! On Tuesday, 31 August 2021 at 08:39:04 UTC+1 Rory Byrne wrote: > Hi friends, > > I am building a LaTeX package which adds some new annotation commands for > semantics, like `\argument{...}` or `\conclusion{...}`. I'm brand new to > Pandoc, but I would like to parse a LaTeX file containing these commands > into JSON output. > > I was thinking that I could write a Pandoc filter which would process > those commands, but that doesn't seem possible. > > Is there a way to use Pandoc to process a LaTeX file containing custom > commands? > > Thanks, > Rory > -- 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/bce57945-4313-4da1-a12f-8c290c709c94n%40googlegroups.com. ------=_Part_809_1612591962.1630404965153 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I've found that I can use `+raw_tex` which at least allows me to manua= lly process the custom commands:

`pandoc -f latex+= raw_tex -F filter.py -t native test.tex`

```
=
#!/usr/bin/env python
from pandocfilters import Para, Str, t= oJSONFilter

def foo(key, value, format, meta)= : 
    if key =3D=3D 'RawBlock':
        return Para([Str(value[1= ])])

if __name__ =3D=3D "__main__":
    toJSONFilter(foo)
```

If there's any other approach to this kind of thing then I'd love to hear= it!

On Tuesday, 31 August 2021 at 08:39:04 UTC+1 Rory Byrne wrote:
Hi friends,=

I am building a LaTeX package which adds some new= annotation commands for semantics, like `\argument{...}` or `\conclusion{.= ..}`. I'm brand new to Pandoc, but I would like to parse a LaTeX file c= ontaining these commands into JSON output.

I = was thinking that I could write a Pandoc filter which would process those c= ommands, but that doesn't seem possible.

Is th= ere a way to use Pandoc to process a LaTeX file containing custom commands?=

Thanks,
Rory

--
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/bce57945-4313-4da1-a12f-8c290c709c94n%40googlegroups.= com.
------=_Part_809_1612591962.1630404965153-- ------=_Part_808_977003866.1630404965153--