-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixbug #11 and add a new option --json
#13
base: master
Are you sure you want to change the base?
Conversation
--json
--json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢提交!提了几处小问题
else | ||
pp result | ||
if @to_output_json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把这两个合并一下吧
|
||
def final_path | ||
d = File.join(Dir.tmpdir, 'pod') | ||
if not Dir.exist?(d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use unless
instead
f = File.open(template_path) | ||
template = ERB.new(f.read) | ||
f.close |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接用 File.read
就不需要手动 open, close 了
f = File.open(template_path) | ||
template = ERB.new(f.read) | ||
f.close | ||
return template.result(binding) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return 可以省掉
@@ -51,14 +46,16 @@ | |||
function pageDidLoad() { | |||
loadJSON('index.json', response => { | |||
var actual_JSON = JSON.parse(response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
帮忙把这个文件里所有的 var 也一起改掉吧,当年年少不知事 =,=
def write_d3js_to_file(path) | ||
json = 'var dependencies = ' + to_d3js_json | ||
File.write(path, json) | ||
return json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omit return
Fixbug New Visual ouput feature not working on Chrome and Safari #11 : use erb template to generate the HTML file and feed data into it as embedded JavaScript
修复bug New Visual ouput feature not working on Chrome and Safari #11 : JavaScript跨域问题。
使用Ruby erb模板生成HTML文件,并将数据以JSON格式插入;在HTML中被解释为JS代码,避免了跨域请求数据。
output in JSON format by adding a option
--json
增加一个选项
--json
,输出格式为 JSON