Просмотр исходного кода

Fix bug in HTML export of code blocks with starting blank lines

* lisp/ox-html.el (org-html-do-format-code): Preverse starting blank
  lines when splitting code lines (use `split-string' instead of
  `org-split-string').

  (org-html-fontify-code): Preserve starting blank lines in returned
  code string.
thibault 8 лет назад
Родитель
Сommit
e22ee8b8a3
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      lisp/ox-html.el

+ 2 - 2
lisp/ox-html.el

@@ -2202,7 +2202,7 @@ https://github.com/hniksic/emacs-htmlize"))
 		      (org-html-htmlize-region-for-paste
 		      (org-html-htmlize-region-for-paste
 		       (point-min) (point-max))))))
 		       (point-min) (point-max))))))
 	  ;; Strip any enclosing <pre></pre> tags.
 	  ;; Strip any enclosing <pre></pre> tags.
-	  (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
+	  (let* ((beg (and (string-match "\\`<pre[^>]*>\n?" code) (match-end 0)))
 		 (end (and beg (string-match "</pre>\\'" code))))
 		 (end (and beg (string-match "</pre>\\'" code))))
 	    (if (and beg end) (substring code beg end) code)))))))))
 	    (if (and beg end) (substring code beg end) code)))))))))
 
 
@@ -2215,7 +2215,7 @@ alist between line numbers and references (as returned by
 `org-export-unravel-code'), a boolean specifying if labels should
 `org-export-unravel-code'), a boolean specifying if labels should
 appear in the source code, and the number associated to the first
 appear in the source code, and the number associated to the first
 line of code."
 line of code."
-  (let* ((code-lines (org-split-string code "\n"))
+  (let* ((code-lines (split-string code "\n"))
 	 (code-length (length code-lines))
 	 (code-length (length code-lines))
 	 (num-fmt
 	 (num-fmt
 	  (and num-start
 	  (and num-start