Skip to content

Commit

Permalink
fix homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
AyhamAl-Ali committed Apr 1, 2024
1 parent ecf874b commit c9c7c51
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/ch/njol/skript/doc/HTMLGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -374,11 +375,15 @@ else if (!filesInside.getName().matches("(?i)(.*)\\.(html?|js|css|json)")) {

// skwipt
String ogTitle = "Skript Documentation";
String ogDesc = "Skript is a Bukkit plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.";
String exampleCode = " command /sethome:\n     permission: skript.home # Permission required for this command\n     description: Set your home # Description of this command\n     executable by: players # Console won't be able to run this command\n     trigger: # The actual trigger/code that will run when someone do /sethome\n         # Set a unique variable to sender's location\n         set {home::%uuid of player%} to location of player\n         # Send a message to the sender\n         message \"Set your home to <grey>%location of player%<reset>\"\n \n command /home:\n     permission: skript.home\n     description: Teleport yourself to your home\n     trigger:\n         # Check if that variable we used in /sethome has been set (in other words, if player ever ran /sethome)\n         if {home::%uuid of player%} is not set:\n             message \"You have not set your home yet!\"\n             stop trigger # stop the code here, lines below won't run\n         # Teleport the player to their home\n         teleport player to {home::%uuid of player%}\n         send \"&aYou have been teleported.\"\n ";
String ogDesc = "is a Bukkit plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.";
Pattern exampleCode = Pattern.compile("command /sethome:.*?You have been teleported.");
Pattern skriptPattern = Pattern.compile("(?<=[a-zA-Z0-9]|^|>)([Ss]kript)");
page = page.replace(ogTitle, introduceSkwipt(ogTitle));
page = page.replace(ogDesc, introduceSkwipt(ogDesc));
page = page.replace(exampleCode, introduceSkwipt(exampleCode));
Matcher exampleMatcher = exampleCode.matcher(page);
Matcher skriptMatcher = skriptPattern.matcher(page);
page = exampleMatcher.replaceAll(introduceSkwipt(exampleMatcher.group(0)));
page = skriptMatcher.replaceAll(introduceSkwipt(skriptMatcher.group(1)));

generate = page.indexOf("${generate", nextBracket);
}
Expand Down

0 comments on commit c9c7c51

Please sign in to comment.