From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/31729 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mladen Babic Newsgroups: gmane.text.pandoc Subject: Re: Pandoc Citeproc doesn't work on HTML format Date: Thu, 10 Nov 2022 06:09:57 -0800 (PST) Message-ID: References: <8e24d40c-5977-4912-9e1b-6cfa0f66d5e5n@googlegroups.com> <87v8nqon26.fsf@zeitkraut.de> <87r0ydoo0n.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1540_1813066743.1668089397580" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9520"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCFIND536APBBNUMWSNQMGQEDBVSF7I-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Nov 10 15:10:03 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f62.google.com ([209.85.210.62]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ot8Fm-0002EX-Es for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 10 Nov 2022 15:10:02 +0100 Original-Received: by mail-ot1-f62.google.com with SMTP id 33-20020a9d0124000000b0066adf5218b2sf958950otu.10 for ; Thu, 10 Nov 2022 06:10:02 -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=l4op8G5vLbQP5+NUC48BTlpqgioLxgk3k+OfKDteHNA=; b=NeZh+9DB8YdcNARkRrjOrVH1fGK93Q3H7wrF4y5Vt/x1mFOVYXe8LeXutyVpjkLMQf PHB153RNVMzRZd96SVm/3t37CuDdytoUskvRticNLUu8nsz5g3L+fKwKHUn2KQXTL3qE p6yW1PAat1xAipVnWx4hLKuYzTA8vd9fQYYtKqAPbu9WMbDRUQRnmVbDFEVtJC68uMX2 ROBFhqhkR1tsXUnSlq4SCRpYUlGvU/JznKCcqdKSR2A9CUMPYbWYGeMeu5Ytxxr6PJUj KW/GfoY64iX7raLoYe7VsMf1C9pR7Bg+FT9TBxvIByy8PJoOESBdQbax3DHNY/VbdDAN fdaQ== 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=l4op8G5vLbQP5+NUC48BTlpqgioLxgk3k+OfKDteHNA=; b=hCmHbng9cGzjKhqw967OYXYzK8spPMiR894phO1uBJYrnXrO96uz7BTEXwTl4CmwGp zI+Z1HsuqqC2i3ijibqOEpvwEgOOv0klpssUhavmR41WGjeK9WayMZ+9LOVtagS5ZkFO tl9QNN5YPdNbkEzXz9dNohMhKDYxDt+qQfNnGsZI4bRkdHH2FpXfEWbt+o/KDqu98bln N0wDexN6rTd8HRdqBhsgzwjFMNpIQnklQX/NiukJbi7tVoCgbzOSIpeMLL5ywmx/0oBO kOAElXZt7qugR8SS6C716KvYQ9S9IvAEo57eltLSd0HbpoVvmY3ywkjXQAh8FB+DAuzr dPGA== 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=l4op8G5vLbQP5+NUC48BTlpqgioLxgk3k+OfKDteHNA=; b=PEYAJXqc7CSSg9Ofu2br11IhMQIDUppWLrsYW0ZJfiqclJiMWMjZe2v/csLlmxwLO2 PgUxFssTeuah42Q0NshyKd259C4R/wtYLzuh43H/fLXX7Jc7tUM5rbGZd6IdBZHHxjKl lRI1NWLvp04rICE/MDE6GtbNWE3cnLqbsmkXe9cZAJNr4FpKEbFvIe8lJtbKiu5xtYwB PDHkyjQ5LmmatmEnnXxurK10yHkTi0F5zgms18lAU2ZEgkclHaFWPeYkWwrXJBxYLze0 JnAd5Uz+goDhyG1SmOssYAaNEvuRyeY8uFSmkfrHC7IWjDpWaA0Nq6qzKGiEe1Sba41b KWbg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ACrzQf0jJrrv6IWsnyZD9IL+qZrGHn0n1pA2BppsVLcr5xP2wT15Uo6A pffkC78xvzsipXy/buYio+A= X-Google-Smtp-Source: AMsMyM4L5iS7eC9yaZ+3YOO1McdlRVryWIsEKmC/2lN6dVf/wcPssUYivvbQTUQJi0vyP03p6WxcSw== X-Received: by 2002:a4a:d747:0:b0:49b:e24d:8e0e with SMTP id h7-20020a4ad747000000b0049be24d8e0emr21439621oot.18.1668089401279; Thu, 10 Nov 2022 06:10:01 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a54:4f98:0:b0:35a:8a2b:e9f1 with SMTP id g24-20020a544f98000000b0035a8a2be9f1ls523704oiy.8.-pod-prod-gmail; Thu, 10 Nov 2022 06:09:58 -0800 (PST) X-Received: by 2002:a05:6808:182a:b0:35a:4d28:e71c with SMTP id bh42-20020a056808182a00b0035a4d28e71cmr20047129oib.43.1668089398350; Thu, 10 Nov 2022 06:09:58 -0800 (PST) In-Reply-To: X-Original-Sender: mladen.babic-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:31729 Archived-At: ------=_Part_1540_1813066743.1668089397580 Content-Type: multipart/alternative; boundary="----=_Part_1541_54685394.1668089397580" ------=_Part_1541_54685394.1668089397580 Content-Type: text/plain; charset="UTF-8" Thanks all for the feedback. It would be nice to have citeproc for HTML too. I guess it won't take too much effort for it. In the meantime, I would like to create some Lua filters that will cover several cases but I'm a newbie to Lua. I created a case for the first case [@test1], but I'm not able to implement for i.e [@test1; @test2]. How can I return a list of cites? This is my Lua filter: function Str(el) local citekey = el.text:match("[[]@(%w+)[]]") if citekey then local citation = pandoc.Citation(citekey, 'NormalCitation') return pandoc.Cite({pandoc.Str(citekey)}, {citation}) end end Any help will be appreciated. Thanks On Tuesday, November 8, 2022 at 10:22:05 AM UTC+1 wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org wrote: > Re this: > > > Ok, I probably missed in the Pandoc citeproc doc that doesn't mention > that supports only MD, so I thought it would work for all formats with > pattern @test. > > The @test citation syntax is defined under the citations extension > (with target > 'extension-citations'). This is within the 'Pandoc's Markdown' section and > so perhaps applies only to markdown. > > However, there's another citations extension > (with target > 'org-citations') in the 'Extensions -> Other extensions' section, and this > describes its usage within org and docx documents. > > This little shell script illustrates that the 'citations' extension is > supported for docx, ipynb, jats, markdown (+variants), opml and org, and is > enabled by default for markdown, opml and org. > > % for i in $(pandoc --list-input-formats); do echo -n $i:; pandoc > --list-extensions=$i | grep citations || echo; done | grep ':.citations' > docx:-citations > ipynb:-citations > markdown:+citations > markdown_github:-citations > markdown_mmd:-citations > markdown_phpextra:-citations > markdown_strict:-citations > opml:+citations > org:+citations > > So I think that (not surprisingly?) the 'citations' syntax supported by a > given input format (if supported) is a function of that input format. The > supported format is clear for markdown (+variants?), org and docx but > perhaps not for ipynb and opml. > > I think that it might be useful to clarify some of this in the man page? > Please let me know if I should create an issue. > > On Tue, 8 Nov 2022 at 08:21, Albert Krewinkel > wrote: > >> >> Mladen Babic writes: >> >> > What I actually want to do is when the user uploads the DOCX file, >> > Pandoc converts the file to HTML and shows it to the HTML editor for >> > additional editing by the user and converts it back to DOCX. >> > After converting to Html, the system (my app) will replace current >> > cites in HTML cite i.e. [1] with the key from the .bib file (like in >> > my case [@test1] so the citeproc will know how to process it. >> >> That's an interesting use case. I don't have any immediate ideas; going >> via Markdown might be the best option. >> >> But please make sure to also checkout [OS-APS], an open-source >> project that uses pandoc for some of the document conversions. Going >> from your description it sounds like it could be exactly what you need. >> I've added Frederik from that org to CC, he may be able give more info. >> >> [OS-APS]: https://os-aps.de >> >> -- >> Albert Krewinkel >> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 >> >> -- >> 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/87r0ydoo0n.fsf%40zeitkraut.de >> . >> > -- 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/b4d87a5f-0eaf-4cfb-82cd-5699aad36402n%40googlegroups.com. ------=_Part_1541_54685394.1668089397580 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks all for the feedback. 

It would be nice to h= ave citeproc for HTML too. I guess it won't take too much effort for it. In= the meantime, I would like to create some Lua filters that will cover seve= ral cases but I'm a newbie to Lua. 
I created a case for the= first case  [@test1], but I'm not able to implement for  i.e [@t= est1; @test2]. How can I return a list of cites?

This is my Lua filt= er:

function Str(el)
local citekey =3D el.text:match("[[]@(= %w+)[]]")
if citekey then
local citation =3D pandoc.Citation(citekey, 'NormalCitation')
return pandoc.Cite({pandoc.Str(citekey)},
{citation})
endend


Any help will be ap= preciated. 

Thanks



On Tuesday, November 8, 2022 at 10:22:05 AM UTC+1 wlu...@broadband-foru= m.org wrote:
<= div dir=3D"ltr">Re this:

> Ok,= I probably missed in the Pandoc citeproc doc that doesn't mention that sup= ports only MD, so I thought it would work for all formats with pattern @tes= t.

The @test citat= ion syntax is defined under the citations extension (with targ= et 'extension-citations'). This is within the 'Pandoc's Markdown' section a= nd so perhaps applies only to markdown.

Howev= er, there's another citations extension (with target 'org-citations') in t= he 'Extensions -> Other extensions' section, and this describes its usag= e within org and docx documents.

This little shell= script illustrates that the 'citations' extension is supported for docx, i= pynb, jats, markdown (+variants), opml and org, and is enabled by default f= or markdown, opml and org.

% for i in $(pandoc --l= ist-input-formats); do echo -n $i:; pandoc --list-extensions=3D$i | grep ci= tations || echo; done | grep ':.citations'
docx:-citations
ipynb:-cit= ations
markdown:+citations
markdown_github:-citations
markdown_mmd= :-citations
markdown_phpextra:-citations
markdown_strict:-citationsopml:+citations
org:+citations

So I think tha= t (not surprisingly?) the 'citations' syntax supported by a given input&nbs= p;format (if supported) is a function of that input format. The supported f= ormat is clear for markdown (+variants?), org and docx but perhaps not for = ipynb and opml.

I think that it might be usefu= l to clarify some of this in the man page? Please let me know if I should c= reate an issue.

On Tue, 8 Nov 2022 a= t 08:21, Albert Krewinkel <albert...-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> wrote:

Mladen Babic <mlade= n...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> What I actually want to do is when the user uploads the DOCX file,
> Pandoc converts the file to HTML and shows it to the HTML editor for > additional editing by the user and converts it back to DOCX.
> After converting to Html, the system (my app) will replace current
> cites in HTML cite i.e. [1] with the key from the .bib file (like in > my case [@test1] so the citeproc will know how to process it.

That's an interesting use case. I don't have any immediate ideas; going
via Markdown might be the best option.

But please make sure to also checkout [OS-APS], an open-source
project that uses pandoc for some of the document conversions. Going
from your description it sounds like it could be exactly what you need.
I've added Frederik from that org to CC, he may be able give more info.

[OS-APS]: https://os-aps.de

--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124

--
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-discus.= ..@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pand= oc-discuss/87r0ydoo0n.fsf%40zeitkraut.de.

--
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/b4d87a5f-0eaf-4cfb-82cd-5699aad36402n%40googlegroups.= com.
------=_Part_1541_54685394.1668089397580-- ------=_Part_1540_1813066743.1668089397580--