emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] custom IDs not exported


From: Nick Dokos
Subject: Re: [O] custom IDs not exported
Date: Sat, 11 Jun 2011 23:12:26 -0400

Daniel Clemente <address@hidden> wrote:

> 
>   Commit 438536f6157794101ce0957e39cad6bf70580751 (=E2=80=9EChange undersco=
> res to hyphens in section labels=E2=80=9C) broke the export of CUSTOM_IDs.
> 
>   Take for instance this file:
> 
> -----------------------
> #+TITLE: Cosas por hacer
> 
> * Programas
>   :PROPERTIES:
>   :CUSTOM_ID: programas
>   :END:
> 
> ** emacs
>    :PROPERTIES:
>    :CUSTOM_ID: emacs
>    :END:
> Editor de textos
> 
> ------------------------
> 
> 
>   When exporting (C-c C-e H) you get this table of contents:
> 
> ------------------------
> <div id=3D"text-table-of-contents">
> <ul>
> <li><a href=3D"#programas">1 Programas </a>
> <ul>
> <li><a href=3D"#sec-1_1">1.1 emacs </a></li>
> </ul>
> </li>
> </ul>
> </div>
> 
> -------------------------
> 
>   The first one is correct because it is first-level. All non-first-level g=
> et #sec-NUMBERS instead of the custom ID.
> 
>   Not only the table of contents; the header's ID is also wrong:
> <h3 id=3D"sec-1_1"><a name=3D"sec-1-1" id=3D"sec-1-1"></a><span class=3D"se=
> ction-number-3">1.1</span> emacs </h3>
> 
> 
>   Tested with current org-mode.=20
> 

I was afraid that other exporters might break because of this. Apologies
for the inconvenience. And, btw, thanks for the test case.

I have a minimal patch that I think fixes this problem, but there are
other underscores used in various places in org-html.el so there might
be additional problems. I'd appreciate it if you (and/or others) test it
and report not only on this problem but on any other problems you find.

Thanks,
Nick

diff --git a/lisp/org-html.el b/lisp/org-html.el
index afc6a77..b5d371f 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1395,7 +1395,7 @@ lang=\"%s\" xml:lang=\"%s\">
                                           (setq txt (replace-match "" t t 
txt)))
                                         (setq href
                                               (replace-regexp-in-string
-                                               "\\." "_" (format "sec-%s" 
snumber)))
+                                               "\\." "-" (format "sec-%s" 
snumber)))
                                         (setq href (org-solidify-link-text (or 
(cdr (assoc href org-export-preferred-target-alist)) href)))
                                         (push
                                          (format
@@ -2412,7 +2412,7 @@ When TITLE is nil, just close all open levels."
                (insert "<ul>\n<li>" title "<br/>\n"))))
        (aset org-levels-open (1- level) t)
        (setq snumber (org-section-number level)
-             snu (replace-regexp-in-string "\\." "_" snumber))
+             snu (replace-regexp-in-string "\\." "-" snumber))
        (setq level (+ level org-export-html-toplevel-hlevel -1))
        (if (and num (not body-only))
            (setq title (concat




reply via email to

[Prev in Thread] Current Thread [Next in Thread]