Function: org-element-normalize-string
org-element-normalize-string is a byte-compiled function defined in
org-element.el.gz.
Signature
(org-element-normalize-string S)
Documentation
Ensure string S ends with a single newline character.
If S isn't a string return it unchanged. If S is the empty string, return it. Otherwise, return a new string with a single newline character at its end.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-element.el.gz
;; Because interpretation of the parse tree must return the same
;; number of blank lines between elements and the same number of white
;; space after objects, some special care must be given to white
;; spaces.
;;
;; The first function, `org-element-normalize-string', ensures any
;; string different from the empty string will end with a single
;; newline character.
;;
;; The second function, `org-element-normalize-contents', removes
;; global indentation from the contents of the current element.
(defun org-element-normalize-string (s)
"Ensure string S ends with a single newline character.
If S isn't a string return it unchanged. If S is the empty
string, return it. Otherwise, return a new string with a single
newline character at its end."
(cond
((not (stringp s)) s)
((string= "" s) "")
(t (and (string-match "\\(\n[ \t]*\\)*\\'" s)
(replace-match "\n" nil nil s)))))