Function: org-link--normalize-string
org-link--normalize-string is a byte-compiled function defined in
ol.el.gz.
Signature
(org-link--normalize-string STRING &optional CONTEXT)
Documentation
Remove ignored contents from STRING string and return it.
This function removes contiguous white spaces and statistics cookies. When optional argument CONTEXT is non-nil, it assumes STRING is a context string, and also removes special search syntax around the string.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ol.el.gz
(defun org-link--normalize-string (string &optional context)
"Remove ignored contents from STRING string and return it.
This function removes contiguous white spaces and statistics
cookies. When optional argument CONTEXT is non-nil, it assumes
STRING is a context string, and also removes special search
syntax around the string."
(let ((string
(org-trim
(replace-regexp-in-string
(rx (one-or-more (any " \t")))
" "
(replace-regexp-in-string
;; Statistics cookie regexp.
(rx (seq "[" (0+ digit) (or "%" (seq "/" (0+ digit))) "]"))
" "
string)))))
(when context
(while (cond ((and (string-prefix-p "(" string)
(string-suffix-p ")" string))
(setq string (org-trim (substring string 1 -1))))
((string-match "\\`[#*]+[ \t]*" string)
(setq string (substring string (match-end 0))))
(t nil))))
string))