emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Change underscores to hyphens for HTML export
@ 2011-06-13 16:28 Nick Dokos
  2011-06-14  8:46 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Dokos @ 2011-06-13 16:28 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: nicholas.dokos

From 28c0b3afce11a8e2bd452ccab44b96c00a4401ca Mon Sep 17 00:00:00 2001
From: Nick Dokos <nick@dokosmarshall.org>
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 <nick@dokosmarshall.org>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Change underscores to hyphens for HTML export
  2011-06-13 16:28 [PATCH] Change underscores to hyphens for HTML export Nick Dokos
@ 2011-06-14  8:46 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2011-06-14  8:46 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Applied, thanks.

- Carsten

On Jun 13, 2011, at 6:28 PM, Nick Dokos wrote:

> From 28c0b3afce11a8e2bd452ccab44b96c00a4401ca Mon Sep 17 00:00:00 2001
> From: Nick Dokos <nick@dokosmarshall.org>
> 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 <nick@dokosmarshall.org>
> ---
> 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
> 
> 

- Carsten

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-06-14  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-13 16:28 [PATCH] Change underscores to hyphens for HTML export Nick Dokos
2011-06-14  8:46 ` Carsten Dominik

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).