From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id GD/IA3Xyh2OLIAAAbAwnHQ (envelope-from ) for ; Thu, 01 Dec 2022 01:16:53 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id mLO/A3Xyh2MU7wAAauVa8A (envelope-from ) for ; Thu, 01 Dec 2022 01:16:53 +0100 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 AB64F13377 for ; Thu, 1 Dec 2022 01:16:52 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0XF2-0001Nd-Fp; Wed, 30 Nov 2022 19:15:52 -0500 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 1p0XEy-0001NP-Rq for emacs-orgmode@gnu.org; Wed, 30 Nov 2022 19:15:50 -0500 Received: from mr85p00im-zteg06023901.me.com ([17.58.23.192]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0XEv-00068H-VF for emacs-orgmode@gnu.org; Wed, 30 Nov 2022 19:15:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1669853742; bh=AEQhG8943WP0GvZwCTV/5XKjpSkbguwXzUz5Lo4CR/c=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=tFQ2K/eCsnd2rWPpIpLz3EixKCeSXIsjNCVaWKTtwLTGKiJl3e0lqXL+QM93Pm2P5 JpyXr7HednjsWvgxvtlrQuY8QRZKJ0qbJ6HJAOjnY4gAGnMX8DBpbI1vl9oSaPtGHJ eLls3+rk6G6RiF2DybNwHWJAQBRwGs7J9aa85Fe5NptUMl5sTppLiVHH00XTUm2LLF HgPaW4Y9UWx2sSizivkQcqDIjZQ3bYWjsdREoMeHtzlWDfhkvtQ0kV4PNAp7K4tISL sSJHb4L+Aa1rP9L4Da/YkE2+tsVreqghgTsxfDdHWA6zYVgU7wJ/w+gbinVuwO4WUd FxUA/U1jNQbqg== Received: from Rudolfs-MacBook-Air.local (mr38p00im-dlb-asmtp-mailmevip.me.com [17.57.152.18]) by mr85p00im-zteg06023901.me.com (Postfix) with ESMTPSA id D95E26E0628 for ; Thu, 1 Dec 2022 00:15:41 +0000 (UTC) From: =?utf-8?Q?Rudolf_Adamkovi=C4=8D?= To: emacs-orgmode@gnu.org Subject: [PATCH] Make broken link markers customizable Date: Thu, 01 Dec 2022 01:15:38 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Proofpoint-GUID: wyl0aiYRXwSsUQBe26lvStwvIYWd0GKg X-Proofpoint-ORIG-GUID: wyl0aiYRXwSsUQBe26lvStwvIYWd0GKg X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.572,17.0.605.474.0000000_definitions?= =?UTF-8?Q?=3D2022-01-14=5F01:2022-01-14=5F01,2020-02-14=5F11,2020-01-23?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 clxscore=1015 suspectscore=0 mlxlogscore=905 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2212010000 Received-SPF: pass client-ip=17.58.23.192; envelope-from=salutis@me.com; helo=mr85p00im-zteg06023901.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1669853812; 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:dkim-signature; bh=AEQhG8943WP0GvZwCTV/5XKjpSkbguwXzUz5Lo4CR/c=; b=qlZ9IyfQJ6hlihnTKh6pFA/aV14NlBAuaqi4TB/xW9Kr6cY3cLlq5Kobrsvdt5AiXS7oQk G5Hq7u+9jYBwjcnrsSevm9uudyc8kFwYf2eswtVNxk7THDYdXkguDbJ9siYpA7f+kEqKjS 7WNOswewpLi9wzzAiHJ7MElPjdjVo3S67DyPkUsrqBFaNSOmHAkbliI9WWmAWOuiGTKwWu b+9n01iitu3htUGLhIQEQSfgOzral2VwAQU8x5CAT675YSnwKiZ1ESDhDJ9Z5wPoi+wMLT G5F5PvG2w4rBBFwh5Mll1wQGQhIJSlcgkcZcq7L37gmo9V8SQ4VcwFmoh2vxkQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1669853812; a=rsa-sha256; cv=none; b=FmEwtDFdPzsuJCh4Yfsa1HUzW5NgTbFddv/g6C79eazT0pWGhGs/CCy2OQtTwWMzfCZWjm Ck6B7Lih4VlXRsmUXp2WOfEhi11jNtBrh0atXyxuJri2IavxNT9l71UojyVrF6Vgs3jKKY ZpPkJ6beR8G1OW/q0vr1hxjfvIp/yHRl8f0fHYzJSXeiC2tnjrtR/q8mPGvki6nRp1VPck EPQLSlY3z/etH8ctCmVRTBTw6Sf13Zf/Q7RT2YKQp4pSsaR4EGJ2CXlT6uAKF5m6qpOXEz oc3UenguFky6qk6WjPJ8kHiPzTL9cTkkPdZ6GFgyvfTatXQ/76B71j3C/tII1A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b="tFQ2K/eC"; dmarc=pass (policy=quarantine) header.from=me.com; 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" X-Migadu-Spam-Score: -2.56 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=me.com header.s=1a1hai header.b="tFQ2K/eC"; dmarc=pass (policy=quarantine) header.from=me.com; 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" X-Migadu-Queue-Id: AB64F13377 X-Spam-Score: -2.56 X-Migadu-Scanner: scn1.migadu.com X-TUID: odT5iCuuAYJ0 --=-=-= Content-Type: text/plain Hello there! Org provides no good way to ignore broken links when exporting subtrees with lots of links. With `org-export-with-broken-links' set to `nil', the exporter aborts. When set to `t', the exporter removes the linked words altogether, breaking the sentences. Lastly, when set to `mark', the sentences become unreadable due to the million [BROKEN LINK: ...] fragments everywhere. What do you folks think about the WIP patch below? It allows the user to customize the broken link marker the Org exporter will use. A user like me, one who works in a large Org file and often exports only its parts, can use a more gentle marker or even no marker at all. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-export-Make-broken-link-markers-customizable-WIP.patch >From 545b71606609a76be78ddff8d5fe36259a3d8353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Thu, 1 Dec 2022 00:59:39 +0100 Subject: [PATCH] org-export: Make broken link markers customizable [WIP] --- lisp/ox.el | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index 5c0a8f242..5f653698c 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -856,13 +856,9 @@ is nil. You can also allow them through local buffer variables." When this variable is non-nil, broken links are ignored, without stopping the export process. If it is set to `mark', broken -links are marked as such in the output, with a string like +links are marked with `org-export-broken-link-marker'. - [BROKEN LINK: path] - -where PATH is the un-resolvable reference. - -This option can also be set with the OPTIONS keyword, e.g., +This variable can also be set with the OPTIONS keyword, e.g., \"broken-links:mark\"." :group 'org-export-general :version "26.1" @@ -872,6 +868,18 @@ This option can also be set with the OPTIONS keyword, e.g., (const :tag "Mark broken links in output" mark) (const :tag "Raise an error" nil))) +(defcustom org-export-broken-link-marker "[BROKEN LINK: %s]" + "The string used to mark broken links. + +This variable applies only when `org-export-with-broken-links' is +set to `mark'. If the value contains the %-sequence `%s', the +exporter will replace it with the broken reference which it +cannot resolve." + :group 'org-export-general + :package-version '(Org . "9.7") + :type 'string + :safe #'stringp) + (defcustom org-export-snippet-translation-alist nil "Alist between export snippets back-ends and exporter back-ends. @@ -1893,7 +1901,8 @@ Return a string." (pcase (plist-get info :with-broken-links) (`nil (user-error "Unable to resolve link: %S" (nth 1 err))) (`mark (org-export-data - (format "[BROKEN LINK: %s]" (nth 1 err)) info)) + (format org-export-broken-link-marker (nth 1 err)) + info)) (_ nil)))))) (let* ((type (org-element-type data)) (parent (org-export-get-parent data)) -- 2.38.1 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable -- "Be especially critical of any statement following the word 'obviously.'" -- Anna Pell Wheeler, 1883-1966 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25 84103 Bratislava Slovakia --=-=-=--