From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32333 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Albert Krewinkel Newsgroups: gmane.text.pandoc Subject: Re: help filtering links Date: Mon, 13 Mar 2023 16:40:44 +0100 Message-ID: <874jqo7j27.fsf@zeitkraut.de> References: <878rg07pwn.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23520"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-X-From: pandoc-discuss+bncBCZJF7XJTILRBR4JXWQAMGQEOY4WDTI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mon Mar 13 16:44:12 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-lj1-f187.google.com ([209.85.208.187]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pbkLL-0005qn-NL for gtp-pandoc-discuss@m.gmane-mx.org; Mon, 13 Mar 2023 16:44:11 +0100 Original-Received: by mail-lj1-f187.google.com with SMTP id f4-20020a05651c160400b002959ea5bc51sf3736482ljq.9 for ; Mon, 13 Mar 2023 08:44:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1678722251; cv=pass; d=google.com; s=arc-20160816; b=GJoO6jk//xyPVsDPodlliArFnsWYXgx7URnP6MGXyroDFs7XxlBytAcu13fml+NuRT ebbalMAI/cSCZGxpJcF6g3/f5Ez8kfbzphkW2c6TeMO8tDm5KArJkzJI1IXd8DSgrHsn 26LbFlkvJdtF/hbcVoGoKRr0peL4sDlul/P1SFI55XXKYcGB1O4t+Z/QQCL/thIHsKHG CBmAVJoGa5KOX/CVhBeeXYlBjz5ZBws7peAbF2JICJYYuKbd+g+uTH7bu3/EMCxmdIhy yY/ommY23onfkpkcIsmukViMkBwRdn1jzi0TqG6u8cG/qp7VETl8Nky88j9Kasdn3Cxb Spaw== 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:content-transfer-encoding :mime-version:message-id:in-reply-to:date:subject:to:from:references :sender:dkim-signature; bh=5iFMS/sCYPRYiLeHqTHBrr7061pn+4MwnLE6mjQP67Y=; b=U71++POuqbNUJqOIIW09p9IBYCeW/SMUByXmgx0VX04rAGQp7nI56yDkeUaFE1abAe k9fYpuiZw/oqSYf7u1QpcpzpkmaLuvUaynqrLc4smPTTfw92GaQTtpFdgTMrFJeDEpK0 gcm5O2L2O26sKktgH5RJvqP2TI3V1K4voL71zXp0IxWpSgo3pQIKpo9wWyg089a8wZuG vyRrIZlW2jjrLcKWkz66u5qeYjuiSu6NeZwaQtCnTJlyh9Y7cebCK5Lt4b9W0zmTCtWG f3UTkcZRVSOr45aPIzMTAGgowraU0sxt7JmltMRF8pz20cVujW6VG4FxEZuvNn1nTyPD WQOQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.152 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=1678722251; 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 :content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:references:sender:from:to:cc:subject:date :message-id:reply-to; bh=5iFMS/sCYPRYiLeHqTHBrr7061pn+4MwnLE6mjQP67Y=; b=GcGRjnNgoOaPI8IdXmTSrKCh9Tckuff2yKKC4IeWbG0CTJJ8yOCwvXk2mSTuZu+uci NLHwhnU1X65Fkwd6l5Rfok/gaJ68sATnIVypjxKWY/2tZnf1fHU12Uz4zADM4UYaz3er 2cLPqVwDllXcBlbE1IvrQe74pdAlxSFSGWBxlCak0bCmqx8XQk+cwLyg8yloYIn0N30l pdLSmc4ABgl4EL9dP5GddHdtbuHansquCGTA+44JxJ7DfcDpkxmM16z7DBJiB61Id+dQ AZRejuorXuaStrDtyaLvvu3tvoOI5c4lEU/5nlNiE4qXuBP40P2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678722251; 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 :content-transfer-encoding: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=5iFMS/sCYPRYiLeHqTHBrr7061pn+4MwnLE6mjQP67Y=; b=bFEsA+4BHqUNFBF7k6iyiDFYoWx0BnP2gZ3Nli78RXcTeO0f4/pi16ws810bCvzrz6 xO70NI3/RPHFNdkFsmiSfHYSxVRK0dHTHSN8kwYZXKGJsLyDT8PW+v/vDgWhWzH+Zyc4 JlxYWquME5bn7+KrNi2XqT61WGqNj40UGSllx/dA8plCYXawZp8eswNi5YYk1IvM/nJ5 kH+lTkCHGEPyHOqiFxRaIwuATIsoIDc4sDSELg3VH19dwAJ7nFW4WsF6Qa5UXTkLMuw3 mw5eBk Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKWDW5DA2V50L4GAnBbAqUH21K1CqnRnJUAw5XfmRILD4F7ua71r mi6GSXYF+g8uGBYDMuL5C7g= X-Google-Smtp-Source: AK7set99zZwI5Zpy58SiOtz/vQgpf0ipXYvVnywftqb0wFEIjmYVAVRpK5yhRtlSdQEDswzb8X9m0A== X-Received: by 2002:a2e:aa1c:0:b0:293:4ed3:a404 with SMTP id bf28-20020a2eaa1c000000b002934ed3a404mr10716148ljb.2.1678722250963; Mon, 13 Mar 2023 08:44:10 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a2e:9e53:0:b0:295:b860:7804 with SMTP id g19-20020a2e9e53000000b00295b8607804ls2074447ljk.5.-pod-prod-gmail; Mon, 13 Mar 2023 08:44:06 -0700 (PDT) X-Received: by 2002:a05:651c:213:b0:295:b0bf:d1e1 with SMTP id y19-20020a05651c021300b00295b0bfd1e1mr10141465ljn.23.1678722246005; Mon, 13 Mar 2023 08:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678722245; cv=none; d=google.com; s=arc-20160816; b=xKfHRna7qk67RCX5JYX0n81HfodtWhuDRwthHYM620NaeJEsDMPYkLM5/pALkHbxOI M9XoD4ppwNZPDQZNLE+AuVwp33ZQtRt0LAKpFK5OKHb3rpCFuHhCPu/NesGSpY83JDeD 2Z81X1zlzL+7TWPfz+gxf3vKw/B0zYpPUy64MM2ivCjzTXT86tAtZA92X+RdtKySRwTZ 4ccxj1bCbrsXR2K8vXjK/djgvPwMpzLqd+sSIpW0y9fG0QGrKUlA7xx10GK8gzEmJDv3 3ma4YL6+XS1yUHTLAu5HfSjZK7SYQVeIUvwuEYtCpOwxRsY0JI8uJGemFlZrXUbNHBE3 osPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:to:from:references; bh=W9YMod0abZfFnTvYi5QLoSDbDXEAKgNE4gotKyL30JQ=; b=dMdgw8E566O89B6vldOKKRodMW7gRzl5keXgkGsg44QWXoZypTma1y4jSFGEidYNZ6 fKsp8exjw9x0EDmX+6uxKXgg5VmOVH+nhbkv1CdUCanC7gA9O3clXRyO2eCpb8YQyIG4 9vUqIZr8dJAhw8ut/R1hF6FpkRuY1YPOcCqPgSQWFogcRAOLYoetdDM+FtSjlPvkFmo0 1KbnQlSOm3XrPcK2/PNt7F8NHK+zTG43o02w46tstHPFE97+F1g1WGURdGIZgzvZzmg8 ScV3H5pTVNi5uZFCvCwE+OwD7yfrDPHh0m4p4KULNXxfjWOUp9lpHgfQpT8zRxvLoSS5 x1BQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.152 as permitted sender) smtp.mailfrom=albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org Original-Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org. [80.241.56.152]) by gmr-mx.google.com with ESMTPS id f7-20020a05651c160700b00295a255ee26si11796ljq.6.2023.03.13.08.44.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Mar 2023 08:44:05 -0700 (PDT) Received-SPF: pass (google.com: domain of albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org designates 80.241.56.152 as permitted sender) client-ip=80.241.56.152; Original-Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.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-102.mailbox.org (Postfix) with ESMTPS id 4Pb1D31QvYz9skN for ; Mon, 13 Mar 2023 16:44:03 +0100 (CET) In-reply-to: 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 80.241.56.152 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:32333 Archived-At: Pablo Rodr=C3=ADguez writes: > On 3/13/23 14:13, Albert Krewinkel wrote: >> Pablo Rodr=C3=ADguez writes: >>> [...] >>> The first one would be an internal section link, the second one would b= e >>> an autogenerated link. >>> >>> I think that a Lua filter could help to add a "section-link" class to >>> the first kind of link and an "auto-link" class to the second kind of l= ink. >> >> See the filter below. It adds a `section-link` class for the first kind. >> Pandoc already adds a `uri` class for the second type, so those are not >> touched by the filter. > > Many thanks for your reply, Albert. > > The 'uri' class is added only when reading from Markdown, but not from > CommonMark with or without extensions (according to > https://try.pandoc.org/). > > Or what am I missing here? You're right of course, I forgot that CommonMark behaves differently. Typically, only autolinks have a link text that's the same as the link, so we can check for that: local function add_classes (link) local id =3D link.target:match '^%#(.*)' if id and headers[id] then link.classes:insert 'section-link' elseif link.target =3D=3D pandoc.utils.stringify(link.content) then link.classes:insert 'auto-link' end return link end --=20 Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 --=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/874jqo7j27.fsf%40zeitkraut.de.