From mboxrd@z Thu Jan 1 00:00:00 1970 From: "D. C. Toedt" Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Sat, 8 Feb 2014 18:04:49 -0600 Message-ID: References: <87k3d5nuiw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2903c2de7a304f1edfb14 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCHu1-0001RD-HX for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 19:05:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCHtr-0004Ui-Dl for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 19:05:41 -0500 Received: from mail-oa0-f48.google.com ([209.85.219.48]:44281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCHtr-0004UW-6u for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 19:05:31 -0500 Received: by mail-oa0-f48.google.com with SMTP id l6so5916746oag.21 for ; Sat, 08 Feb 2014 16:05:30 -0800 (PST) In-Reply-To: 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --001a11c2903c2de7a304f1edfb14 Content-Type: text/plain; charset=ISO-8859-1 I found a problem when trying this on a bigger file (my book file): If $1 (actually, #$1) is for a link target that doesn't exist, then org-mode goes into its "No match - create this as a new heading? (y or n)" routine. That causes the rest of the export to fail. It'd be better if get-title could do the same thing org-mode does natively, that is, including the text of $1 as italics to indicate a non-existent link. Example file below: --8<---------------cut here---------------start------------->8--- #+MACRO: get-title (eval (save-excursion (org-open-link-from-string "[[#$1]]") (org-get-heading nil nil))) #+MACRO: SECREF [[#$1][{{{get-title($1)}}}]] #+OPTIONS: H:7 toc:nil num:1 email:t author:t * Introduction to Technology Contracts :PROPERTIES: :CUSTOM_ID: IntroTechContracts :END: Lorem ipsum etc. etc. * Dangerous Clauses :PROPERTIES: :CUSTOM_ID: DangerousClauses :END: Lorem ipsum etc. etc. -- see Section {{{SECREF( BogusLinkTarget )}}} --8<---------------cut here---------------end--------------->8--- > --001a11c2903c2de7a304f1edfb14 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I found a problem when trying this on a= bigger file (my book file): =A0If $1 (actually, #$1) is for a link target = that doesn't exist, then org-mode goes into its "No match - create= this as a new heading? (y or n)" routine. That causes the rest of the= export to fail. =A0It'd be better if get-title could do the same thing= org-mode does natively, that is, including the text of $1 as italics to in= dicate a non-existent link.

Example file below:

--8<---------------cut= here---------------start------------->8---

#+MACRO= : get-title (eval (save-excursion (org-open-link-from-string "[[#$1]]&= quot;) (org-get-heading nil nil)))
#+MACRO: SECREF= [[#$1][{{{get-title($1)}}}]]
#+OPTIONS: H:7 toc:nil num:1 email:t author:t
* Introduction to Technology Contracts
=A0 :PROPERTIES:
=A0 :CUSTOM_= ID: IntroTechContracts
=A0 :END:

Lorem ipsum etc. etc.

* D= angerous Clauses
=A0 :PROPERTIES:
=A0 :CUSTOM_ID: DangerousClauses
=A0 :END:

Lorem ipsum= etc. etc. -- see Section {{{SECREF(
BogusLinkTarget
)}
}}

--8<---------------cut here---------------end----= --------= --->8---

<= /span>

=

=
--001a11c2903c2de7a304f1edfb14--