diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-12-11 00:00:16 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-12-11 00:00:16 -0500 |
commit | ff39dd23e727d7d0c31535254653a1de7ab4ef1b (patch) | |
tree | 4efe4322478330d6c0764194776f80620fefb0c7 /bog-tests.el | |
parent | c2bf5263c13f1585a9c151c688947bcdb53c00e1 (diff) | |
download | bog-ff39dd23e727d7d0c31535254653a1de7ab4ef1b.tar.gz |
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.
Diffstat (limited to 'bog-tests.el')
-rw-r--r-- | bog-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
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' |