Function: hywiki-string-to-wikiword
hywiki-string-to-wikiword is a byte-compiled function defined in
hywiki.el.
Signature
(hywiki-string-to-wikiword STR &optional SEPARATOR)
Documentation
Convert a string to a single PascalCase HyWikiWord.
Remove dashes, underscores and whitespace as part of the conversion and
capitalize each word separated by any of the removed characters. With
optional SEPARATOR string, additionally remove those characters. Trim the
start end end of each word using matches of the regexp value of
split-string-default-separators.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hywiki.el
(defun hywiki-string-to-wikiword (str &optional separator)
"Convert a string to a single PascalCase HyWikiWord.
Remove dashes, underscores and whitespace as part of the conversion and
capitalize each word separated by any of the removed characters. With
optional SEPARATOR string, additionally remove those characters. Trim the
start end end of each word using matches of the regexp value of
`split-string-default-separators'."
(unless (stringp str)
(error "(hywiki-string-to-wikiword): `str' must be a string, not `%s'" str))
(when (null separator) (setq separator "-"))
(let ((words (split-string str (if (and separator (stringp separator))
(format "[-_%s\t\n\r\f]+" separator)
"[-_\t\n\r\f]+")
t split-string-default-separators)))
(cl-flet ((upcase-first-char (str)
(concat (upcase (substring str 0 1))
(substring str 1))))
;; Don't want to use capitalize here because if given a string that is
;; already a WikiWord, it will change it to 'Wikiword', losing the
;; middle capital 'W'; just upcase the first character.
(apply #'concat (mapcar #'upcase-first-char words)))))