Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2013-04-26 10:39:09 +02:00
commit 3b8f7b42cf
2 changed files with 24 additions and 3 deletions

View File

@ -1834,8 +1834,11 @@ Assume point is at the beginning of the fixed-width area."
(defun org-element-fixed-width-interpreter (fixed-width contents)
"Interpret FIXED-WIDTH element as Org syntax.
CONTENTS is nil."
(replace-regexp-in-string
"^" ": " (substring (org-element-property :value fixed-width) 0 -1)))
(let ((value (org-element-property :value fixed-width)))
(and value
(replace-regexp-in-string
"^" ": "
(if (string-match "\n\\'" value) (substring value 0 -1) value)))))
;;;; Horizontal Rule

View File

@ -2185,7 +2185,25 @@ CLOCK: [2012-01-01 sun. 00:01]--[2012-01-01 sun. 00:02] => 0:01"))
(should (equal (org-test-parse-and-interpret ": Test") ": Test\n"))
;; Preserve indentation.
(should (equal (org-test-parse-and-interpret ": 2 blanks\n: 1 blank")
": 2 blanks\n: 1 blank\n")))
": 2 blanks\n: 1 blank\n"))
;; Remove last newline character
(should
(equal (org-element-fixed-width-interpreter
'(fixed-width (:value "Test\n")) nil)
": Test"))
(should
(equal (org-element-fixed-width-interpreter
'(fixed-width (:value "Test")) nil)
": Test"))
;; Handle empty string.
(should
(equal (org-element-fixed-width-interpreter
'(fixed-width (:value "")) nil)
""))
;; Handle nil value.
(should-not
(org-element-fixed-width-interpreter
'(fixed-width (:value nil)) nil)))
(ert-deftest test-org-element/horizontal-rule-interpreter ()
"Test horizontal rule interpreter."