Function: klink:parse

klink:parse is a byte-compiled function defined in klink.el.

Signature

(klink:parse REFERENCE)

Documentation

Return (file-ref cell-ref) list parsed from REFERENCE string.

Either element of the list may be nil if REFERENCE does not contain that element. REFERENCE must be one of the following forms (and may include an optional pair of <> delimiters) or an error is triggered:
  (pathname#cell-ref) or pathname#cell-ref
  (pathname, cell-ref) or pathname, cell-ref
  cell-ref
  |viewspec
  :augment-viewspec (ignored for now)

See documentation for kcell:ref-to-id for valid cell-ref formats.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/klink.el
(defun klink:parse (reference)
  "Return (file-ref cell-ref) list parsed from REFERENCE string.
Either element of the list may be nil if REFERENCE does not contain that
element.  REFERENCE must be one of the following forms (and may include an
optional pair of <> delimiters) or an error is triggered:
  (pathname#cell-ref) or pathname#cell-ref
  (pathname, cell-ref) or pathname, cell-ref
  cell-ref
  |viewspec
  :augment-viewspec (ignored for now)

See documentation for `kcell:ref-to-id' for valid cell-ref formats."

  (or (stringp reference)
      (error "(klink:parse): Non-string reference argument, %s"
	     reference))
  (cond
   ((string-match
     (format
      "\\`\\s-*[<\(]?\\s-*\\([^|: \t\n\r,<>][^ \t\n\r,<>]*\\)\\s-*[#,]\\s-*\\(%s\\)\\s-*[\)>]?\\s-*\\'"
      klink:cell-ref-regexp)
     reference)
    ;; <pathname#cell-ref> or <pathname, cell-ref>
    (list (match-string 1 reference) (match-string 2 reference)))
   ((string-match (format "\\`\\s-*<?[#@]?\\s-*\\(%s\\)\\s-*>?\\s-*\\'"
			  klink:cell-ref-regexp)
		  reference)
    ;; <#cell-ref> or <@ cell-ref> or cell-ref
    (list nil (match-string 1 reference)))
   (t (error "(klink:parse): Invalid reference specifier, %s" reference))))