我正在使用struts2对话框。代码如下
# preview the 'data'
script_body = c('# some init comment - not matching pattern','g = function(){','# - [x] comment_g1','# - [ ] comment_g2','1','}','f = function(){','# - [ ] comment_f1','# another non match to pattern','g()+1','}')
cat(script_body, sep = "\n")
# # some init comment - not matching pattern
# g = function(){
# # - [x] comment_g1
# # - [ ] comment_g2
# 1
# }
# f = function(){
# # - [ ] comment_f1
# # another non match to pattern
# g()+1
# }
# populate R souce file
writeLines(script_body, "test.R")
# test it
source("test.R")
f()
# [1] 2
# expected output
r = magic_function_get_comments("test.R", starts.with = c(" - [x] "," - [ ] "))
# r = list("g" = c(" - [x] comment_g1"," - [ ] comment_g2"), "f" = " - [ ] comment_f1")
str(r)
# List of 2
# $ g: chr [1:2] " - [x] comment_g1" " - [ ] comment_g2"
# $ f: chr " - [ ] comment_f1"
当对话框打开并且单击对话框上的任何按钮时,它会出现javascript错误
<sj:dialog id="orderRefDialog"
width="610"
autoOpen="false"
modal="true"
resizable="false"
title="Confirm"
height="auto"
buttons="{'OK':function() {
$(this).dialog('close');
performShipBox();
},
'CANCEL':function() {
$(this).dialog('close');
cancelShipbox();
}
}">
<fmt:message key='orderRef.ShipBox' />
</sj:dialog>
如果我删除 Stack OverFlow at line:1648
,则不会发生此错误,但我认为这不是一个好方法。
它有什么用?