From mboxrd@z Thu Jan 1 00:00:00 1970 From: "D. C. Toedt" Subject: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Sat, 8 Feb 2014 15:11:22 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1133ec96d02a9904f1eb8eda Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCFC3-0005Oj-E6 for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 16:12:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCFBz-0006Ki-Ib for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 16:12:07 -0500 Received: from mail-vb0-f46.google.com ([209.85.212.46]:59737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCFBz-0006Kc-D8 for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 16:12:03 -0500 Received: by mail-vb0-f46.google.com with SMTP id o19so3715908vbm.33 for ; Sat, 08 Feb 2014 13:12:02 -0800 (PST) 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: emacs-orgmode@gnu.org --001a1133ec96d02a9904f1eb8eda Content-Type: text/plain; charset=ISO-8859-1 I'm using Org-mode version 8.2.5f with Gnu Emacs 24.3 on a Macbook Air with Mavericks. I'm using it to build building an annotated collection of contract clauses that I'm releasing under a Creative Commons license (see http://www.CommonDraft.org), which I hope to monetize with a book on contract drafting and negotiation. I've done a fair amount of Google searching and also searching within this list. If the following isn't already implemented, I'd pay USD$100 (via PayPal) to have that done to whoever implements it in an official org-mode release, plus another USD$100 donation to the org-mode maintainer. QUESTION: When org-mode headings are NUMBERED, and the file is exported to HTML, is there any way to have org-mode include the TITLE, not just the section number, of a cross-referenced section, along the lines of the LaTex \nameref{} function? Here's an example: ==BEGIN EXAMPLE== #+OPTIONS: H:7 TOC:nil @:t 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 [[#IntroTechContracts]]. ==END EXAMPLE== With numbering turned ON (#+OPTIONS: num:1), the link is exported to HTML as: Section 1. With numbering turned OFF (#+OPTIONS: num:nil), the link is exported to HTML as: Section Introduction to Technology Contracts. Using a macro, I'd like to be able to AUTOMATICALLY do the latter --- that is, have the link text be the heading title --- even with numbering turned ON, so that a macro such as {{{SECREF(IntroTechContracts)}}} would render in HTML as, let's say: Section 1, entitled "Introduction to Technology Contracts." Is that currently doable? *D. C. Toedt III * *(my** last name is pronounced "Tate") * Attorney and neutral arbitrator -- tech contracts and intellectual property dc@toedt.com LinkedIn: dctoedt Calendar (redacted) O: +1 (713) 364-6545 C: +1 (713) 516-8968 Houston, Texas (Central time zone) *Common Draft* annotated collection of contract clauses Unless expressly stated otherwise, this message is not intended to serve as an electronic signature nor as assent to an agreement. --001a1133ec96d02a9904f1eb8eda Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I'm using Org-mode version 8.2.5f w= ith Gnu Emacs 24.3 on a Macbook Air with Mavericks. I'm using it to bui= ld building an annotated collection of contract clauses that I'm releas= ing under a Creative Commons license (see http://www.CommonDraft.org), which I hope to monetize with a book= on contract drafting and negotiation.

I've done a fair amount= of Google searching and also searching within this list. If the following = isn't already implemented, I'd pay USD$100 (via PayPal) to have tha= t done to whoever implements it in an official org-mode release, plus anoth= er USD$100 donation to the org-mode maintainer.

QUESTION: =A0When org-mode = headings are NUMBERED, and the file is exported to HTML, is there any way t= o have org-mode include the TITLE, not just the section number, of a cross-= referenced section, along the lines of the LaTex \nameref{} function? =A0He= re's an example:

=3D=3DBEGIN EXAMPLE=3D=3D

#+OPTIONS: H:7 TOC:nil @:t num:1 email:t author:t
<= div class=3D"gmail_default">
* = Introduction to Technology Contracts
=A0 :PROPERTIES:
=A0 :CUSTOM_ID: IntroTechContracts
=A0 :END:

Lorem ipsum= etc. etc.
* Dangerous Clauses
<= font face=3D"arial, helvetica, sans-serif">
=A0 :PROPERTIES:
=A0 :CUSTOM_ID: Dangerou= sClauses
=A0 :END:

Lorem ipsum etc. etc. -- see Section [[#IntroTechContracts]].
=3D=3DEND EXAMPLE=3D=3D

With numbering turned ON (#+OPTIONS: num:1), the link is exporte= d to HTML as: =A0Section <a href=3D"#IntroTechContracts">1&= lt;/a>.
With numbering turned OFF (#+OPTIONS: num:nil), the link is expo= rted to HTML as: =A0Section <a href=3D"#IntroTechContracts">= ;Introduction to Technology Contracts</a>.

Using a macro, I= 'd like to be able to AUTOMATICALLY do the latter --- that is, have the= link text be the heading title --- even with numbering turned ON, so that = a macro such as {{{SECREF(IntroTechContracts)}}} would render in HTML as, l= et's say: =A0 Section <a href=3D"#IntroTechContracts">1= </a>, entitled "<a href=3D"#IntroTechContracts">Introduction = to Technology Contracts</a>."

Is that currently doable?

D
. C. Toedt III=A0
=A0(my
=A0last name is pronounced "Tate")=A0

Attorney and neutra= l arbitrator -- tech contracts and intellectual property

dc@toedt.com=A0 =A0 =A0LinkedIn:=A0dctoedt=A0 =A0=A0C= alendar= =A0(redacted)
O: +1 (713) 364= -6545 =A0 =A0C: +1 (713) 516-8968
=A0 =A0=A0
Houston, Texas (Central time zone)
=
Common Draft=A0annotated collection of contract clauses

Unless expressly stated otherwise= , this message is not intended=A0
to serve as an electro= nic signature nor as=A0assent to an agreement.


--001a1133ec96d02a9904f1eb8eda-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Sat, 08 Feb 2014 22:50:47 +0100 Message-ID: <87k3d5nuiw.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCFnG-0001wa-2y for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 16:50:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCFnA-0008TA-1u for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 16:50:33 -0500 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:50155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCFn9-0008SW-J1 for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 16:50:27 -0500 Received: by mail-wi0-f171.google.com with SMTP id cc10so1800255wib.10 for ; Sat, 08 Feb 2014 13:50:26 -0800 (PST) In-Reply-To: (D. C. Toedt's message of "Sat, 8 Feb 2014 15:11:22 -0600") 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: "D. C. Toedt" Cc: emacs-orgmode@gnu.org Hello, "D. C. Toedt" writes: > QUESTION: When org-mode headings are NUMBERED, and the file is exported to > HTML, is there any way to have org-mode include the TITLE, not just the > section number, of a cross-referenced section, along the lines of the LaTex > \nameref{} function? Here's an example: > > ==BEGIN EXAMPLE== > > #+OPTIONS: H:7 TOC:nil @:t 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 [[#IntroTechContracts]]. > > ==END EXAMPLE== [...] > Is that currently doable? I think so. Not trivial, but doable nonetheless. --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(IntroTechContracts)}}} --8<---------------cut here---------------end--------------->8--- Regards, -- Nicolas Goaziou 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 16:46:02 -0600 Message-ID: References: <87k3d5nuiw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b3430de6f66fb04f1ece1ae Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCGfg-0002Tr-Gb for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 17:46:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCGfc-0007rC-D7 for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 17:46:48 -0500 Received: from mail-vc0-f174.google.com ([209.85.220.174]:59899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCGfc-0007qo-7s for emacs-orgmode@gnu.org; Sat, 08 Feb 2014 17:46:44 -0500 Received: by mail-vc0-f174.google.com with SMTP id im17so3674690vcb.5 for ; Sat, 08 Feb 2014 14:46:43 -0800 (PST) In-Reply-To: <87k3d5nuiw.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 --047d7b3430de6f66fb04f1ece1ae Content-Type: text/plain; charset=ISO-8859-1 That works -- please email me privately with where to send the $100 via PayPal. Thanks! (Org-mode maintainer [Bastien, still?], can you please let me know if / when this gets implemented in an official release.) Regards, D. C. *D. C. Toedt III * *(my** last name is pronounced "Tate") * Attorney and neutral arbitrator -- tech contracts and intellectual property dc@toedt.com LinkedIn: dctoedt Calendar (redacted) O: +1 (713) 364-6545 C: +1 (713) 516-8968 Houston, Texas (Central time zone) *Common Draft* annotated collection of contract clauses Unless expressly stated otherwise, this message is not intended to serve as an electronic signature nor as assent to an agreement. On Sat, Feb 8, 2014 at 3:50 PM, Nicolas Goaziou wrote: > Hello, > > "D. C. Toedt" writes: > > > QUESTION: When org-mode headings are NUMBERED, and the file is exported > to > > HTML, is there any way to have org-mode include the TITLE, not just the > > section number, of a cross-referenced section, along the lines of the > LaTex > > \nameref{} function? Here's an example: > > > > ==BEGIN EXAMPLE== > > > > #+OPTIONS: H:7 TOC:nil @:t 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 [[#IntroTechContracts]]. > > > > ==END EXAMPLE== > > [...] > > > Is that currently doable? > > I think so. Not trivial, but doable nonetheless. > > --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(IntroTechContracts)}}} > --8<---------------cut here---------------end--------------->8--- > > > Regards, > > -- > Nicolas Goaziou > --047d7b3430de6f66fb04f1ece1ae Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
That works -- please email me privately= with where to send the $100 via PayPal. =A0Thanks!

(Org-mode maintainer [Bastien, still?], can yo= u please let me know if / when this gets implemented in an official release= .)

Regards,

D. C.

D
. C. Toedt III=A0
=A0(my
=A0last name is pronounced "Tate")=A0
Attorney and neutra= l arbitrator -- tech contracts and intellectual property

dc@toedt.com=A0 =A0 =A0LinkedIn:=A0dctoedt=A0 =A0=A0C= alendar= =A0(redacted)
O: +1 (713) 364-6545 =A0 = =A0C: +1 (713= ) 516-8968
=A0 =A0=A0
Houston, Texas (Central time zone)
=
Common Draft=A0annotated collection of contract clauses

Unless expressly stated otherwise= , this message is not intended=A0
to serve as an electro= nic signature nor as=A0assent to an agreement.




On Sat, Feb 8, 2014 at 3:50 PM, Nicolas = Goaziou <n.goaziou@gmail.com> wrote:
Hello,
[...]

> Is that currently doable?

I think so. Not trivial, but doable nonetheless.

--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
=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(IntroTechContracts)}}}=
--8<---------------cut here---------------end--------------->8---


Regards,

--
Nicolas Goaziou

--047d7b3430de6f66fb04f1ece1ae-- 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-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Sun, 09 Feb 2014 09:19:52 +0100 Message-ID: <87zjm0pujb.fsf@bzg.ath.cx> References: <87k3d5nuiw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCPcO-0006a1-Si for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 03:20:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCPcJ-0002iN-Fg for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 03:20:00 -0500 Received: from rs249.mailgun.us ([209.61.151.249]:43554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCPcJ-0002gc-A0 for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 03:19:55 -0500 In-Reply-To: (D. C. Toedt's message of "Sat, 8 Feb 2014 16:46:02 -0600") 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: "D. C. Toedt" Cc: emacs-orgmode@gnu.org, Nicolas Goaziou Hello, "D. C. Toedt" writes: > (Org-mode maintainer [Bastien, still?], can you please let me know if > / when this gets implemented in an official release.) I'm not Org's maintainer anymore, I'm just /de facto/ taking decisions in accordance with the other core maintainers, our level of trust lets us move forward happily. To come back to you original question: ,---- | #+OPTIONS: H:7 TOC:nil @:t 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 [[#IntroTechContracts]]. `---- Why don't you use [[#IntroTechContracts][Introduction to Technology Contracts]] as a link? It is the link stored by org-store-link, and later inserted by org-insert-link, and AFAICS it is correctly exported. But it's true there are a few things we can make more consistent in this area though, so thanks for bringing this up. Best, -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Sun, 09 Feb 2014 09:29:33 +0100 Message-ID: <87fvnsofiq.fsf@gmail.com> References: <87k3d5nuiw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCPlO-00009p-N5 for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 03:29:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCPlH-0004wB-SP for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 03:29:18 -0500 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]:41999) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCPlH-0004w7-KY for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 03:29:11 -0500 Received: by mail-wg0-f43.google.com with SMTP id y10so3303743wgg.34 for ; Sun, 09 Feb 2014 00:29:10 -0800 (PST) In-Reply-To: (D. C. Toedt's message of "Sat, 8 Feb 2014 18:04:49 -0600") 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: "D. C. Toedt" Cc: emacs-orgmode@gnu.org "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 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 05:51:02 -0600 Message-ID: References: <87k3d5nuiw.fsf@gmail.com> <87zjm0pujb.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b66f00fc27f6704f1f7d8f3 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCSvN-0000Nz-Tu for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 06:51:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCSvH-0004FB-SP for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 06:51:49 -0500 Received: from mail-ve0-f175.google.com ([209.85.128.175]:57787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCSvH-0004F2-Ng for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 06:51:43 -0500 Received: by mail-ve0-f175.google.com with SMTP id c14so4100549vea.20 for ; Sun, 09 Feb 2014 03:51:43 -0800 (PST) In-Reply-To: <87zjm0pujb.fsf@bzg.ath.cx> 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: Bastien Cc: emacs-orgmode@gnu.org, Nicolas Goaziou --047d7b66f00fc27f6704f1f7d8f3 Content-Type: text/plain; charset=ISO-8859-1 > Why don't you use [[#IntroTechContracts][Introduction to Technology Contracts]] as a link? I routinely tweak the text of the target headings as I edit the document. For example, the section heading "Introduction to Technology Contracts" might become, say, "Introduction: Why Technology Contracts are Fun." I don't want to have to manually revise the link text for the many internal cross-reference links that exist in the document. I'd really like to have a way for a link to automatically retrieve the heading text during HTML export. On Sun, Feb 9, 2014 at 2:19 AM, Bastien wrote: > Hello, > > "D. C. Toedt" writes: > > > (Org-mode maintainer [Bastien, still?], can you please let me know if > > / when this gets implemented in an official release.) > > I'm not Org's maintainer anymore, I'm just /de facto/ taking decisions > in accordance with the other core maintainers, our level of trust lets > us move forward happily. > > To come back to you original question: > > ,---- > | #+OPTIONS: H:7 TOC:nil @:t 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 [[#IntroTechContracts]]. > `---- > > Why don't you use > > [[#IntroTechContracts][Introduction to Technology Contracts]] > > as a link? It is the link stored by org-store-link, and later > inserted by org-insert-link, and AFAICS it is correctly exported. > > But it's true there are a few things we can make more consistent > in this area though, so thanks for bringing this up. > > Best, > > -- > Bastien > --047d7b66f00fc27f6704f1f7d8f3 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
>=A0Why don't you use=A0[[#IntroTechContracts][<= span style=3D"font-size:13px;font-family:arial,sans-serif">Introduction to = Technology Contracts]]
=A0as a link?

I routinely tweak the text of the target headings as I edit the document. = =A0For example, the section heading "Introduction to Technology Contra= cts" might become, say, "Introduction: =A0Why Technology Contract= s are Fun." =A0

I don't want to have to manually revise the link text for the many inte= rnal cross-reference links that exist in the document. =A0I'd really li= ke to have a way for a link to automatically retrieve the heading text duri= ng HTML export.
--047d7b66f00fc27f6704f1f7d8f3-- 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-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Sun, 09 Feb 2014 23:36:14 +0100 Message-ID: <87txc7ncbl.fsf@gmail.com> References: <87k3d5nuiw.fsf@gmail.com> <87fvnsofiq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCcyk-0000Nd-SC for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 17:36:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCcye-0008Dv-WA for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 17:35:58 -0500 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:43219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCcye-0008Dm-PQ for emacs-orgmode@gnu.org; Sun, 09 Feb 2014 17:35:52 -0500 Received: by mail-wi0-f179.google.com with SMTP id hn9so2277935wib.6 for ; Sun, 09 Feb 2014 14:35:52 -0800 (PST) In-Reply-To: (D. C. Toedt's message of "Sun, 9 Feb 2014 06:08:17 -0600") 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: "D. C. Toedt" Cc: emacs-orgmode@gnu.org "D. C. Toedt" writes: > --- is there a comparable one (or arguments) to get the section number of a > heading? There is `org-export-get-headline-number' but is only accessible during export, so it cannot be called from a macro or a Babel block. Anyway, in your case, you just need to use [[#custom-id]]. Regards, -- Nicolas Goaziou From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Mon, 10 Feb 2014 09:44:42 +0100 Message-ID: <878utjbblx.fsf@bzg.ath.cx> References: <87k3d5nuiw.fsf@gmail.com> <87fvnsofiq.fsf@gmail.com> <87txc7ncbl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCmU4-0003TI-3l for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 03:45:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCmTw-0001Gx-K0 for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 03:44:56 -0500 Received: from rs249.mailgun.us ([209.61.151.249]:46393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCmTw-0001Gs-Fz for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 03:44:48 -0500 In-Reply-To: <87txc7ncbl.fsf@gmail.com> (Nicolas Goaziou's message of "Sun, 09 Feb 2014 23:36:14 +0100") 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: "D. C. Toedt" , emacs-orgmode@gnu.org I think the whole thread calls for a variable to let the user configure the way she wants references to be inserted. Because \nameref could be useful in LaTeX/Beamer too. And maybe ODT could enjoy such a function too. Nicolas, what do you think? -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref? Date: Mon, 10 Feb 2014 17:38:50 +0100 Message-ID: <87d2iuncrp.fsf@gmail.com> References: <87k3d5nuiw.fsf@gmail.com> <87fvnsofiq.fsf@gmail.com> <87txc7ncbl.fsf@gmail.com> <878utjbblx.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCtsS-0003Vp-N8 for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 11:38:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCtsM-0003tA-C6 for emacs-orgmode@gnu.org; Mon, 10 Feb 2014 11:38:36 -0500 In-Reply-To: <878utjbblx.fsf@bzg.ath.cx> (Bastien's message of "Mon, 10 Feb 2014 09:44:42 +0100") 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: Bastien Cc: "D. C. Toedt" , emacs-orgmode@gnu.org Hello, Bastien writes: > I think the whole thread calls for a variable to let the user > configure the way she wants references to be inserted. > > Because \nameref could be useful in LaTeX/Beamer too. Internal links in Beamer are complicated, because there's no way to know which slide we're referring to. So I don't think \nameref would help here. > And maybe ODT could enjoy such a function too. > > Nicolas, what do you think? This is something that cannot be easily achieved with filters, so it could make sense to have a defcustom, or maybe two (one when headlines are numbered and another one when they are not). Anyway, patches welcome. Regards, -- Nicolas Goaziou