summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-06-18 08:49:25 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2010-06-18 08:49:25 +0200
commitc201da51b88703a71e6eda64b52d53a5441c594f (patch)
tree5a1618af80d6a25aeef453d0246886b86a6c5b3a
parent4096c92e89fa2972ed0f83ce3442c97b0ac6b83e (diff)
downloadorg-mode-c201da51b88703a71e6eda64b52d53a5441c594f.tar.gz
Fix source code example bug with plain list export to HTML
* lisp/org-exp.el (org-export-format-source-code-or-example): Mark examples by a property. o * lisp/org-html.el (org-export-html-close-lists-maybe): Check if raw HTML stuff was actually made from an example Daniel Mahler writes: > 2. I would like to embed source blocks in numbered lists, without > breaking the numbering ie: > > 1) get ready > #+BEGIN_SRC sh > get_ready > #+END_SRC > 2) go > #+BEGIN_SRC sh > go > #+END_SRC > > currently the src blocks cause the numbering to reset, so all > items in a sequence like this are numbered 1 This patch fixes this issue - but I cannot say anymore why the code in org-export-html-close-lists-maybe does in fact work. The code looks wrong, but it seems to work. What looks wrong is that i does not check for the true indentation in the case when the line is not protected. It must be that this case is covered by some other code further down in the exporter.
-rw-r--r--lisp/org-exp.el8
-rw-r--r--lisp/org-html.el10
2 files changed, 12 insertions, 6 deletions
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 919288a..cd979c7 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -2147,7 +2147,7 @@ INDENT was the original indentation of the block."
(org-add-props (concat "<programlisting><![CDATA["
rtn
"]]></programlisting>\n")
- '(org-protected t))
+ '(org-protected t org-example t))
"#+END_DOCBOOK\n"))
((eq backend 'html)
;; We are exporting to HTML
@@ -2217,7 +2217,7 @@ INDENT was the original indentation of the block."
cont rpllbl fmt)))
(if (string-match "\\(\\`<[^>]*>\\)\n" rtn)
(setq rtn (replace-match "\\1" t nil rtn)))
- (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t)) "\n#+END_HTML\n\n"))
+ (concat "\n#+BEGIN_HTML\n" (org-add-props rtn '(org-protected t org-example t)) "\n#+END_HTML\n\n"))
((eq backend 'latex)
(setq rtn (org-export-number-lines rtn 'latex 0 0 num cont rpllbl fmt))
(concat "#+BEGIN_LaTeX\n"
@@ -2241,7 +2241,7 @@ INDENT was the original indentation of the block."
rtn "\\end{lstlisting}\n")
(concat (car org-export-latex-verbatim-wrap)
rtn (cdr org-export-latex-verbatim-wrap)))
- '(org-protected t))
+ '(org-protected t org-example t))
"#+END_LaTeX\n"))
((eq backend 'ascii)
;; This is not HTML or LaTeX, so just make it an example.
@@ -2255,7 +2255,7 @@ INDENT was the original indentation of the block."
(org-split-string rtn "\n")
"\n")
"\n")
- '(org-protected t))
+ '(org-protected t org-example t))
"#+END_ASCII\n"))))
(org-add-props rtn nil 'original-indentation indent))))
diff --git a/lisp/org-html.el b/lisp/org-html.el
index d5809ab..4a6ded4 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -2146,11 +2146,17 @@ If there are links in the string, don't modify these."
(defvar local-list-indent)
(defvar local-list-type)
(defun org-export-html-close-lists-maybe (line)
+ "Close local lists based on the original indentation of the line."
(let* ((rawhtml (and in-local-list
- (get-text-property 0 'org-protected line)))
+ (get-text-property 0 'org-protected line)
+ (not (get-text-property 0 'org-example line))))
+ ;; rawhtml means: This was between #+begin_html..#+end_html
+ ;; originally, thus it excludes stuff that was a source code example
+ ;; Actually, this code seems wrong, I don't know why it works, but
+ ;; it seems to work.... So keep it like this for now.
(ind (if rawhtml
(org-get-indentation line)
- (or (get-text-property 0 'original-indentation line))))
+ (get-text-property 0 'original-indentation line)))
didclose)
(when ind
(while (and in-local-list