From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WD6uJOXcl2ZbqgAAe85BDQ:P1 (envelope-from ) for ; Wed, 17 Jul 2024 15:01:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id WD6uJOXcl2ZbqgAAe85BDQ (envelope-from ) for ; Wed, 17 Jul 2024 17:01:57 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1721228517; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=CPbw6OvgAUFV8z00WMKpxhcVZXYxNV0mVtr1vZvBafE=; b=mnEuMZUeBXlEU8PABhz6WVpZJHY+jgH4GiTUDrUFrBD58ACX4uhAlurePiwP1tEbvl4AeK 9Y/cW31TG4pejpu59nhCsnI9AEkaGJmQQDDMOts9NWlMLeVDbEhSjPRhAv9rpcEYdkDo9j vCSmarr3pAY9d+kMXATcZ0UsS21T39mbPtOtwpFP+c7ceRH25QopvrvCV01wQJAjo1//ei ikg38y2HntR7M4oIl7jAP9/pXcX2rDp2VJlN/xWELU6468EPqShD+DnG3Aftt+GvlwbUPr TsT7S0dkhtAsRZKLuPothZiXwmTbvqNmisu5ycsbPkWCXeHBALMErHHkBqGSbA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1721228517; a=rsa-sha256; cv=none; b=BUfOzTkBCmFUVtBJuL1XKHLSCHf0sLp5FxCowVP4d+Z9DFQS/PEXP43tnTcRrx+0XSimUx s5oCbp6flNJ4CDZanEl9shRzYXQwwNpTPCLDhysyncH6pgY2pKcpFXeuJgJ4W4VmpzhXsa TRAmJcsSgIntZABrd3tyJrPiocm/5CQPWa92joW0Wbfm/e5G/o2p+0FXLFRigxeKaVYmhV tjCFbCWK/Vh+YpRmLYuaMkb/l+vb3fVA6us6CWuNUJCS3mkCso4H8q7M0BWPejGPEJRlDt l8DMtlSeqnBVuiBQqGRyEV3lpaNH7+qadmLbdqNB2jNuvGalyJ9A8wh30Z8gkA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2D9557FFCB for ; Wed, 17 Jul 2024 17:01:57 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sU69T-0007om-P2; Wed, 17 Jul 2024 11:01:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sU69O-0007Zt-1Z for emacs-orgmode@gnu.org; Wed, 17 Jul 2024 11:01:02 -0400 Received: from smtpout1.mo11.mail-out.ovh.ca ([51.161.45.253]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sU69L-0002J4-Nq for emacs-orgmode@gnu.org; Wed, 17 Jul 2024 11:01:01 -0400 Received: from mxplan1.mail.ovh.ca (unknown [10.111.58.93]) by mo11.mail-out.ovh.ca (Postfix) with ESMTPS id 4WPJz42Sh1zHpvM for ; Wed, 17 Jul 2024 12:00:48 -0300 (ADT) Received: from morales.pe (54.39.251.56) by DAG2EX2.mxpca1.local (172.16.2.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 17 Jul 2024 11:00:47 -0400 X-OVh-ClientIp: 190.238.153.140 From: Rodrigo Morales To: Subject: HTML export: Force links that end in .jpg or .png to be exported as a tags Date: Wed, 17 Jul 2024 10:00:41 -0500 Message-ID: <87sew8rrl2.fsf@morales.pe> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [54.39.251.56] X-ClientProxiedBy: DAG2EX1.mxpca1.local (172.16.2.11) To DAG2EX2.mxpca1.local (172.16.2.12) X-Ovh-Tracer-GUID: 79ee31c5-5046-4c35-b4bd-e48cfa357989 X-Ovh-Tracer-Id: 15897425212340366359 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrgeeigdekvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvufffkfggtghisehttdertddttddtnecuhfhrohhmpeftohgurhhighhoucfoohhrrghlvghsuceorhhoughrihhgohesmhhorhgrlhgvshdrphgvqeenucggtffrrghtthgvrhhnpedukeetudeiheejiedtffetieehheegtefhieeigfetueelvefgtdekfeeiueevvdenucffohhmrghinhepvgigrghmphhlvgdrohhrghdpfihikhhimhgvughirgdrohhrghenucfkphepuddvjedrtddrtddruddpheegrdefledrvdehuddrheeipdduledtrddvfeekrdduheefrddugedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehrohgurhhighhosehmohhrrghlvghsrdhpvgdpnhgspghrtghpthhtohepuddprhgtphhtthhopegvmhgrtghsqdhorhhgmhhouggvsehgnhhurdhorhhgpdfovfetjfhoshhtpehmohduuddpmhhouggvpehsmhhtphhouhht Received-SPF: pass client-ip=51.161.45.253; envelope-from=rodrigo@morales.pe; helo=smtpout1.mo11.mail-out.ovh.ca X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -6.11 X-Migadu-Queue-Id: 2D9557FFCB X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.11 X-TUID: LMl+UfsgciOp Consider the following Org document: #+HEADER: :tangle /tmp/a.org #+BEGIN_SRC org ,#+TITLE: My document ,#+DATE: 2024-07-17 This is a link that ends in html: foo https://example.org/a.html bar This is a link that ends in txt: foo https://example.org/a.txt bar This is a link that ends in jpg: foo https://example.org/a.jpg bar This is a link that ends in png: foo https://example.org/a.png bar #+END_SRC I started Emacs using the following command: #+BEGIN_SRC sh emacs \ --quick \ --eval='(find-file "/tmp/a.org")' \ --eval='(org-html-export-as-html)' #+END_SRC The following code block shows the relevant content in the buffer =*Org HTML Export*=. #+BEGIN_SRC html

My document

This is a link that ends in html: foo https://example.org/a.html bar

This is a link that ends in txt: foo https://example.org/a.txt bar

This is a link that ends in jpg: foo a.jpg bar

This is a link that ends in png: foo a.png bar

#+END_SRC As we can see above, links that end in =html= or =txt= are exported as =a= tags, while links that end in =jpg= or =png= are exported as =img= tags. I want links that end in =.jpg= or =.png= to also be =a= tags. The reason is that in my use case, I need to display a link (i.e. a =a= tag) inside a paragraph of an image hosted at Wikimedia Commons in the HTML export. For example: https://commons.wikimedia.org/wiki/File:Banana_on_whitebackground.jpg My question is: How to force a link that end in =.jpg= or =.png= to be exported as a =a= tag instead of an =img= tag?