Skip to content

Commit

Permalink
solution to issue yihui#306 - options set on parent should be used by…
Browse files Browse the repository at this point in the history
… child
  • Loading branch information
cmmp committed Jul 5, 2012
1 parent 9ce67b9 commit 33de9ce
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ knit = function(input, output = NULL, tangle = FALSE, text = NULL, envir = paren
opts_knit$set(output.dir = getwd()) # record working directory in 1st run
knit_log$restore()
on.exit(chunk_counter(reset = TRUE), add = TRUE) # restore counter
## turn off fancy quotes, use smaller digits/width, warn immediately
oopts = options(useFancyQuotes = FALSE, digits = 4L, width = 75L, warn = 1L,
device = function(file = NULL, width = 7, height = 7, ...) {
pdf(file, width, height, ...)
})
on.exit(options(oopts), add = TRUE)
}

ext = 'unknown'
Expand Down Expand Up @@ -174,13 +180,6 @@ knit = function(input, output = NULL, tangle = FALSE, text = NULL, envir = paren
on.exit(knit_hooks$restore(), add = TRUE)
}

## turn off fancy quotes, use smaller digits/width, warn immediately
oopts = options(useFancyQuotes = FALSE, digits = 4L, width = 75L, warn = 1L,
device = function(file = NULL, width = 7, height = 7, ...) {
pdf(file, width, height, ...)
})
on.exit(options(oopts), add = TRUE)

progress = opts_knit$get('progress')
if (in.file) message(ifelse(progress, '\n\n', ''), 'processing file: ', input)
res = process_file(text, output)
Expand Down

0 comments on commit 33de9ce

Please sign in to comment.