Skip to content

Commit ae8214b

Browse files
committed
doc: fix bug on link generation
1 parent f1975d2 commit ae8214b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ public static void generate(Path basedir, boolean publish, boolean v1, boolean d
4646
String version = version();
4747
// 2.x/3.x/main
4848
var branch = new Git("jooby-project", "jooby", Paths.get(System.getProperty("user.dir"))).currentBranch();
49-
var uiVersion = switch (branch) {
50-
case "2.x" -> "/v2";
51-
case "3.x" -> "/v3";
52-
default -> "main";
53-
};
49+
var uiVersion = branch.equals("main") ? "" : "/v" + branch.replace(".x", "");
5450

5551
Path asciidoc = basedir.resolve("asciidoc");
5652

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void clone(final String... args) throws Exception {
4949
public String currentBranch() throws Exception {
5050
var out = new ByteArrayOutputStream();
5151
execute(List.of("git", "branch", "--show-current"), out);
52-
return out.toString(StandardCharsets.UTF_8);
52+
return out.toString(StandardCharsets.UTF_8).trim();
5353
}
5454

5555
public void commit(String comment) throws Exception {

0 commit comments

Comments
 (0)