From ff39dd23e727d7d0c31535254653a1de7ab4ef1b Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 11 Dec 2014 00:00:16 -0500 Subject: Anchor and restrict citekey regular expression Limit the characters that are allowed in the citekey to letters, digits, underscores, and hyphens. This allows the citekey to be treated as a word (temporarily expanding word constituents to include underscore and hyphen), as opposed to explicitly specifying the characters that can come before a citekey. --- bog-tests.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bog-tests.el') diff --git a/bog-tests.el b/bog-tests.el index 598dc31..0173c5f 100644 --- a/bog-tests.el +++ b/bog-tests.el @@ -121,7 +121,19 @@ point at the beginning of the inserted text." (let ((citekey "hyphen-name2010word")) (with-temp-buffer (insert citekey) + ;; At beginning (goto-char (point-min)) + (should (equal (bog-citekey-at-point) citekey)) + ;; On hyphen + (skip-chars-forward "-") + (should (equal (bog-citekey-at-point) citekey)) + ;; After hyphen + (forward-char) + (should (equal (bog-citekey-at-point) citekey)) + ;; On word + (skip-chars-forward "0-9") + ;; At year + (skip-chars-forward "-a-z") (should (equal (bog-citekey-at-point) citekey))))) ;; `bog-citekey-from-tree' -- cgit v1.2.3