From e8394dcbcf30d529d3bed1cf16545dbfcb303ef1 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 3 Sep 2008 10:50:10 +0200 Subject: [PATCH] Fix example indentation for export. Patch from Bernt Hansen. --- lisp/ChangeLog | 4 ++++ lisp/org-exp.el | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index aab8bc933..a99edbef8 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,10 @@ * org-exp.el (org-export-as-html): Fixed typo in creator information. + (org-export-protect-examples): New parameter indent. Insert extra + spaces only when this parameter is specified. + (org-export-preprocess-string): Call `org-export-protect-examples' + with an indentation parameter when exporting to ASCII. * org-remember.el (org-remember-templates) (org-remember-apply-template): Allow the file component to be a diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 9a464dd74..e091356ac 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1386,7 +1386,7 @@ on this string to produce the exported version." (setq target-alist (org-export-handle-invisible-targets target-alist)) ;; Protect examples - (org-export-protect-examples) + (org-export-protect-examples (if asciip 'indent nil)) ;; Protect backend specific stuff, throw away the others. (org-export-select-backend-specific-text @@ -1591,13 +1591,13 @@ from the buffer." '(org-protected t)) (goto-char (1+ (match-end 4))))) -(defun org-export-protect-examples () +(defun org-export-protect-examples (&optional indent) "Protect code that should be exported as monospaced examples." (goto-char (point-min)) (while (re-search-forward "^#\\+BEGIN_EXAMPLE[ \t]*\n" nil t) (goto-char (match-end 0)) (while (and (not (looking-at "#\\+END_EXAMPLE")) (not (eobp))) - (insert ": ") + (insert (if indent ": " ":")) (beginning-of-line 2))) (goto-char (point-min)) (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) -- 2.11.4.GIT