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.
This commit is contained in:
parent
4096c92e89
commit
c201da51b8
|
@ -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))))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue