From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32306 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: Lua Filter for \citeauthor and \citetitle in HTML Date: Thu, 09 Mar 2023 13:37:27 +0100 Message-ID: <87pm9i6qmx.fsf@zeitkraut.de> References: <51e71797-b029-4438-be64-6a8a15dd500an@googlegroups.com> <4865a325-42c0-4245-b992-b4fbdeab576en@googlegroups.com> <9786B5A5-9022-4E5B-85DE-39D4A2CAFD8F@gmail.com> <4641cd0b-adb7-408f-b025-f56a0b293be5n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7262"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBK5JU6QAMGQEE6SHR5I-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Mar 09 13:44:33 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-wr1-f63.google.com ([209.85.221.63]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1paFdG-0001fu-Tc for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 09 Mar 2023 13:44:30 +0100 Original-Received: by mail-wr1-f63.google.com with SMTP id l14-20020a5d526e000000b002cd851d79b2sf393191wrc.5 for ; Thu, 09 Mar 2023 04:44:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678365870; cv=pass; d=google.com; s=arc-20160816; b=ADaoaYF4uPX9kA6ke0AIENKwXJmg8JAy8+38ZfmgNaFElOi7264LNi+9p0yfXa5VLG r7GGdysiOTsfRit2wCdI5QHBK281eo28V/K62NUD2hiqXzWQe1+7ksAtbxFoxcXnWRaH TeF3bdWL6fe9mQYQTDAmvOeyfH3q5VZyNvt0aVacyPeczVleTxPBK6P+89DYzmtxkzm7 3go7ajeHQ26vLnUeLh8KyYcRKBlVYW2NKpsgbTfABU4nhgjKNcBxetYAL3SxcAbyKUFL lStR3K0Ffo31vbpfYUugTBPndqzLZboLTAp38YT1+fnTWStpCeojXcGA8CYcG9jqEEwK hJvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:mime-version:message-id :in-reply-to:date:subject:to:from:references:sender:dkim-signature; bh=H2mSlFhIbhK4nOK+3f9T3pvQ5J3DXt1lK59+LCmePQg=; b=luyd0LMhAoWT47mIxI7k6iyLdwOhkqX1aVE2g1uKpphYSmzKKFsXDdbOIWF+HLici1 6LXnbsu1xvBQc5gckQeZYeNqe0AJM13agm2FFdQPMrtZZAYdKdGPsmDZxSbk9akwhfdF k1hXIn3b+j9YasSwZ0xBkS5RnnF8p4FFq8LoGXuqYDCMvMfCJ6A9QmPV+FhEPaBN/LJX OtVtdcIWBqqSl6dDhbm5X/E7ooZPSiYe/uenTh1clmdbOMhcPyMtqkvWhZ+Z3L4ZKsrf zt5bORLOMDOKjzsrp8lmLBJ3B2UAIGEsPw7hbp4gQkehDMNf0XdZmpUGZ3AMozVDKGso WRxg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::201 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; t=1678365870; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :message-id:in-reply-to:date:subject:to:from:references:sender:from :to:cc:subject:date:message-id:reply-to; bh=H2mSlFhIbhK4nOK+3f9T3pvQ5J3DXt1lK59+LCmePQg=; b=MYvRaqmobLWnCeNBewjbAxr6xPKOYAkISekFCv8bnpZrUGvLyOadonf8h2xvK9gXwT /4SKShG/8ezLXUJzmDqDeb+BL4TL+1YSrnIWC9GX6L/RMg2Yk/1155N3+D4cLX5SLXtq bE4TP+QMO3y6DZEeE1q3CNYBZIpKcwKNmuFevuvSkpPwAhiWYczRfc4IETio7IcdEZv2 YUXzdvvLPx9rTbWVu4LK77HbmXi3eVwnUv01VvfQBTk4Q7e5esOv3Cf6a7i8wTX2wRhM zDjztqHxPLJ4GdnY41d99OaZ/tTT/bwMSTtilHhtj/RXGYqVpiDOn+ePh7590dzqNSAa ZPCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678365870; 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-authentication-results:x-original-sender:mime-version :message-id:in-reply-to:date:subject:to:from:references :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to; bh=H2mSlFhIbhK4nOK+3f9T3pvQ5J3DXt1lK59+LCmePQg=; b=w5DZYaFgdvifdXmP4ywd5kKimABXz6PZH5VERetiFYMrROkFtWMkEBVJmtdfUnFiOh M/N8RNYmtZAXW7M4V1xrX/c96Eh86E621bsqThtY89co7CoEcERmbUCZUhNX5LGuIQFR s1VeVNya0TJgB4QzPGiOO6B7fzwSVG7SO2mNvIdgR6mPWpw6etwdi1mcXfwGsu1oyx8Q q1mBfArURTZ8o51y1TtHFX38r+8CsQu/22C1n+6GuVYpkus8f4vmt8onjRvgv8cl8B50 5SLxaHOd4KIYtIPluRfBcOsN9vgtMOYo Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKVNbg3PPcMAqqRxZeAYd86MjnSD/hFQMLJ9QJ+cKrpL/z4MLdWj /MPXZ8d8uVBpFUJoJ5ifoR4= X-Google-Smtp-Source: AK7set8t2DhfWTDvoDJ3Q6mcmverVRw/O7BQgfECj93vUnxX7gQIck845iYsbFhWeDvjlLmqcXkXLA== X-Received: by 2002:a05:600c:41d2:b0:3e2:1a3f:4e9e with SMTP id t18-20020a05600c41d200b003e21a3f4e9emr4832373wmh.3.1678365870453; Thu, 09 Mar 2023 04:44:30 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:600c:3d93:b0:3e1:e754:51ac with SMTP id bi19-20020a05600c3d9300b003e1e75451acls1071271wmb.1.-pod-control-gmail; Thu, 09 Mar 2023 04:44:26 -0800 (PST) X-Received: by 2002:a05:600c:3544:b0:3e8:35a2:6abf with SMTP id i4-20020a05600c354400b003e835a26abfmr18776853wmq.23.1678365866134; Thu, 09 Mar 2023 04:44:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678365866; cv=none; d=google.com; s=arc-20160816; b=kgd135JcOho8NTGP0pv/aDVE3iPRMbYAwxepvj0fHn3exLB6he+pRu4jicOnfbgP4F +x2o0KzKqq0nwe6rw7ns355nIqr3vlsjmM82EtTXd1vWyJbbRWubNquokAwf4XtcY5ju Qjsk/oxk7CflwiTC+IM7uCJT7nn2zFkSglLU7z5Evxz4uF8QPwrCf6XdOcabU5dn9SuS lrB9WJm7xo65Huo8w985NpPLNFA2iDWuY7nd20OvQj00672G7UHEAsGEGrf9G/KNkbY5 9KuWNST6lLh7/HkNcgKaWM4Jsq6pPN3SOB59TZkmjMait8o+Vf9tFQ/U8zrzaCcsSH60 Er2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:message-id:in-reply-to:date:subject:to:from:references; bh=PfNSGFg2d11l2ScGprBfnrZ597J07GXfaHlVOY055hE=; b=zBV8XnmO5pY0egh7/0LF74vOj0UR3hjlbZOGiyl19tlcvneBLfo+Wb0r0jTup2pzxw x8XoLOYalzDPz0athRvo90XBxshaFpx4k1J3Eu5BnAu7qwXi1+Cqm/AOzZzzDOJUiTRO IG5dyfiH9yyczwdzqwtXrvL4Udkj76yZlKETBSWJcSqas804iaVDXS6SAcEE41SE9GcV Kx68WWKOea1bGkNXCUCA5jcnR8p1++4tVPt0Y8EZ9k7W0+HgQG+wAaFfiZVFlWGhoSGr afr62i8Q+mfDI5B3VdTbBj+ATSnjH1MwsyXiZ87DgvoTwYS4Ad7jl9DCRMAOQ3wQF4Vs u/NQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::201 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org. [2001:67c:2050:0:465::201]) by gmr-mx.google.com with ESMTPS id p24-20020a05600c1d9800b003eaedc7aa48si133514wms.0.2023.03.09.04.44.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 04:44:26 -0800 (PST) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::201 as permitted sender) client-ip=2001:67c:2050:0:465::201; Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4PXTQb4wzkz9sSZ for ; Thu, 9 Mar 2023 13:44:23 +0100 (CET) In-reply-to: <4641cd0b-adb7-408f-b025-f56a0b293be5n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Rspamd-Queue-Id: 4PXTQb4wzkz9sSZ X-Original-Sender: albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 2001:67c:2050:0:465::201 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@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:32306 Archived-At: "Bernardo C. D. A. Vasconcelos" writes: > A filter that seems close enough is the bibexport filter at https:// > raw.githubusercontent.com/pandoc/lua-filters/master/bibexport/ > bibexport.lua which I reproduce below: Newer pandoc versions allow to shorten this to ``` function Pandoc (doc) doc.meta.references = pandoc.utils.references(doc) doc.meta.bibliography = nil return doc end ``` Here's a "quick n' dirty" filter that should make your `[@key]{.title}` syntax work: ``` function Pandoc (doc) doc.meta.references = pandoc.utils.references(doc) doc.meta.bibliography = nil return doc:walk{ Span = function (span) -- check that the span contains only a single cite object local cite = span.content[1] local citations = cite and cite.citations or nil if #span.content == 1 and cite.t == 'Cite' and #citations == 1 then local cite_id = citations[1].id local ref = doc.meta.references:find_if( function (r) return cite_id == r.id end ) if ref and span.classes[1] then -- replace the span with a specific citation field return ref[span.classes[1]] end end end } end ``` It's a bit condensed and not well documented, so let me know if you have questions. -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124