Selaa lähdekoodia

ox-ascii: Fix filling with preserve break

* lisp/ox-ascii.el (org-ascii--fill-string): Allow filling even when
  `org-export-preserve-breaks' is non-nil.
Nicolas Goaziou 10 vuotta sitten
vanhempi
commit
1b17e8c8da
1 muutettua tiedostoa jossa 11 lisäystä ja 11 poistoa
  1. 11 11
      lisp/ox-ascii.el

+ 11 - 11
lisp/ox-ascii.el

@@ -423,17 +423,17 @@ equivalent to `left'.  For a justification that doesn't also fill
 string, see `org-ascii--justify-string'.
 
 Return nil if S isn't a string."
-  ;; Don't fill paragraph when break should be preserved.
-  (cond ((not (stringp s)) nil)
-	((plist-get info :preserve-breaks) s)
-	(t (let ((double-space-p sentence-end-double-space))
-	     (with-temp-buffer
-	       (let ((fill-column text-width)
-		     (use-hard-newlines t)
-		     (sentence-end-double-space double-space-p))
-		 (insert s)
-		 (fill-region (point-min) (point-max) justify))
-	       (buffer-string))))))
+  (when (stringp s)
+    (let ((double-space-p sentence-end-double-space))
+      (with-temp-buffer
+	(let ((fill-column text-width)
+	      (use-hard-newlines t)
+	      (sentence-end-double-space double-space-p))
+	  (insert (if (plist-get info :preserve-breaks)
+		      (replace-regexp-in-string "\n" hard-newline s)
+		    s))
+	  (fill-region (point-min) (point-max) justify))
+	(buffer-string)))))
 
 (defun org-ascii--justify-string (s text-width how)
   "Justify string S.