From 8d6dbe857b112821b964aec7eea8cdd4a39666f3 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 10 Mar 2008 16:39:58 +0100 Subject: [PATCH] Better div structure in HTML output. --- ChangeLog | 8 ++++++++ org.el | 29 +++++++++++++++++------------ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ad49dc9c..4072ffb9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-03-10 Carsten Dominik + + * org.el (org-html-level-start): Always have id's in HTML + headlines, even if there is no TOC to jump from. Put extra + in. One around the toc, one around the text between a headline + and its first subsection. Insert ids into div's that surround + whole sections including subsections. + 2008-03-10 Bastien Guerry * org.el (org-select-remember-template): Cleaned the code. diff --git a/org.el b/org.el index b5fcc6b6f..10b71dd11 100644 --- a/org.el +++ b/org.el @@ -25651,6 +25651,7 @@ PUB-DIR is set, use this as the publishing directory." table-buffer table-orig-buffer ind start-is-num starter didclose rpl path desc descp desc1 desc2 link + snumber ) (let ((inhibit-read-only t)) @@ -25727,6 +25728,7 @@ lang=\"%s\" xml:lang=\"%s\"> (nth 3 lang-words) org-export-html-toplevel-hlevel) thetoc) + (push "
\n" thetoc) (push "
    \n
  • " thetoc) (setq lines (mapcar '(lambda (line) @@ -25755,9 +25757,9 @@ lang=\"%s\" xml:lang=\"%s\"> (setq txt (replace-match "    \\1" t nil txt))) (if (string-match quote-re0 txt) (setq txt (replace-match "" t t txt))) + (setq snumber (org-section-number level)) (if org-export-with-section-numbers - (setq txt (concat (org-section-number level) - " " txt))) + (setq txt (concat snumber " " txt))) (if (<= level (max umax umax-toc)) (setq head-count (+ head-count 1))) (if (<= level umax-toc) @@ -25781,16 +25783,16 @@ lang=\"%s\" xml:lang=\"%s\"> (concat "@" tg "@ ") t t line)) (push (cons (org-solidify-link-text tg) - (format "sec-%d" head-count)) + (format "sec-%s" snumber)) target-alist)) (while (string-match "<\\(<\\)+\\|>\\(>\\)+" txt) (setq txt (replace-match "" t t txt))) (push (format (if todo - "
  • \n
  • %s" - "
  • \n
  • %s") - head-count txt) thetoc) + "
  • \n
  • %s" + "
  • \n
  • %s") + snumber txt) thetoc) (setq org-last-level level)) ))) @@ -25799,6 +25801,7 @@ lang=\"%s\" xml:lang=\"%s\"> (while (> org-last-level (1- org-min-level)) (setq org-last-level (1- org-last-level)) (push "
  • \n
\n" thetoc)) + (push "
\n" thetoc) (setq thetoc (if have-headings (nreverse thetoc) nil)))) (setq head-count 0) @@ -26120,6 +26123,8 @@ lang=\"%s\" xml:lang=\"%s\"> (org-html-level-start 1 nil umax (and org-export-with-toc (<= level umax)) head-count) + ;; the to lose the last text-... div. + (insert "\n") (unless body-only (when (plist-get opt-plist :auto-postamble) @@ -26665,7 +26670,7 @@ stacked delimiters is N. Escaping delimiters is not possible." "Insert a new level in HTML export. When TITLE is nil, just close all open levels." (org-close-par-maybe) - (let ((l org-level-max)) + (let ((l org-level-max) snumber) (while (>= l level) (if (aref org-levels-open (1- l)) (progn @@ -26697,13 +26702,13 @@ When TITLE is nil, just close all open levels." (org-close-par-maybe) (insert "
    \n
  • " title "
    \n"))) (aset org-levels-open (1- level) t) + (setq snumber (org-section-number level)) (if (and org-export-with-section-numbers (not body-only)) - (setq title (concat (org-section-number level) " " title))) + (setq title (concat snumber " " title))) (setq level (+ level org-export-html-toplevel-hlevel -1)) - (if with-toc - (insert (format "\n
    \n%s\n" - level level head-count title level)) - (insert (format "\n
    \n%s\n" level level title level))) + (unless (= head-count 1) (insert "\n
    \n")) + (insert (format "\n
    \n%s\n
    \n" + snumber level level snumber title level snumber)) (org-open-par))))) (defun org-html-level-close (level max-outline-level)