Function: Man-translate-references
Man-translate-references is a byte-compiled function defined in
man.el.gz.
Signature
(Man-translate-references REF)
Documentation
Translates REF from "chmod(2V)" to "2v chmod" style.
Leave it as is if already in that style. Possibly downcase and
translate the section (see the Man-downcase-section-letters-flag
and the Man-section-translations-alist variables).
Source Code
;; Defined in /usr/src/emacs/lisp/man.el.gz
(defun Man-translate-references (ref)
"Translates REF from \"chmod(2V)\" to \"2v chmod\" style.
Leave it as is if already in that style. Possibly downcase and
translate the section (see the `Man-downcase-section-letters-flag'
and the `Man-section-translations-alist' variables)."
(let ((name "")
(section "")
(slist Man-section-translations-alist))
(setq ref (Man-translate-cleanup ref))
(cond
;; "chmod(2V)" case ?
((string-match (concat "^" Man-reference-regexp "$") ref)
(setq name (replace-regexp-in-string "[\n\t ]" "" (match-string 1 ref))
section (match-string 4 ref)))
;; "2v chmod" case ?
((string-match (concat "^\\(" Man-section-regexp
"\\) +\\(" Man-name-regexp "\\)$") ref)
(setq name (match-string 2 ref)
section (match-string 1 ref))))
(if (string= name "")
;; see Bug#66390
(mapconcat 'identity
(mapcar #'shell-quote-argument
(split-string ref "\\s-+"))
" ") ; Return the reference as is
(if Man-downcase-section-letters-flag
(setq section (downcase section)))
(while slist
(let ((s1 (car (car slist)))
(s2 (cdr (car slist))))
(setq slist (cdr slist))
(if Man-downcase-section-letters-flag
(setq s1 (downcase s1)))
(if (not (string= s1 section)) nil
(setq section (if Man-downcase-section-letters-flag
(downcase s2)
s2)
slist nil))))
(concat Man-specified-section-option section " " name))))