emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [PATCH] Change underscores to hyphens for HTML export


From: Nick Dokos
Subject: [O] [PATCH] Change underscores to hyphens for HTML export
Date: Mon, 13 Jun 2011 12:28:05 -0400

>From 28c0b3afce11a8e2bd452ccab44b96c00a4401ca Mon Sep 17 00:00:00 2001
From: Nick Dokos <address@hidden>
Date: Sat, 11 Jun 2011 23:38:09 -0400
Subject: [PATCH] Change underscores to hyphens for HTML export

* lisp/org-html.el (org-export-as-html): changed underscores to hyphens in 
section number.
(org-html-level-start): ditto.

Daniel Clemente reported that after commit
438536f6157794101ce0957e39cad6bf70580751 which changed underscores to
hyphens in org-exp.el, he had problems exporting HTML files that used
to work. In particular, org files that used CUSTOM_ID properties were
broken.

This patch is a minimal fix for this problem: it changes underscores
to hyphens in section numbers only. Daniel has tested the fix on an
extensive collection of org files and reports that no additional
problems have surfaced. There are other places in org-html where
underscores are used, so there may be additional problems: if any are
found, they should be fairly straightforward to fix (as this problem
was).

Many thanks to Daniel for findind and reporting the problem and testing
the fix on a large collection of his org files.

TINYCHANGE

Signed-off-by: Nick Dokos <address@hidden>
---
 lisp/org-html.el |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

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
-- 
1.7.5.1.169.g505a1




reply via email to

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