소스 검색

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 년 전
부모
커밋
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