-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Generate JSON docs with Gson #5738
Conversation
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.
Pikachu is killing it again 🚀
Amazing changes! This is a quick review I didn't dig deep or test anything yet but looks pretty clean.
bd134d0
to
3f08853
Compare
By default, GSON escapes strings containing HTML content. This is the intended behaviour, but for some reason the escaping occurs several times, as can be seen in the JSON for some examples. |
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.
remove licenses and add javadocs
# Conflicts: # src/main/java/ch/njol/skript/doc/HTMLGenerator.java # src/main/java/ch/njol/skript/lang/function/Signature.java
# Conflicts: # src/main/java/ch/njol/skript/doc/HTMLGenerator.java # src/main/java/ch/njol/skript/lang/function/Signature.java
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.
in HTMLGenerator you could use File(parent, child)
to avoid manually having to add the /
or using File.separator
, or you could use what you have rn but you should make it more consistent because it varies.
you can also maybe add tests for the JSONGenerator
besides that very cool
@SuppressWarnings("unchecked") | ||
public void generate() { | ||
for (File f : template.listFiles()) { | ||
for (File f : templateDir.listFiles()) { |
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.
for (File f : templateDir.listFiles()) { | |
for (File file : templateDir.listFiles()) { |
if (f.getName().matches("css|js|assets")) { // Copy CSS/JS/Assets folders | ||
String slashName = "/" + f.getName(); | ||
File fileTo = new File(output + slashName); | ||
File fileTo = new File(outputDir + slashName); |
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 fileTo = new File(outputDir + slashName); | |
File fileTo = new File(outputDir, file.getName()); |
doesn't this work? this way you don't need slashName
Co-authored-by: _tud <[email protected]>
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.
LGTM
private static <T> int calculateCollisionCount(Iterator<? extends T> potentialCollisions, Predicate<T> collisionCriteria, | ||
Predicate<T> equalsCriteria) { |
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.
What's this indentation doing?
addressed
Description
This PR switches the JSON doc generation to Gson (which is included w/ spigot). The current generation method (I think it's just some string replacing) often generates invalid JSON. Switching to Gson should help prevent this as Gson will deal with the JSON generation, while we just provide the data.
You can see the generated JSON here: https://docs.skriptlang.org/nightly/fix/json-docs/docs.json
Target Minecraft Versions: N/A
Requirements: N/A
Related Issues: SkriptLang/skript-docs#31