@@ -44,15 +44,27 @@ format.BibEntry <- function(x, style = .BibOptions$style,
4444 on.exit(close(con ))
4545 # # macro.env <- tools::loadRdMacros(file.path(R.home("share"), "Rd",
4646 # # "macros", "system.Rd"))
47+ warnWithKey <- function (w ){
48+ msg <- sub(" ^.*[[:alnum:]][:] " , " " , w )
49+ msg <- paste0(y $ key , " : " , msg )
50+ warning(msg , call. = FALSE )
51+ invokeRestart(" muffleWarning" )
52+ }
4753 if (getRversion() > = " 3.3.0" ){
4854 # # !!! prevent use of devtools::system.file
4955 macro.env <- tools :: loadPkgRdMacros(base :: system.file(package =
5056 " RefManageR" ))
51- f(con , fragment = TRUE , out = out , outputEncoding = ' UTF-8' ,
52- macros = macro.env , ... )
57+ withCallingHandlers(f(con , fragment = TRUE , out = out ,
58+ outputEncoding = ' UTF-8' , macros = macro.env ,
59+ warningCalls = FALSE , ... ),
60+ warning = warnWithKey )
61+ # # suppressWarnings(f(con, fragment = TRUE, out = out,
62+ # # outputEncoding = 'UTF-8', macros = macro.env, ...))
5363 }else
54- f(con , fragment = TRUE , out = out , outputEncoding = ' UTF-8' , ... )
55-
64+ withCallingHandlers(f(con , fragment = TRUE , out = out ,
65+ outputEncoding = ' UTF-8' , warningCalls = FALSE , ... ),
66+ warning = warnWithKey )
67+
5668 paste(readLines(out , encoding = ' UTF-8' ), collapse = " \n " )
5769 }, " " )
5870 if (style == " html" ){
0 commit comments