From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 0BaBM4LmFWNDHgEAbAwnHQ (envelope-from ) for ; Mon, 05 Sep 2022 14:07:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IGvYMoLmFWPGwwAAG6o9tA (envelope-from ) for ; Mon, 05 Sep 2022 14:07:30 +0200 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 605B81719C for ; Mon, 5 Sep 2022 14:07:30 +0200 (CEST) Received: from localhost ([::1]:53280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVAsy-0005nw-TE for larch@yhetil.org; Mon, 05 Sep 2022 08:07:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVAVy-0008AM-QQ for emacs-orgmode@gnu.org; Mon, 05 Sep 2022 07:43:43 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:37413) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oVAVw-0003PJ-EN for emacs-orgmode@gnu.org; Mon, 05 Sep 2022 07:43:42 -0400 Received: by mail-pj1-x1035.google.com with SMTP id o2-20020a17090a9f8200b0020025a22208so4738948pjp.2 for ; Mon, 05 Sep 2022 04:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date; bh=GbjxXsvUnYtoIp4qGLteSqCKgqxEYhgzX0T5Xp24b9c=; b=O236jFZ/nf2DaJFOMUN7UjuDJucEK820TtLYFB5HKhOFujqRxLEJZQJ0JXwjjkINIO aKnfwWLjurcK5uYYZcAFnmxLwcJWwRd2VADxP6FFn+7R7pSP6JSB6atK0MkVnW5dDBfy NZ0QyO1miJFnIWViSZSmB295GXz2xO2vq4cgPViASAEAlMQxvQJ2UhSbLvOq2BPfk1d4 YsbuLNpWAspgNRfppPrz0VXgPbBuu2UOIin60sTsfBvMwl5D+3A0pCT0WSVkNDvmc+mN miBa4I/HX6l/cNw41dPwVq2C4sX8uNeAnhOR5TQ51vfKJitYliNXi2tvuPqJhA2CwA+b f8SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=GbjxXsvUnYtoIp4qGLteSqCKgqxEYhgzX0T5Xp24b9c=; b=UGZlkp1vEqc6Py6pibxtpaVMkyfXdnEGhaDtaT4J7ftuCUgUJRIleM4NthU7fcR9Z7 OzUFWAJ2ELEMihc/TSawQIYOUbqa69g5tCpglZDZ2AJyvvzKwVbdQzR3kGZH2wODXGR/ G2Y54zWqhsOyuNOgapjv8DIIStT3RfLdPZynOuEZCRwuHIub1fRTnFa5Vg+2XOydEYjh xF51hBu1EvlXc8tp7Vyt7WtbvxacS2PsjE8ijVbz+yBFzAZMtnMX85GMMUYQq7UHUuYt L5k21RfoQ9ITSjgk3Se2VeJdzK0xgJGFltlyplloxdCNgbIt2cXcw61XH8YZm7hDTRV4 MxSw== X-Gm-Message-State: ACgBeo1LZXO6AN1TICn0U2EBb5351BK6jMl49pqE1fTqidF63tIL0QWT bzac2YjNRbvgVKF9ui5klVx6GdbznL16BQ== X-Google-Smtp-Source: AA6agR7Q2dZZRs/k1VXsiuMBNN7TP91H2tP3PgGn76hR7Zwe58P6+GYRJy1PXmxN47p/b7umaQbY3A== X-Received: by 2002:a17:90a:4a8e:b0:200:2274:7ec4 with SMTP id f14-20020a17090a4a8e00b0020022747ec4mr11574258pjh.103.1662378216967; Mon, 05 Sep 2022 04:43:36 -0700 (PDT) Received: from localhost ([2409:8a70:2b2:5800:8ec6:81ff:fe70:339d]) by smtp.gmail.com with ESMTPSA id d22-20020a656b96000000b0041c35462316sm6263855pgw.26.2022.09.05.04.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 04:43:36 -0700 (PDT) From: Ihor Radchenko To: lehi@tosk.in Cc: Tim Cross , emacs-orgmode@gnu.org Subject: [PATCH] Re: Org Publish HTML and PDF With GPG Files In-Reply-To: References: <86v8qe5pat.fsf@gmail.com> <87ilm7o9u2.fsf@localhost> Date: Mon, 05 Sep 2022 19:44:33 +0800 Message-ID: <87h71mvye6.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1035.google.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1662379650; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GbjxXsvUnYtoIp4qGLteSqCKgqxEYhgzX0T5Xp24b9c=; b=by7ZXFPe6q5Qz0TVI3HHawI4uU69AyVBuMFgUj/JZhjSt5oJ5WltXydKYlzn+vxQkEw8NX Mp2TSuJ7hNrnP++F7q/Uk/JRz9FK2oHIvnXY96IyImcM2VKB0bBfkyBXNVL8p97At+VPS6 9OETUPXjxJlUzFKsWKD+ymI/8khTLLbd9LSn1udJ0xfGcIwBMuZZlHPemateH46BcTXq4M JWO5QZpCnUD8IEjMJr2KuLyAxc3/n3Ft3mP4QJn3U9gZ6qEzr9C+4Qto+cOVtQ0IsnYVup 6fjkyS9sA7s0TMmpY/oleHwZ0NCytwr+AgW1AGmNuc8AxTcLuLCsGeofHxKjvw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662379650; a=rsa-sha256; cv=none; b=W2HrWxrTkg2lHbzFnWh85YJsWjmXB61mx8mv1ojj1Jp38RflKKAkmrXBYwgA6+2GzjArZQ GJs8DNJ9KYlvP+38Bzd3jCPB/JhkWdJhj8GFc2I/o2HWgaxKG5pt6DeipHzBq8nLYAZeDg 89IvsdYsdFagt85KjyfTztqgToBcL/Av3FIHDsMaCgM+2PDyyCTunivWysP07NL+LHw6Ga OQ5MRpKqtixJnP9BcMAKt+Ungz1tI2wTJufOGsuDGmiO9Boxz6isAqvHiB+0UZ4pYETEf0 u0cBnJ583+wPAoF7CZjTXi6xJnLP903wI4Q6BJH90dqWDP2QB0sVvxvdJzZjuQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="O236jFZ/"; dmarc=pass (policy=none) header.from=gmail.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: -3.27 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="O236jFZ/"; dmarc=pass (policy=none) header.from=gmail.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: 605B81719C X-Spam-Score: -3.27 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5qkkOXosbiSE --=-=-= Content-Type: text/plain lehi@tosk.in writes: >> Thus, we may simply extend `org-html-link' to work on .org.gpg files in >> addition to .org files. > > Yes, this is it exactly. Can you try the attached patch? -- Ihor Radchenko, Org mode contributor, Learn more about Org mode at https://orgmode.org/. Support Org development at https://liberapay.com/org-mode, or support my work at https://liberapay.com/yantar92 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-ox-publish-Allow-linking-to-encrypted-Org-files.patch >From dcbda721705ed54c378bcefa0ec9116b8203ecc8 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Mon, 5 Sep 2022 19:40:13 +0800 Subject: [PATCH] ox-publish: Allow linking to encrypted Org files * lisp/ox-html.el (org-html-link): Convert .org.gpg file links to .html, in addition to previously performed .org -> .html convertion. (org-html-link-org-files-as-html): Update the docstring. * doc/org-manual.org (Publishing links): * etc/ORG-NEWS (Publishing now supports links to encrypted Org files): Document the new feature. --- doc/org-manual.org | 17 ++++++++++------- etc/ORG-NEWS | 6 ++++++ lisp/ox-html.el | 15 +++++++++------ 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index 794682b49..fbd88aa68 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -16454,13 +16454,16 @@ *** Publishing links #+cindex: links, publishing To create a link from one Org file to another, you would use something -like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see [[*External Links]]). When -published, this link becomes a link to =foo.html=. You can thus -interlink the pages of your "Org web" project and the links will work -as expected when you publish them to HTML. If you also publish the -Org source file and want to link to it, use an =http= link instead of -a =file:= link, because =file= links are converted to link to the -corresponding =.html= file. +like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see +[[*External Links]]). When published, this link becomes a link to +=foo.html=. You can thus interlink the pages of your "Org web" +project and the links will work as expected when you publish them to +HTML. If you also publish the Org source file and want to link to it, +use an =http= link instead of a =file:= link, because =file= links are +converted to link to the corresponding =.html= file. + +Links to encrypted Org files, like =[[file:foo.org.gpg]]= are also +supported. You may also link to related files, such as images. Provided you are careful with relative file names, and provided you have also diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 713a850f6..3f1c8f4c7 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -140,6 +140,12 @@ backend. From now on, using =outline-*= functions is strongly discouraged when working with Org files. ** New features +*** Publishing now supports links to encrypted Org files + +Links to other published Org files are automatically converted to the +corresponding html links. Now, this feature is also available when +links point to encrypted Org files, like +=[[file:foo.org.gpg::Heading]]=. *** Interactive commands now support escaping text inside comment blocks diff --git a/lisp/ox-html.el b/lisp/ox-html.el index b5aa868fe..8da180034 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -839,6 +839,8 @@ (defcustom org-html-link-org-files-as-html t (recognized by the extension \".org\") should become links to the corresponding HTML file, assuming that the linked Org file will also be converted to HTML. +Links to \"file.org.gpg\" are also converted. + When nil, the links still point to the plain \".org\" file." :group 'org-export-html :type 'boolean) @@ -3066,12 +3068,13 @@ (defun org-html-link (link desc info) (lambda (raw-path info) ;; Treat links to `file.org' as links to `file.html', if ;; needed. See `org-html-link-org-files-as-html'. - (cond - ((and (plist-get info :html-link-org-files-as-html) - (string= ".org" - (downcase (file-name-extension raw-path ".")))) - (concat (file-name-sans-extension raw-path) dot html-ext)) - (t raw-path)))) + (save-match-data + (cond + ((and (plist-get info :html-link-org-files-as-html) + (let ((case-fold-search t)) + (string-match "\\(.+\\)\\.org\\(?:\\.gpg\\)?$" raw-path))) + (concat (match-string 1 raw-path) dot html-ext)) + (t raw-path))))) (type (org-element-property :type link)) (raw-path (org-element-property :path link)) ;; Ensure DESC really exists, or set it to nil. -- 2.35.1 --=-=-=--