Browse Source

HTML export: Do not allow protected lines into the TOC

Daniel Clemente writesL

> Hi, I found an HTML export bug with org-mode 6.34c-140-g44c8 and
> older. I used:
>
> --------------------------------------------------------
> * only one section
> #+BEGIN_EXAMPLE:
>
>  We need:
>  ,* pears
>  ,* lettuce
>  ,* watermelons
>
>  Very important!
> #+END_EXAMPLE:
> --------------------------------------------------------
>
>  And the outputed table of contents had this code:
>
> --------------------------------------------------------
> <div id="text-table-of-contents">
> <ul>
> <li><a href="#sec-1">1 only one section </a></li>
> <li><a href="#sec-2">2 pears</a></li>
> <li><a href="#sec-3">3 lettuce</a></li>
> <li><a href="#sec-4">4 watermelons</a></li>
> </ul>
> </div>
> --------------------------------------------------------
>
> This is wrong because the asterisks inside the example don't
> represent headers. There should be only one header.
Carsten Dominik 15 years ago
parent
commit
cff060f3ac
2 changed files with 5 additions and 1 deletions
  1. 3 0
      lisp/ChangeLog
  2. 2 1
      lisp/org-html.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2010-03-03  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-html.el (org-export-as-html): Do not allow protected lines
+	into the table of contents.
+
 	* org-latex.el (org-export-latex-special-chars): Find subsequent
 	occurrences of special characters.
 	(org-export-latex-tables): Do not convert table-like stuff that is

+ 2 - 1
lisp/org-html.el

@@ -809,7 +809,8 @@ lang=\"%s\" xml:lang=\"%s\">
 	    (push "<ul>\n<li>" thetoc)
 	    (setq lines
 		  (mapcar '(lambda (line)
-		    (if (string-match org-todo-line-regexp line)
+		    (if (and (string-match org-todo-line-regexp line)
+			     (not (get-text-property 0 'org-protected line)))
 			;; This is a headline
 			(progn
 			  (setq have-headings t)