From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Conditional link export? Date: Fri, 06 Nov 2015 13:24:09 +0000 Message-ID: <878u6buupy.fsf@gmail.com> References: <87ziyri8lk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuh02-0001YR-Tl for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 08:24:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zugzz-0003ct-PU for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 08:24:14 -0500 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:38099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zugzz-0003ck-Jq for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 08:24:11 -0500 Received: by wmec201 with SMTP id c201so17510388wme.1 for ; Fri, 06 Nov 2015 05:24:11 -0800 (PST) In-Reply-To: <87ziyri8lk.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Oleh Krehel , emacs-orgmode@gnu.org Hi Oleh, One approach would be to use a parse-tree filter to change one kind of link into another. Something like the following (not tested): ,---- | (defun awe/change-info-links (tree backend _info) | (org-element-map tree 'link | (lambda (link) | (when (org-export-derived-backend-p backend 'html) | (let* ((target (org-element-property :path link)) | (parts (split-string target "#"))) | (org-element-put-property link :type "https") | (org-element-put-property | link :path | (format | "//www.gnu.org/software/emacs/manual/html_node/%s/%s.html" | (nth 0 parts) | (nth 1 parts))))))) | tree) | (add-to-list 'org-export-filter-parse-tree-functions #'awe/change-info-li= nks) `---- This finds info links in the buffer, and converts them to http ones for html export. Exercises for the reader: - Handle the case of info links with no =E2=80=9C#=E2=80=9D - Link to manuals as http links in the document, and convert only the relevant http links to info links for info export. Hope this helps, --=20 Aaron Ecay