diff options
Diffstat (limited to 'lisp/ox-ascii.el')
-rw-r--r-- | lisp/ox-ascii.el | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/ox-ascii.el b/lisp/ox-ascii.el index 6208cdb..b4efa53 100644 --- a/lisp/ox-ascii.el +++ b/lisp/ox-ascii.el @@ -192,8 +192,10 @@ original Org buffer at the same place." (defcustom org-ascii-indented-line-width 'auto "Additional indentation width for the first line in a paragraph. If the value is an integer, indent the first line of each -paragraph by this number. If it is the symbol `auto' preserve -indentation from original document." +paragraph by this width, unless it is located at the beginning of +a section, in which case indentation is removed from that line. +If it is the symbol `auto' preserve indentation from original +document." :group 'org-export-ascii :version "24.4" :package-version '(Org . "8.0") @@ -455,7 +457,7 @@ HOW determines the type of justification: it can be `left', Empty lines are not indented." (when (stringp s) (replace-regexp-in-string - "\\(^\\)\\(?:.*\\S-\\)" (make-string width ? ) s nil nil 1))) + "\\(^\\)[ \t]*\\S-" (make-string width ?\s) s nil nil 1))) (defun org-ascii--box-string (s info) "Return string S with a partial box to its left. @@ -473,7 +475,7 @@ INFO is a plist used as a communication channel." (case (org-element-type element) ;; Elements with an absolute width: `headline' and `inlinetask'. (inlinetask org-ascii-inlinetask-width) - ('headline + (headline (- org-ascii-text-width (let ((low-level-rank (org-export-low-level-p element info))) (if low-level-rank (* low-level-rank 2) org-ascii-global-margin)))) @@ -1418,12 +1420,16 @@ INFO is a plist holding contextual information." "Transcode a PARAGRAPH element from Org to ASCII. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." - (let ((contents (if (not (wholenump org-ascii-indented-line-width)) contents - (concat - (make-string org-ascii-indented-line-width ? ) - (replace-regexp-in-string "\\`[ \t]+" "" contents))))) - (org-ascii--fill-string - contents (org-ascii--current-text-width paragraph info) info))) + (org-ascii--fill-string + (if (not (wholenump org-ascii-indented-line-width)) contents + (concat + ;; Do not indent first paragraph in a section. + (unless (and (not (org-export-get-previous-element paragraph info)) + (eq (org-element-type (org-export-get-parent paragraph)) + 'section)) + (make-string org-ascii-indented-line-width ?\s)) + (replace-regexp-in-string "\\`[ \t]+" "" contents))) + (org-ascii--current-text-width paragraph info) info)) ;;;; Plain List @@ -1591,8 +1597,8 @@ contextual information." CONTENTS is the contents of the object. INFO is a plist holding contextual information." (if (org-element-property :use-brackets-p superscript) - (format "_{%s}" contents) - (format "_%s" contents))) + (format "^{%s}" contents) + (format "^%s" contents))) ;;;; Strike-through |