소스 검색

org-exp: ensure list ending marker is inserted on a line on its own

* lisp/org-exp.el (org-export-mark-list-ending): insert additional
  newline characters if end-list-marker is at a wrong position.

This solves a problem arising when exporting a region to HTML with a
list ending at the end of region. The marker would then be inserted on
the last line, following text from the list.
Nicolas Goaziou 14 년 전
부모
커밋
478eabccbd
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      lisp/org-exp.el

+ 4 - 1
lisp/org-exp.el

@@ -1669,7 +1669,10 @@ These special cookies will later be interpreted by the backend.
 	     (when (and (not (eq org-list-ending-method 'indent))
 	     (when (and (not (eq org-list-ending-method 'indent))
 			(looking-at (org-list-end-re)))
 			(looking-at (org-list-end-re)))
 	       (replace-match "\n"))
 	       (replace-match "\n"))
-	     (insert end-list-marker)))))
+	     (unless (bolp) (insert "\n"))
+	     (unless (looking-at end-list-marker)
+	       (insert end-list-marker))
+	     (unless (eolp) (insert "\n"))))))
   ;; We need to divide backends into 3 categories.
   ;; We need to divide backends into 3 categories.
   (cond
   (cond
    ;; 1. Backends using `org-list-parse-list' do not need markers.
    ;; 1. Backends using `org-list-parse-list' do not need markers.