emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "D. C. Toedt" <dc@toedt.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Include heading title in HTML section-number cross-reference, like LaTex \nameref?
Date: Sun, 9 Feb 2014 06:08:17 -0600	[thread overview]
Message-ID: <CAGN11+3ho3NJfW8Xk2b95wuSdUQs31qgj0ULGavZKu76e+5EUQ@mail.gmail.com> (raw)
In-Reply-To: <87fvnsofiq.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]

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 <n.goaziou@gmail.com> wrote:

> "D. C. Toedt" <dc@toedt.com> 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
>

[-- Attachment #2: Type: text/html, Size: 4165 bytes --]

  reply	other threads:[~2014-02-09 12:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08 21:11 Include heading title in HTML section-number cross-reference, like LaTex \nameref? D. C. Toedt
2014-02-08 21:50 ` Nicolas Goaziou
2014-02-08 22:46   ` D. C. Toedt
2014-02-09  0:04     ` D. C. Toedt
2014-02-09  8:29       ` Nicolas Goaziou
2014-02-09 12:08         ` D. C. Toedt [this message]
2014-02-09 22:36           ` Nicolas Goaziou
2014-02-10  8:44             ` Bastien
2014-02-10 16:38               ` Nicolas Goaziou
2014-02-09  8:19     ` Bastien
2014-02-09 11:51       ` D. C. Toedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGN11+3ho3NJfW8Xk2b95wuSdUQs31qgj0ULGavZKu76e+5EUQ@mail.gmail.com \
    --to=dc@toedt.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).