emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: emacs-orgmode@gnu.org
Cc: nicholas.dokos@hp.com
Subject: [PATCH] Change underscores to hyphens for HTML export
Date: Mon, 13 Jun 2011 12:28:05 -0400	[thread overview]
Message-ID: <4199.1307982485@alphaville.americas.hpqcorp.net> (raw)

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

             reply	other threads:[~2011-06-13 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 16:28 Nick Dokos [this message]
2011-06-14  8:46 ` [PATCH] Change underscores to hyphens for HTML export Carsten Dominik

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=4199.1307982485@alphaville.americas.hpqcorp.net \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    /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).