Skip to content

Commit e725c63

Browse files
committed
docs: 站点文档
1 parent c187be6 commit e725c63

File tree

13 files changed

+356
-71
lines changed

13 files changed

+356
-71
lines changed

antora-playbook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ content:
2020
asciidoc:
2121
attributes:
2222
# 文本画图渲染服务 kroki 地址
23-
# kroki-server-url: http://172.16.30.158:9500
23+
# kroki-server-url: https://kroki.io/
24+
# 当前 javadochub 服务地址
25+
page-javadochub-url: http://ip:port/doc
2426
# tab 标签联动
2527
tabs-sync-option: ''
2628
# 前页(Prev)、后页(Next)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3.2'
2+
3+
services:
4+
javadochub:
5+
image: weibian3jue/javadochub
6+
ports:
7+
- '8086:8086'
8+
restart: on-failure
9+
volumes:
10+
- store:/root/.javadochub
11+
environment:
12+
# maven 公共仓库,必填,默认 https://repo.maven.apache.org/maven2
13+
javadochub.maven.repository: https://repo.maven.apache.org/maven2
14+
# maven 私有仓库,选填
15+
# javadochub.maven.internal:
16+
# 私有仓库私有包 group 前缀,填写私有仓库则必填此项,多个使用逗号分割
17+
# 例如 world.weibiansanjue,com.weibiansanjue
18+
# javadochub.maven.internal-group-prefix:
19+
20+
volumes:
21+
store:

docs/modules/ROOT/examples/pom.xml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.springframework.boot</groupId>
9+
<artifactId>spring-boot-starter-parent</artifactId>
10+
<version>2.7.15</version>
11+
<relativePath/> <!-- lookup parent from repository -->
12+
</parent>
13+
14+
<groupId>world.weibiansanjue.doctools</groupId>
15+
<artifactId>javadochub</artifactId>
16+
<version>0.1.0</version>
17+
<packaging>jar</packaging>
18+
<name>JavadocHub</name>
19+
<description>轻量级 Javadoc 聚合、托管服务</description>
20+
21+
<properties>
22+
<java.version>1.8</java.version>
23+
<maven.compiler.source>1.8</maven.compiler.source>
24+
<maven.compiler.target>1.8</maven.compiler.target>
25+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
26+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
27+
</properties>
28+
29+
<dependencies>
30+
31+
</dependencies>
32+
33+
<build>
34+
<plugins>
35+
36+
<!-- javadoc -->
37+
<!-- tag::maven-javadoc-plugin[] -->
38+
<plugin>
39+
<groupId>org.apache.maven.plugins</groupId>
40+
<artifactId>maven-javadoc-plugin</artifactId>
41+
<version>3.5.0</version>
42+
<configuration>
43+
<encoding>UTF-8</encoding>
44+
<charset>UTF-8</charset>
45+
<docencoding>UTF-8</docencoding>
46+
</configuration>
47+
<executions>
48+
<execution>
49+
<id>generate-javadoc-jar</id>
50+
<phase>package</phase>
51+
<goals>
52+
<goal>${project.packaging}</goal>
53+
</goals>
54+
</execution>
55+
</executions>
56+
</plugin>
57+
<!-- end::maven-javadoc-plugin[] -->
58+
59+
<!-- src/main/javadoc/overivew.md -> html -->
60+
<!-- tag::markdown-page-generator-plugin[] -->
61+
<plugin>
62+
<groupId>com.ruleoftech</groupId>
63+
<artifactId>markdown-page-generator-plugin</artifactId>
64+
<version>2.4.0</version>
65+
<executions>
66+
<execution>
67+
<phase>process-resources</phase>
68+
<goals>
69+
<goal>generate</goal>
70+
</goals>
71+
</execution>
72+
</executions>
73+
<configuration>
74+
<inputDirectory>${basedir}/src/main/javadoc</inputDirectory>
75+
<outputDirectory>${basedir}/src/main/javadoc</outputDirectory>
76+
<inputEncoding>UTF-8</inputEncoding>
77+
<outputEncoding>UTF-8</outputEncoding>
78+
</configuration>
79+
</plugin>
80+
<!-- end::markdown-page-generator-plugin[] -->
81+
82+
</plugins>
83+
</build>
84+
85+
</project>

docs/modules/ROOT/nav.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
* xref:index.adoc[]
1+
* xref:index.adoc[快速开始]
22
* xref:selfhost.adoc[]
3-
* xref:javadoc.adoc[]
3+
* xref:javadoc-spec.adoc[]
4+
* xref:javadoc-spec.adoc[]
45
* xref:example.adoc[]
6+
* xref:javadoc-make.adoc[]
57
* xref:tool.adoc[]
68
* xref:reference.adoc[]

docs/modules/ROOT/pages/example.adoc

Lines changed: 133 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,97 @@
1-
# Javadoc 编写示例
1+
= Javadoc 编写示例
22

3+
==
34

4-
## openJDK jdk8-b120
5+
=== java.lang.package-info
56

6-
java.util.ArrayList.java
7+
* link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
8+
* link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/lang/package-info.java[java.lang.package-info.java]
9+
10+
[source,java]
11+
....
12+
/**
13+
* Provides classes that are fundamental to the design of the Java
14+
* programming language. The most important classes are {@code
15+
* Object}, which is the root of the class hierarchy, and {@code
16+
* Class}, instances of which represent classes at run time.
17+
*
18+
* <p>Frequently it is necessary to represent a value of primitive
19+
* type as if it were an object. The wrapper classes {@code Boolean},
20+
* {@code Character}, {@code Integer}, {@code Long}, {@code Float},
21+
* and {@code Double} serve this purpose. An object of type {@code
22+
* Double}, for example, contains a field whose type is double,
23+
* representing that value in such a way that a reference to it can be
24+
* stored in a variable of reference type. These classes also provide
25+
* a number of methods for converting among primitive values, as well
26+
* as supporting such standard methods as equals and hashCode. The
27+
* {@code Void} class is a non-instantiable class that holds a
28+
* reference to a {@code Class} object representing the type void.
29+
*
30+
* <p>The class {@code Math} provides commonly used mathematical
31+
* functions such as sine, cosine, and square root. The classes {@code
32+
* String}, {@code StringBuffer}, and {@code StringBuilder} similarly
33+
* provide commonly used operations on character strings.
34+
*
35+
* <p>Classes {@code ClassLoader}, {@code Process}, {@code
36+
* ProcessBuilder}, {@code Runtime}, {@code SecurityManager}, and
37+
* {@code System} provide "system operations" that manage the dynamic
38+
* loading of classes, creation of external processes, host
39+
* environment inquiries such as the time of day, and enforcement of
40+
* security policies.
41+
*
42+
* <p>Class {@code Throwable} encompasses objects that may be thrown
43+
* by the {@code throw} statement. Subclasses of {@code Throwable}
44+
* represent errors and exceptions.
45+
*
46+
* <a name="charenc"></a>
47+
* <h3>Character Encodings</h3>
48+
*
49+
* The specification of the {@link java.nio.charset.Charset
50+
* java.nio.charset.Charset} class describes the naming conventions
51+
* for character encodings as well as the set of standard encodings
52+
* that must be supported by every implementation of the Java
53+
* platform.
54+
*
55+
* @since JDK1.0
56+
*/
57+
package java.lang;
58+
....
59+
60+
== 类
61+
62+
=== java.lang.Object
63+
64+
* link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
65+
* link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/lang/Object.java[java.lang.Object.java]
66+
67+
[source,java]
68+
....
69+
/**
70+
* Class {@code Object} is the root of the class hierarchy.
71+
* Every class has {@code Object} as a superclass. All objects,
72+
* including arrays, implement the methods of this class.
73+
*
74+
* @author unascribed
75+
* @see java.lang.Class
76+
* @since JDK1.0
77+
*/
78+
public class Object {
79+
80+
private static native void registerNatives();
81+
static {
82+
registerNatives();
83+
}
84+
// ......
85+
// ......
86+
}
87+
....
88+
89+
== 方法
90+
91+
=== ArrayList#contains
92+
93+
* link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
94+
* link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/util/ArrayList.java#L284[java.util.ArrayList#contains]
795

896
[source,java]
997
....
@@ -22,10 +110,10 @@ public boolean contains(Object o) {
22110
....
23111

24112

113+
=== StringUtils#isEmpty
25114

26-
## org.apache.commons:commons-lang3:3.13.0
27-
28-
org.apache.commons.lang3.StringUtils.java
115+
* link:https://github.com/apache/commons-lang/tree/rel/commons-lang-3.13.0[org.apache.commons:commons-lang3:3.13.0]
116+
* link:https://github.com/apache/commons-lang/blob/rel/commons-lang-3.13.0/src/main/java/org/apache/commons/lang3/StringUtils.java#L3596[org.apache.commons.lang3.StringUtils#isEmpty]
29117

30118
[source,java]
31119
....
@@ -52,3 +140,42 @@ public static boolean isEmpty(final CharSequence cs) {
52140
return cs == null || cs.length() == 0;
53141
}
54142
....
143+
144+
== 属性
145+
146+
=== Integer#MAX_VALUE
147+
148+
* link:https://github.com/openjdk/jdk/tree/jdk8-b120[openJDK jdk8-b120]
149+
* link:https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/lang/Integer.java#L63[java.lang.Integer#MAX_VALUE]
150+
151+
[source,java]
152+
....
153+
/**
154+
* A constant holding the maximum value an {@code int} can
155+
* have, 2<sup>31</sup>-1.
156+
*/
157+
@Native public static final int MAX_VALUE = 0x7fffffff;
158+
....
159+
160+
161+
=== StringUtils#SPACE, EMPTY
162+
163+
* link:https://github.com/apache/commons-lang/tree/rel/commons-lang-3.13.0[org.apache.commons:commons-lang3:3.13.0]
164+
* link:https://github.com/apache/commons-lang/blob/rel/commons-lang-3.13.0/src/main/java/org/apache/commons/lang3/StringUtils.java#L148[org.apache.commons.lang3.StringUtils#SPACE, EMPTY]
165+
166+
167+
[source,java]
168+
....
169+
/**
170+
* A String for a space character.
171+
*
172+
* @since 3.2
173+
*/
174+
public static final String SPACE = " ";
175+
176+
/**
177+
* The empty String {@code ""}.
178+
* @since 2.0
179+
*/
180+
public static final String EMPTY = "";
181+
....

docs/modules/ROOT/pages/index.adoc

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
= 介绍
1+
= 快速开始
22

3+
== 介绍
34

5+
JavadocHub 是可自部署的轻量级 javadoc 聚合、托管、查看服务,使用 SpringBoot 开发,
6+
输入包 maven 坐标,即可查看对应文档。
47

5-
JavadocHub 是轻量级的 javadoc 文档聚合、托管服务
6-
使用 SpringBoot 开发
8+
== 如何使用
79

10+
基本格式
811

9-
自定义 overview 页面
12+
{page-javadochub-url}/*GroupId*/*ArtifactId*/*Version*
1013

11-
* https://stackoverflow.com/questions/25947627/how-to-customize-overview-page-in-javadoc[java - How to customize "Overview" page in JavaDoc? - Stack Overflow]
12-
* https://github.com/asciidoctor/asciidoclet[asciidoctor/asciidoclet: :clipboard: A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax. (github.com)]
13-
** package / overview.adoc
14-
** maven-javadoc-plugin-2.10.4 / asciidoclet-1.5.6
1514

16-
https://nisrulz.com/javadoc-themer/index.html
17-
https://github.com/nisrulz/javadoc-themer
15+
示例
16+
17+
* 查看最新版本文档
18+
** link:{page-javadochub-url}/org.springframework/spring-core[^]
19+
20+
* 查看指定版本文档
21+
** link:{page-javadochub-url}/org.springframework/spring-core/6.0.0[^]
22+
23+
== 使用
24+
在右上角输入框中输入待查看 jar 包 maven 坐标 `groupId`、`artifactId`,点击查看
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
= 制作 javadoc
2+
3+
== CLI
4+
5+
TODO
6+
7+
== IDE
8+
9+
TODO
10+
11+
== maven
12+
13+
DOING
14+
15+
[source,xml]
16+
....
17+
include::example$pom.xml[tag=maven-javadoc-plugin]
18+
....
19+
20+
== 自定义概述(overview)页 footnote:[https://stackoverflow.com/questions/25947627/how-to-customize-overview-page-in-javadoc[java - How to customize "Overview" page in JavaDoc? - Stack Overflow]]
21+
22+
23+
[source,xml]
24+
....
25+
include::example$pom.xml[tag=markdown-page-generator-plugin]
26+
....

0 commit comments

Comments
 (0)