Skip to content

Commit 82967d6

Browse files
committed
docs: update js libraries, remove warnings
1 parent 9b1da13 commit 82967d6

File tree

9 files changed

+341
-347
lines changed

9 files changed

+341
-347
lines changed

docs/asciidoc/modules/modules.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Available modules are listed next.
3838

3939
=== Event Bus
4040
* link:/modules/camel[Camel]: Camel module for Jooby.
41+
* link:/modules/vertx[Vertx]: Vertx module for Jooby.
4142

4243
=== JSON
4344
* link:/modules/gson[Gson]: Gson module for Jooby.

docs/asciidoc/modules/vertx.adoc

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
== Vertx
2+
3+
https://vertx.io/[Vertx] Reactive applications on the JVM.
4+
5+
=== Usage
6+
7+
1) Add the dependency:
8+
9+
[dependency, artifactId="jooby-vertx"]
10+
.
11+
12+
2) Install
13+
14+
.Java
15+
[source, java, role="primary"]
16+
----
17+
import io.jooby.vertx.VertxModule;
18+
19+
{
20+
install(new VertxModule()); <1>
21+
22+
get("/{msg}", ctx -> {
23+
var eb = require(EventBus.class); <2>
24+
25+
eventBus.publish("msg", ctx.path("msg").value()); <3>
26+
...
27+
});
28+
}
29+
----
30+
31+
.Kotlin
32+
[source, kt, role="secondary"]
33+
----
34+
import io.jooby.vertx.VertxModule
35+
36+
{
37+
install(VertxModule()) <1>
38+
39+
get("/{msg}") {
40+
val eb = require(EventBus.class); <2>
41+
42+
eventBus.publish("msg", ctx.path("msg").value()); <3>
43+
...
44+
}
45+
}
46+
----
47+
48+
<1> Install Vertx
49+
<2> Get EventBus or Vertx instance
50+
<3> Send message to `msg`
51+
52+
=== Options
53+
54+
Options can be provided manually or from application.conf properties:
55+
56+
.Manually
57+
[source, java]
58+
----
59+
import io.jooby.vertx.VertxModule;
60+
61+
{
62+
install(new VertxModule(new VertxOptions()));
63+
}
64+
----
65+
66+
.Properties
67+
68+
.application.conf
69+
[source, properties]
70+
----
71+
vertx.eventLoopPoolSize=5
72+
vertx.workerPoolSize = 20
73+
vertx.blockedThreadCheckInterval=500
74+
vertx.maxEventLoopExecuteTime=2000
75+
...
76+
----
77+
78+
[source, java]
79+
----
80+
import io.jooby.vertx.VertxModule;
81+
82+
{
83+
install(new VertxModule());
84+
}
85+
----

docs/js/highlight.min.js

Lines changed: 226 additions & 335 deletions
Large diffs are not rendered by default.

docs/js/styles/atom-one-dark.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/styles/tokyo-night-dark.min.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/styles/tomorrow-night-bright.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<properties>
1212
<application.class>io.jooby.adoc.DocApp</application.class>
13-
<jooby.version>4.0.3</jooby.version>
13+
<jooby.version>4.0.7</jooby.version>
1414
<maven.compiler.source>17</maven.compiler.source>
1515
<maven.compiler.target>17</maven.compiler.target>
1616
<maven.compiler.release>17</maven.compiler.release>

docs/src/main/java/io/jooby/adoc/DocApp.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@
77

88
import static org.slf4j.helpers.NOPLogger.NOP_LOGGER;
99

10+
import java.io.IOException;
11+
import java.nio.file.Files;
1012
import java.nio.file.Path;
1113
import java.util.Arrays;
1214
import java.util.List;
1315

14-
import io.jooby.LoggingService;
15-
import io.jooby.Server;
16+
import io.jooby.*;
1617
import org.slf4j.Logger;
1718
import org.slf4j.LoggerFactory;
1819
import org.slf4j.bridge.SLF4JBridgeHandler;
1920

20-
import io.jooby.Jooby;
21-
import io.jooby.ServerOptions;
2221
import io.methvin.watcher.DirectoryWatcher;
2322

2423
public class DocApp extends Jooby {
@@ -32,11 +31,11 @@ public class DocApp extends Jooby {
3231
Path site = DocGenerator.basedir().resolve("asciidoc").resolve("site");
3332
assets("/*", site);
3433

35-
onStarted(() ->
34+
onStarted(SneakyThrows.throwingRunnable(() ->
3635
getLog().info("Access to maven properties is available from ascii files. If you want to access to `${avaje.inject.version}` uses the `{avaje_inject_version}` syntax and make sure to set the `subs` attribute, like:\n\n" +
37-
"[source, xml, role = \"primary\", subs=\"verbatim,attributes\"]\n" +
38-
" .... {avaje_inject_version}\n")
39-
);
36+
"[source, xml, role = \"primary\", subs=\"verbatim,attributes\"]\n" +
37+
" .... {avaje_inject_version}\n")
38+
));
4039
}
4140

4241
public static void main(String[] args) throws Exception {

docs/src/main/java/io/jooby/adoc/DocGenerator.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ public static void generate(Path basedir, boolean publish, boolean v1, boolean d
9292
asciidoctor.convertFile(
9393
asciidoc.resolve("index.adoc").toFile(),
9494
createOptions(asciidoc, outdir, version, null));
95+
var index = outdir.resolve("index.html");
96+
Files.writeString(index, hljs(Files.readString(index)));
9597
pb.step();
9698

9799
Stream.of(treeDirs)
@@ -221,15 +223,20 @@ private static void processModule(
221223
indexlike = indexlike.resolve("index.html");
222224
Files.createDirectories(indexlike.getParent());
223225
Files.move(output, indexlike);
224-
String content = Files.readString(indexlike)
226+
String content = hljs(Files.readString(indexlike)
225227
.replace("js/", "../../js/")
226-
.replace("images/", "../../images/");
228+
.replace("images/", "../../images/"));
227229
Files.writeString(indexlike, content);
228230
} catch (IOException x) {
229231
throw new IllegalStateException(x);
230232
}
231233
}
232234

235+
private static String hljs(String content) {
236+
return content.replace(".highlightBlock", ".highlightElement")
237+
.replace("hljs.initHighlighting.called = true", "hljs.configure({ignoreUnescapedHTML: true});hljs.initHighlighting.called = true");
238+
}
239+
233240
private static Options createOptions(Path basedir, Path outdir, String version, String title)
234241
throws IOException {
235242
var attributes = Attributes.builder();
@@ -254,7 +261,8 @@ private static Options createOptions(Path basedir, Path outdir, String version,
254261
attributes.imagesDir("images");
255262
attributes.sourceHighlighter("highlightjs");
256263
attributes.attribute("highlightjsdir", "js");
257-
attributes.attribute("highlightjs-theme", "agate");
264+
// agate, tom-one-dark, tomorrow-night-bright, tokyo-night-dark
265+
attributes.attribute("highlightjs-theme", "tomorrow-night-bright");
258266
attributes.attribute("favicon", "images/favicon96.png");
259267

260268
// versions:

0 commit comments

Comments
 (0)