-
-
Notifications
You must be signed in to change notification settings - Fork 3
Add support to SyntaxTree 6 and Mermaid.js #5
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
Changes from 1 commit
4dc5dbe
2275ef1
8c4d948
dfa8d3d
ea904ff
1ce254c
43fbf65
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,10 +66,12 @@ export default async function createRuby() { | |
// files to make it work. I'm not sure why I need to explicitly require | ||
// did_you_mean here, but it doesn't work without it. | ||
ruby.eval(` | ||
require "rubygems" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this require and the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately, they are. Without them, we get |
||
require "did_you_mean" | ||
require "json" | ||
$:.unshift("/lib") | ||
require_relative "/lib/syntax_tree" | ||
require_relative "/lib/prettier_print" | ||
`); | ||
|
||
return { | ||
|
@@ -93,10 +95,8 @@ export default async function createRuby() { | |
prettyPrint(source: string) { | ||
const jsonSource = JSON.stringify(JSON.stringify(source)); | ||
const rubySource = ` | ||
PP.format([], 80) do |q| | ||
source = JSON.parse(${jsonSource}) | ||
SyntaxTree.parse(source).pretty_print(q) | ||
end.join | ||
source = JSON.parse(${jsonSource}) | ||
SyntaxTree.parse(source).pretty_inspect | ||
`; | ||
|
||
return ruby.eval(rubySource).toString(); | ||
|
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.
I think this line is equivalent and can be reverted
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.
You're right, It was just a missing test.