Browse Source

Modify xhtml IDs to comply with CSS standards

Carsten Dominik 11 years ago
parent
commit
c370a5300b
4 changed files with 23 additions and 8 deletions
  1. 9 0
      lisp/ChangeLog
  2. 2 1
      lisp/org-docbook.el
  3. 3 1
      lisp/org-exp.el
  4. 9 6
      lisp/org-html.el

+ 9 - 0
lisp/ChangeLog

@@ -1,5 +1,14 @@
 2010-04-25  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* 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.
 

+ 2 - 1
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<section xml:id=\"%s%s\">\n<title>%s</title>"
 		      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)

+ 3 - 1
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

+ 9 - 6
lisp/org-html.el

@@ -871,7 +871,9 @@ lang=\"%s\" xml:lang=\"%s\">
 					      t t line)))
 				(while (string-match "&lt;\\(&lt;\\)+\\|&gt;\\(&gt;\\)+" 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 "<br/>\n")
 		(insert "<ul>\n<li>" title "<br/>\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</div>\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<div id=\"outline-container-%s\" class=\"outline-%d%s\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
 			suffix level (if extra-class (concat " " extra-class) "")
 			level href