Skip to content

Commit

Permalink
fixed #321: non-alphanumeric characters in chunk labels will be repla…
Browse files Browse the repository at this point in the history
…ced by _
  • Loading branch information
yihui committed Jul 8, 2012
1 parent 5ed0a15 commit bb2021c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ parse_block = function(input) {
params = parse_params(params)

label = params$label
if (str_detect(label, '[^-_[:alnum:]]')) {
label = str_replace_all(label, '[^-_[:alnum:]]', '_')
warning('replaced special characters in chunk label "', params$label, '" (', label, ')')
params$label = label
}
code = block[-1L]
if (length(code)) {
if (label %in% names(knit_code$get())) stop("duplicated label '", label, "'")
Expand Down

0 comments on commit bb2021c

Please sign in to comment.