From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Conditional link export? Date: Fri, 06 Nov 2015 08:28:12 -0500 Message-ID: References: <87ziyri8lk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuh41-0003da-3X for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 08:28:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zuh3x-0004fZ-Ro for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 08:28:21 -0500 Received: from mail-qk0-x230.google.com ([2607:f8b0:400d:c09::230]:33737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zuh3x-0004fJ-G0 for emacs-orgmode@gnu.org; Fri, 06 Nov 2015 08:28:17 -0500 Received: by qkas77 with SMTP id s77so41482625qka.0 for ; Fri, 06 Nov 2015 05:28:17 -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 Cc: emacs-orgmode@gnu.org I would redefine the info link, and write new export functions for each backend. You will need to parse the link path for html to construct that url, but it looks easy to do. I assume # splits the info link into pieces that are useful? Alternatively, write a filter for links that only does that for links of info type. or you could directly modify org-link-protocols, e.g. #+BEGIN_SRC emacs-lisp (setf (elt (assoc "info" org-link-protocols) 2) (lambda (keyword desc format) (cond ((eq format 'html) (format "%s" (car (s-split "#" keyword)) (car (last (s-split "#" keyword))) keyword))))) #+END_SRC This seems to make the info link into something like what you want. This way you keep the simple link syntax in org, and get what you want in other formats. Oleh Krehel writes: > Hi all, > > I'm writing a manual in Org-mode, with the intent to export both to > Texinfo and HTML. And I'd like to use this link for Texinfo: > > info:emacs#Packages > > and this link for HTML: > > https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html > > They both link to the same information, but in different browsers > basically. How could this be done? I'm thinking of something like: > > #ifdef TEXINFO > [[info:emacs#Packages]] > #else > [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html]] > #endif > > Oleh -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu