Skip to content

Commit a22366a

Browse files
committed
Filter words that contain an @ symbol, fixes #9
1 parent 2cee30c commit a22366a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Enforce latest hunspell and libhunspell, which include updated dictionaries
44
- Treat all input as UTF-8. Fixes some false positives on Windows
55
- Ignore yaml front matter in markdown except for 'title', 'subtitle', and 'description'
6+
- Markdown: filter words that contain an '@' symbol (citation key or email address)
67
- Properly parse authors@R field for ignore list (issue #2)
78
- Use tools::file_ext instead of knitr:::file_ext
89

R/check-files.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ spell_check_file_rd <- function(rdfile, dict){
8181

8282
spell_check_file_md <- function(path, dict){
8383
words <- parse_text_md(path)
84+
85+
# Filter out citation keys, see https://github.com/ropensci/spelling/issues/9
86+
words$text <- gsub("\\S*@\\S+", "", words$text, perl = TRUE)
8487
words$startline <- vapply(strsplit(words$position, ":", fixed = TRUE), `[[`, character(1), 1)
8588
bad_words <- hunspell::hunspell(words$text, dict = dict)
8689
vapply(sort(unique(unlist(bad_words))), function(word) {

0 commit comments

Comments
 (0)