From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aaron Ecay Subject: Re: Conditional link export? Date: Sat, 07 Nov 2015 14:21:37 +0000 Message-ID: <87fv0hubym.fsf@gmail.com> References: <87ziyri8lk.fsf@gmail.com> <878u6buupy.fsf@gmail.com> <87d1vmgdt6.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]:39262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv4NC-0001AQ-VR for emacs-orgmode@gnu.org; Sat, 07 Nov 2015 09:21:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zv4N9-0000Or-RZ for emacs-orgmode@gnu.org; Sat, 07 Nov 2015 09:21:43 -0500 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:35038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zv4N9-0000Oh-IX for emacs-orgmode@gnu.org; Sat, 07 Nov 2015 09:21:39 -0500 Received: by wicll6 with SMTP id ll6so45719421wic.0 for ; Sat, 07 Nov 2015 06:21:39 -0800 (PST) In-Reply-To: <87d1vmgdt6.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, 2015ko azaroak 7an, Oleh Krehel-ek idatzi zuen: >=20 > Aaron Ecay writes: >=20 > Hi Aaron, >=20 > Thanks for the effort, I might use the code you suggested as a last > resort:) >=20 > I think the issue here is extending the power of Org markup. >=20 > The task at hand is "Write a manual in Org that exports to both Texinfo > and HTML", preferably with zero config outside of the Org file itself. > Also preferably without any extra Elisp inside the Org file. Is Org-mode > suitable for the task? Extra elisp inside the org file is an important way of extending the power of org markup. Why don=E2=80=99t you want to use it? >=20 > Currently I have a few questions that I had trouble internet-searching: >=20 > 1. Does Org-mode support export-based #ifdef #endif escapes?=20 Not in general. For small pieces of text, you can use macros. Something like: #+macro: ifinfo (eval (if (org-export-derived-backend org-export-current-ba= ckend 'info) "$1" "$2")) {{{ifinfo([[info:emacs#Pachages]],[[https://....]])}}} Note that the solution I gave you allows the links to be clickable in the buffer, whereas a macro does not (sort of). (Presently links in macro arguments are clickable but not underlined/colored like links, but that=E2=80=99s because the buffer is par= sed differently for fontification than for export. Eventually fontification will use the export parser, and then I expect macro args will no longer be able to contain clickable links.) The restrictions on what you can put inside a macro are a bit complex (I don=E2=80=99t claim to understand them fully myself), but approximately spe= aking they must occur in running text (not src blocks, the value of property drawers, #+keywords, etc) and the arguments must not contain a blank line. > Here's what I have currently: >=20 > You can read about ELPA in the Emacs manual, see=20 > #+HTML: (emacs)Packages. > #+TEXINFO: @ref{Packages,,,emacs,}. >=20 > Note that I'm getting an unwanted newline after "see" in case of HTML > export that I'd like to get rid of. Even if that problem is solved, it > still looks a bit clunky. >=20 > Is there a way to make something like this work instead? >=20 > #+begin_src elisp :inline > (cond > (ox-htmlp > (ox-html-link > "(emacs)Packages" > "https://www.gnu.org/software/emacs/manual/html_node/emacs/Packag= es.html")) > (ox-texinfop > (ox-texinfo-link > "info:emacs#Packages"))) > #+end_src > See, even you can=E2=80=99t resist putting elisp in. :P You could give the your pseudocode a #+name and then call it as an inline babel call. But that would be almost exactly the same as the macro approach (but more complicated). > 2. Does Org-mode support the kbd markup for denoting keyboard shortcuts? > I'm guessing that the answer is no, which is a shame since both Texinfo > and Github/StackExchange-flavored Markdown support it. No. There was recently a thread on small caps syntax: where many of the same themes come up. There=E2=80=99s not enough consensus at present to add any new markup types= to org syntax. Macros can be made to serve many of the same functions, though. >=20 > Currently I've customized my Org to export =3Dfoo=3D as code, and ~foo~ as > foo. Could we have this or a similar markup as the built-in > default? Since Org-mode has so much to do with Emacs, having kbd tags > would be very convenient. In some odd cases, ~foo~ wasn't working for > me and I've had to use @@html:@@"@@html:@@, which looks quite > ugly. You could use: #+macro: kbd @@html:@@$1@@html:@@ @@info:@kbd{@@$1@@info:}@@ @@l= atex:...@@ It=E2=80=99s long and ugly, but it works for however many backends you care= to add. I left a space between the different backends for clarity; you=E2=80= =99ll need to remove this in your actual document though. >=20 > 3. I really like http://orgmode.org/manual/index.html. How would I go > about producing something like that (i.e. where can I find the sources)? > Each time I've seen HTML export, it's always a single page. How to > export each heading to its own page and have them all linked? AFAIK that is produced by converting a texinfo document to html using texinfo, not by org=E2=80=99s html exporter. There must be a way to have multi-page html documents, perhaps using ox-publish. I=E2=80=99m not famil= iar with them though. >=20 > 4. Is Org-mode powerful enough to have all of Emacs' manuals re-written > in it, without any change in the final Info output? In a trivial sense yes, using a file consisting solely of: #+begin_info #+end_info Someone ported the org manual to org format in a non-trivial way a couple of years ago . It generated a lot of discussion but was never finally adopted. I believe that was due more to the difficulty in integrating the build process rather than anything wrong with the org version of the manual per se. Speed may have also been a concern, but I expect the exporter to have gotten much faster in the intervening years. Hope this is helpful, --=20 Aaron Ecay