Skip to content

Commit 8d9e798

Browse files
authored
fix: use major minor version for Velocity Javadoc (#393)
1 parent a362470 commit 8d9e798

File tree

4 files changed

+42
-35
lines changed

4 files changed

+42
-35
lines changed

docs/velocity/dev/api/event.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: How to listen for events in Velocity.
88
Listening to events with Velocity's `@Subscribe`
99
annotation is straightforward. You've already seen one such listener, using
1010
<Javadoc name={"com.velocitypowered.api.event.proxy.ProxyInitializeEvent"} project={"velocity"}>`ProxyInitializeEvent`</Javadoc>
11-
in your main class. Additional events can be found on the [Javadoc](https://jd.papermc.io/velocity/3.0.0/).
11+
in your main class. Additional events can be found on the <Javadoc project={"velocity"}>Javadoc</Javadoc>.
1212

1313
## Creating a listener method
1414

docs/velocity/dev/getting-started/creating-your-first-plugin.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Now we have created our project, we need configure our build system.
4747

4848
### Javadocs
4949

50-
Javadocs are available at [jd.papermc.io/velocity/3.0.0](https://jd.papermc.io/velocity/3.0.0).
50+
Javadocs are available at <Javadoc project={"velocity"}>jd.papermc.io</Javadoc>.
5151

5252
## Set up your build system
5353

src/components/config/ConfigDocBlock.tsx

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {useState, useEffect, useRef, ReactNode} from "react";
1+
import React, { useState, useEffect, useRef, ReactNode } from "react";
22
import ReactMarkdown from "react-markdown";
33
import style from "@site/src/css/markdown-styles.module.css";
44
import yaml from "js-yaml";
@@ -8,11 +8,11 @@ import useBrokenLinks from "@docusaurus/core/lib/client/exports/useBrokenLinks";
88
import Admonition from "@theme/Admonition";
99
import clsx from "clsx";
1010

11-
const createUrlHash = (parent: string | number, name: any) : string => {
11+
const createUrlHash = (parent: string | number, name: any): string => {
1212
return parent + (parent ? "_" : "") + parseUrlHash(name);
1313
};
1414

15-
const parseUrlHash = (name: string) : string => {
15+
const parseUrlHash = (name: string): string => {
1616
return name.replace(/-/g, "_");
1717
};
1818

@@ -48,14 +48,21 @@ const copyAndScroll = (parentKey: string, name: string): void => {
4848
console.error("Failed to copy to clipboard: ", error);
4949
});
5050
scrollIntoView(hash);
51-
}
51+
};
5252

53-
const parseDefault = (value: string, collapse: boolean, parentKey: string, name: string, handleHashLinkClick, separator: string) : ReactNode => {
53+
const parseDefault = (
54+
value: string,
55+
collapse: boolean,
56+
parentKey: string,
57+
name: string,
58+
handleHashLinkClick,
59+
separator: string
60+
): ReactNode => {
5461
const hash = createUrlHash(parentKey, name);
5562
useBrokenLinks().collectAnchor(hash);
5663

5764
if (value[0] === "[" && value[value.length - 1] === "]") {
58-
const items : (string | ReactNode)[] = value
65+
const items: (string | ReactNode)[] = value
5966
.replace("[", "")
6067
.replace("]", "")
6168
.split(",")
@@ -100,7 +107,7 @@ const parseDefault = (value: string, collapse: boolean, parentKey: string, name:
100107
);
101108
};
102109

103-
const parseItalics = (key : string) => {
110+
const parseItalics = (key: string) => {
104111
if (key.startsWith("<") && key.endsWith(">")) {
105112
return (
106113
<>
@@ -116,14 +123,14 @@ const parseDescriptionForVersioning = (description: String) => {
116123
};
117124

118125
const YamlNodeWithDescription = ({
119-
name,
120-
node,
121-
parentKey,
122-
root,
123-
separator,
124-
showAllDescriptions,
125-
defaultValue,
126-
}) => {
126+
name,
127+
node,
128+
parentKey,
129+
root,
130+
separator,
131+
showAllDescriptions,
132+
defaultValue,
133+
}) => {
127134
const ignoreInitialRenderRef = useRef(false);
128135
const [showDescription, setShowDescription] = useState(showAllDescriptions);
129136

@@ -204,15 +211,15 @@ const YamlNodeWithDescription = ({
204211
};
205212

206213
const YamlTreeNode = ({
207-
root,
208-
name,
209-
parentKey,
210-
value,
211-
separator,
212-
showAllDescriptions,
213-
defaultValue,
214-
warning,
215-
}) : ReactNode => {
214+
root,
215+
name,
216+
parentKey,
217+
value,
218+
separator,
219+
showAllDescriptions,
220+
defaultValue,
221+
warning,
222+
}): ReactNode => {
216223
if (name === "inline-docs-warning") return null;
217224

218225
const handleClick = (event) => {
@@ -280,7 +287,7 @@ const renderYamlData = (
280287
separator: string,
281288
showAllDescriptions: boolean,
282289
defaultValue: string
283-
) : ReactNode => {
290+
): ReactNode => {
284291
const renderedNodes: JSX.Element[] = [];
285292

286293
for (const [key, value] of Object.entries(data)) {
@@ -323,11 +330,11 @@ const renderYamlData = (
323330
};
324331

325332
export default function Config({
326-
data,
327-
separator = ": ",
328-
showDescriptions = false,
329-
defaultValue = "N/A",
330-
}) : ReactNode {
333+
data,
334+
separator = ": ",
335+
showDescriptions = false,
336+
defaultValue = "N/A",
337+
}): ReactNode {
331338
const [showAllDescriptions, setShowAllExpanded] = useState(showDescriptions);
332339
let ymlData = yaml.load(data);
333340
return (

src/components/versioning/Javadoc.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const createProjectTarget = (
2626

2727
const targets: { [project: string]: TargetResolver } = {
2828
paper: createProjectTarget("paper"),
29-
velocity: createProjectTarget("velocity", VersionType.MajorZeroed),
29+
velocity: createProjectTarget("velocity", VersionType.MajorMinorZeroed),
3030
java: async (_, module) => {
3131
const version = getProperty("DOCS_JAVA") ?? "21";
3232

@@ -51,7 +51,7 @@ export default function Javadoc({ name, module, project = "paper", children }: J
5151
if (resolve) {
5252
const target = await resolve(versionMeta, module);
5353

54-
setHref(`${target}/${formatName(name)}`);
54+
setHref(name ? `${target}/${formatName(name)}` : target);
5555
}
5656
})();
5757
}, [name]);
@@ -60,7 +60,7 @@ export default function Javadoc({ name, module, project = "paper", children }: J
6060
}
6161

6262
interface JavadocProps {
63-
name: string;
63+
name?: string;
6464
module?: string;
6565
project?: Project | "java";
6666
children: any;

0 commit comments

Comments
 (0)