Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Christian Egli 2013-04-26 11:56:57 +02:00
commit 889e9a9b3a
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) (defun org-element-fixed-width-interpreter (fixed-width contents)
"Interpret FIXED-WIDTH element as Org syntax. "Interpret FIXED-WIDTH element as Org syntax.
CONTENTS is nil." CONTENTS is nil."
(replace-regexp-in-string (let ((value (org-element-property :value fixed-width)))
"^" ": " (substring (org-element-property :value fixed-width) 0 -1))) (and value
(replace-regexp-in-string
"^" ": "
(if (string-match "\n\\'" value) (substring value 0 -1) value)))))
;;;; Horizontal Rule ;;;; 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")) (should (equal (org-test-parse-and-interpret ": Test") ": Test\n"))
;; Preserve indentation. ;; Preserve indentation.
(should (equal (org-test-parse-and-interpret ": 2 blanks\n: 1 blank") (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 () (ert-deftest test-org-element/horizontal-rule-interpreter ()
"Test horizontal rule interpreter." "Test horizontal rule interpreter."