-
-
Notifications
You must be signed in to change notification settings - Fork 415
Docs categories #8194
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
Open
Efnilite
wants to merge
28
commits into
dev/feature
Choose a base branch
from
feature/grouped-docs
base: dev/feature
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Docs categories #8194
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6723148
Init commit
Efnilite 4213806
add example
Efnilite aa11019
Move to new registration API
Efnilite d4c7b51
wait :(
Efnilite 35655aa
Merge branch 'dev/feature' into feature/grouped-docs
Efnilite 34bc926
Add location, fix merge
Efnilite 5616181
Remove set from register
Efnilite 6fe255e
Make CategoryImpl use classes instead of instances
Efnilite afd70a7
Add docs, bug fix
Efnilite 1d926c8
Add multiple categories per module
Efnilite 4b79f1f
Apply suggestion from @Absolutionism
Efnilite 3369e17
Apply suggestion from @Absolutionism
Efnilite 278377c
Apply suggestion from @Absolutionism
Efnilite 2dd2203
Merge branch 'dev/feature' into feature/grouped-docs
Efnilite dce21d6
Merge remote-tracking branch 'origin/feature/grouped-docs' into featu…
Efnilite 87caead
Update docs
Efnilite 5b914e8
Update annotation
Efnilite 5f7eded
Add subcategories
Efnilite 9ab6833
update module registration code
Efnilite 6254455
requested changes part 1
Efnilite 310880f
requested changes part 2
Efnilite ec002bd
set isDefault in infoBuilder to false
Efnilite a211958
Merge branch 'dev/feature' into feature/grouped-docs
Efnilite 35cf06b
move DamageSourceModule to implement Categorizable instead of AddonMo…
Efnilite efe7536
requested changes
Efnilite b33472e
Merge branch 'dev/feature' into feature/grouped-docs
Efnilite e43f09b
Merge remote-tracking branch 'origin/feature/grouped-docs' into featu…
Efnilite 03a7f86
Update src/main/java/ch/njol/skript/doc/JSONGenerator.java
Efnilite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package ch.njol.skript.doc; | ||
|
|
||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Represents anything that can be categorized. | ||
| */ | ||
| @FunctionalInterface | ||
| public interface Categorizable { | ||
|
|
||
| /** | ||
| * Returns the documentation categories which this object belongs to. | ||
| * | ||
| * @return The categories of this object. | ||
| */ | ||
| @NotNull Set<Category> categories(); | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| package ch.njol.skript.doc; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.skriptlang.skript.addon.AddonModule; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Represents a category a documented element can belong to. | ||
| */ | ||
| public interface Category { | ||
|
|
||
| Category ENTITIES = new CategoryImpl("Entities", "entity", "entities", "animal", "panda", "allay", | ||
| "zombie", "goat", "horse", "pig", "fish", "villager", "bee"); | ||
| Category BREEDING = new CategoryImpl("Breeding"); | ||
| Category PLAYERS = new CategoryImpl("Players", "player", "operator"); | ||
| Category DAMAGE_SOURCES = new CategoryImpl("Damage Sources", "damage source"); | ||
| Category BLOCKS = new CategoryImpl("Blocks", "block"); | ||
| Category STRINGS = new CategoryImpl("Strings", "string", "text"); | ||
| Category COMMANDS = new CategoryImpl("Commands", "command"); | ||
| Category ITEMS = new CategoryImpl("Items", "item", "enchantment", "lore", "tooltip", "banner"); | ||
| Category WORLDS = new CategoryImpl("Worlds", "world"); | ||
| Category SCRIPTS = new CategoryImpl("Scripts", "script"); | ||
| Category DISPLAYS = new CategoryImpl("Displays", "display"); | ||
| Category TIME = new CategoryImpl("Time", "time", "unix"); | ||
| Category UUIDS = new CategoryImpl("UUIDs", "uuid"); | ||
| Category DATES = new CategoryImpl("Dates", "date"); | ||
| Category LOCATIONS = new CategoryImpl("Locations", "location"); | ||
| Category MATH = new CategoryImpl("Math", "angle", "degree", "radian", | ||
| "arithmetic", "nan", "round", "rounds", "root", "quaternion", "permutations", | ||
| "combinations", "numbers", "infinity", "exponential"); | ||
| Category VECTORS = new CategoryImpl("Vectors", Category.MATH, "vector"); | ||
|
|
||
| /** | ||
| * @return The display name of this category. | ||
| */ | ||
| @NotNull String name(); | ||
|
|
||
| /** | ||
| * @return The parent category of this category. | ||
| */ | ||
| Category parent(); | ||
|
|
||
| /** | ||
| * Adds a module to this category. | ||
| * | ||
| * @param module The module to add. | ||
| */ | ||
| void addModule(@NotNull Class<? extends AddonModule> module); | ||
|
|
||
| /** | ||
| * @return The modules that are represented by this category. | ||
| */ | ||
| @NotNull Set<Class<? extends AddonModule>> modules(); | ||
|
|
||
| /** | ||
| * Creates a new category. | ||
| * | ||
| * @param name The name. | ||
| * @return The new category. | ||
| */ | ||
| static Category of(@NotNull String name) { | ||
| Preconditions.checkNotNull(name, "name cannot be null"); | ||
|
|
||
| return new CategoryImpl(name); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a new category. | ||
| * | ||
| * @param name The name. | ||
| * @param category The category. | ||
| * @return The new category. | ||
| */ | ||
| static Category of(@NotNull String name, @NotNull Category category) { | ||
| Preconditions.checkNotNull(name, "name cannot be null"); | ||
| Preconditions.checkNotNull(category, "category cannot be null"); | ||
|
|
||
| return new CategoryImpl(name, category); | ||
| } | ||
|
|
||
| /** | ||
| * @return All registered categories. | ||
| */ | ||
| static Set<Category> values() { | ||
| return CategoryImpl.getInstances(); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| package ch.njol.skript.doc; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import org.jetbrains.annotations.NotNull; | ||
| import org.jetbrains.annotations.Unmodifiable; | ||
| import org.skriptlang.skript.addon.AddonModule; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.HashSet; | ||
| import java.util.Set; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| final class CategoryImpl implements Category { | ||
|
|
||
| private static final Set<Category> instances = new HashSet<>(); | ||
| private final String name; | ||
| private final Category parent; | ||
| private final Set<String> keywords; | ||
| private final Set<Class<? extends AddonModule>> modules; | ||
|
|
||
| static Set<Category> getInstances() { | ||
| return instances; | ||
| } | ||
|
|
||
| CategoryImpl(String name, String... keywords) { | ||
| this(name, null, keywords); | ||
| } | ||
|
|
||
| CategoryImpl(String name, Category parent, String... keywords) { | ||
| instances.add(this); | ||
| this.name = name; | ||
| this.parent = parent; | ||
| this.keywords = Arrays.stream(keywords) | ||
| .map(String::toLowerCase) | ||
| .collect(Collectors.toUnmodifiableSet()); | ||
| this.modules = new HashSet<>(); | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull String name() { | ||
| return name; | ||
| } | ||
|
|
||
| @Override | ||
| public Category parent() { | ||
| return parent; | ||
| } | ||
|
|
||
| public @NotNull Set<String> keywords() { | ||
| return keywords; | ||
| } | ||
|
|
||
| @Override | ||
| public void addModule(@NotNull Class<? extends AddonModule> module) { | ||
| Preconditions.checkNotNull(module, "module cannot be null"); | ||
|
|
||
| modules.add(module); | ||
| } | ||
|
|
||
| @Override | ||
| public @Unmodifiable @NotNull Set<Class<? extends AddonModule>> modules() { | ||
| return Set.copyOf(modules); | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Was randomly going through the wip updated docs page again and noticed "category" checked it out saw that timespan and beacon effect are classified as apart of the "Display" category.
I decided to go check into this, this is caused by the usage guessing assignments with
containsbeacon effect containsdisplayand timespan containsdisplayed.Is this behavior planned to stay or do you plan to eventually move away from automatic assignments.
imo if something like this is to stay it should be checked against something more reliable
%display%vs.displayUh oh!
There was an error while loading. Please reload this page.
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 excluding the description/examples, searching with
\bword boundaries, and specifically looking for types in the syntax patterns would be good improvements.On the docs side, I'd like to see these as selectable categories (think shopping websites) rather than exclusive lists of syntaxes. One syntax may naturally belong to multiple categories, and having a way to select various categories for display I think would improve the UI.