Function: hywiki-get-page-file

hywiki-get-page-file is a byte-compiled function defined in hywiki.el.

Signature

(hywiki-get-page-file REFERENCE)

Documentation

Return possibly non-existent hywiki-directory path from REFERENCE.

REFERENCE may be an existing absolute file path; then, return it. Otherwise, REFERENCE should not contain a directory and may have or may omit hywiki-file-extension and an optional trailing #section, both of which are left attached to the result returned. So given the input, WikiWord#section, the result might be: "/users/me/hywiki/WikiWord.org#section".

Check only that REFERENCE is not nil, not an empty string and does not contain a directory path or return nil.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hywiki.el
(defun hywiki-get-page-file (reference)
  "Return possibly non-existent `hywiki-directory' path from REFERENCE.
REFERENCE may be an existing absolute file path; then, return it.
Otherwise, REFERENCE should not contain a directory and may have or may omit
`hywiki-file-extension' and an optional trailing #section, both of which are
left attached to the result returned.  So given the input, WikiWord#section,
the result might be: \"/users/me/hywiki/WikiWord.org#section\".

Check only that REFERENCE is not nil, not an empty string and does
not contain a directory path or return nil."
  (make-directory hywiki-directory t)
  (if (and (stringp reference) (file-readable-p reference))
      reference
    (unless (or (null reference) (string-empty-p reference)
                (file-name-directory reference))
      (let (file-name
	    section)
        ;; Remove any suffix from `reference' and make it singular
        (if (string-match hywiki-word-suffix-regexp reference)
	    (setq section (match-string 0 reference)
		  file-name (hywiki-get-singular-wikiword
			     (substring reference 0 (match-beginning 0))))
	  (setq file-name reference))
        (concat (expand-file-name file-name hywiki-directory)
                (unless (string-suffix-p hywiki-file-extension file-name)
		  hywiki-file-extension)
                section)))))