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: Sun, 9 Feb 2014 06:08:17 -0600 Message-ID: References: <87k3d5nuiw.fsf@gmail.com> <87fvnsofiq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b3435c073b98504f1f816e7 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCTC3-0005Ef-Cr for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 07:09:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCTBy-0000IZ-Ba for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 07:09:03 -0500 Received: from mail-ve0-f181.google.com ([209.85.128.181]:48769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCTBy-0000IT-53 for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 07:08:58 -0500 Received: by mail-ve0-f181.google.com with SMTP id cz12so4198099veb.12 for ; Sun, 09 Feb 2014 04:08:57 -0800 (PST) In-Reply-To: <87fvnsofiq.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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org --047d7b3435c073b98504f1f816e7 Content-Type: text/plain; charset=ISO-8859-1 Excellent -- that seems to export just fine. Interestingly, the export now generates the message, "Position saved to mark ring, go back with C-c & ." I presume that comes from the ((org-link-search-inhibit-query t)) argument in the "let" function. It doesn't seem to harm the export results. One of these years I'll have to start poking around the Emacs-Lisp code to try to puzzle out the workings of the functions being called, especially org-get-heading --- is there a comparable one (or arguments) to get the section number of a heading? Many thanks, Nicolas. On Sun, Feb 9, 2014 at 2:29 AM, Nicolas Goaziou wrote: > "D. C. Toedt" writes: > > > 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: > > > > > > #+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 > > )}}} > > The following should work. > > #+MACRO: get-title (eval (or (save-excursion (ignore-errors (let > ((org-link-search-inhibit-query t)) (org-open-link-from-string "[[#$1]]") > (org-get-heading nil nil)))) "/$1/")) > > > Regards, > > -- > Nicolas Goaziou > --047d7b3435c073b98504f1f816e7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Excellent -- that seems to export just = fine. =A0

Interestingly, the export now generates the me= ssage, "Position saved to mark ring, go back with C-c & ." = =A0I presume that comes from the=A0((org-= link-search-inhibit-query t)) argu= ment in the "let" function. =A0It=A0doesn't seem to ha= rm the export results.=A0

One of these years I'll have to start= poking around the Emacs-Lisp code to try to puzzle out the workings of the= functions being called, especially=A0
org-get-heading=A0
--- is there a comparable one (or arguments) to get the section number of a= heading?

Many thanks, Nicolas.



On Sun, Feb 9, 2014 at 2:29 AM, Ni= colas Goaziou <n.goaziou@gmail.com> wrote:
"D. C. Toedt" <dc@toedt.com> writes:

> I found a problem when trying this on a bigger file (my boo= k 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-ti= tle 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:
>
>
> #+MACRO: get-title (eval (save-excursion (org-open-link-fro= m-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
> =A0 :PROPERTIES:
> =A0 :CUSTOM_ID: IntroTechContracts
> =A0 :END:
>
> Lorem ipsum etc. etc.
>
> * Dangerous Clauses
> =A0 :PROPERTIES:
> =A0 :CUSTOM_ID: DangerousClauses
> =A0 :END:
>
> Lorem ipsum etc. etc. -- see Section {{{SECREF(
> BogusLinkTarget
> )}}}

The following should work.

=A0 #+MACRO: get-title (eval (or (save-excursion (ignore-errors (let ((org-= link-search-inhibit-query t)) (org-open-link-from-string "[[#$1]]"= ;) (org-get-heading nil nil)))) "/$1/"))


Regards,

--
Nicolas Goaziou

--047d7b3435c073b98504f1f816e7--