From c370a5300bc4761b8f57dd38b37efbb873a65381 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sat, 24 Apr 2010 17:37:39 +0200 Subject: [PATCH] Modify xhtml IDs to comply with CSS standards --- lisp/ChangeLog | 9 +++++++++ lisp/org-docbook.el | 3 ++- lisp/org-exp.el | 4 +++- lisp/org-html.el | 15 +++++++++------ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2623ffaeb..1ba45d028 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,14 @@ 2010-04-25 Carsten Dominik + * org-html.el (org-export-as-html, org-html-level-start): Change + XHTML IDs to not use dots. + + * org-exp.el (org-export-define-heading-targets): Change + XHTML IDs to not use dots. + + * org-docbook.el (org-export-docbook-level-start): Change + XHTML IDs to not use dots. + * org-latex.el (org-export-as-latex): Make sure that the result buffer is in latex-mode. diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index de9ffcc57..bb8d048bf 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -1228,7 +1228,8 @@ When TITLE is nil, just close all open levels." (setq section-number (org-section-number level)) (insert (format "\n
\n%s" org-export-docbook-section-id-prefix - section-number title)) + (replace-regexp-in-string "\\." "_" section-number) + title)) (org-export-docbook-open-para)))) (defun org-docbook-expand (string) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index da8e1a4be..44bde65bd 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1239,7 +1239,9 @@ Also find all ID and CUSTOM_ID propertiess and store them." (save-excursion (goto-char (point-at-bol)) (org-outline-level)))) (setq target (org-solidify-link-text - (format "sec-%s" (org-section-number level)))) + (format "sec-%s" (replace-regexp-in-string + "\\." "_" + (org-section-number level))))) (setq last-section-target target) (push (cons target target) target-alist) (add-text-properties diff --git a/lisp/org-html.el b/lisp/org-html.el index 71f62ebfd..92798d211 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -871,7 +871,9 @@ lang=\"%s\" xml:lang=\"%s\"> t t line))) (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) (setq txt (replace-match "" t t txt))) - (setq href (format "sec-%s" snumber)) + (setq href + (replace-regexp-in-string + "\\." "_" (format "sec-%s" snumber))) (setq href (or (cdr (assoc href org-export-preferred-target-alist)) href)) (push (format @@ -2027,7 +2029,7 @@ When TITLE is nil, just close all open levels." (cdr (assoc target org-export-preferred-target-alist)))) (remove (or preferred target)) (l org-level-max) - snumber href suffix) + snumber snu href suffix) (setq extra-targets (remove remove extra-targets)) (setq extra-targets (mapconcat (lambda (x) @@ -2076,7 +2078,8 @@ When TITLE is nil, just close all open levels." extra-targets title "
\n") (insert "
    \n
  • " title "
    \n")))) (aset org-levels-open (1- level) t) - (setq snumber (org-section-number level)) + (setq snumber (org-section-number level) + snu (replace-regexp-in-string "\\." "_" snumber)) (setq level (+ level org-export-html-toplevel-hlevel -1)) (if (and org-export-with-section-numbers (not body-only)) (setq title (concat @@ -2084,9 +2087,9 @@ When TITLE is nil, just close all open levels." level snumber) " " title))) (unless (= head-count 1) (insert "\n\n")) - (setq href (cdr (assoc (concat "sec-" snumber) org-export-preferred-target-alist))) - (setq suffix (or href snumber)) - (setq href (or href (concat "sec-" snumber))) + (setq href (cdr (assoc (concat "sec-" snu) org-export-preferred-target-alist))) + (setq suffix (or href snu)) + (setq href (or href (concat "sec-" snu))) (insert (format "\n
    \n%s%s\n
    \n" suffix level (if extra-class (concat " " extra-class) "") level href -- 2.11.4.GIT