emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Conditional link export?


From: John Kitchin
Subject: Re: [O] Conditional link export?
Date: Fri, 06 Nov 2015 08:28:12 -0500
User-agent: mu4e 0.9.13; emacs 25.0.50.1

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
           "<a 
href=\"https://www.gnu.org/software/emacs/manual/html_node/%s/%s.html\";>%s</a>"
           (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]