Skip to content

Commit

Permalink
Add Asciidoctor Tabs CSS also for Antora themed pages (#1425)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahus1 committed Sep 24, 2023
1 parent c244fda commit 5284136
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ This document provides a high-level view of the changes introduced by release.
[[releasenotes]]
== Release notes

=== 0.40.3

- Add Asciidoctor Tabs CSS also for Antora themed pages (#1425)

=== 0.40.2

- Expanding or collapsing a section will not scroll the editor or open the included file (#1436)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public class BrowserPanel implements Disposable {

@Nullable
private String myInlineCss;
private String myTabsCss;
@Nullable
private String myInlineCssDarcula;
@Nullable
Expand Down Expand Up @@ -127,7 +128,8 @@ public BrowserPanel() {
myInlineCss += IOUtils.toString(is, StandardCharsets.UTF_8);
}
try (InputStream is = JavaFxHtmlPanel.class.getResourceAsStream("/asciidoctor/tabs/tabs.css")) {
myInlineCss = myInlineCss + IOUtils.toString(is, StandardCharsets.UTF_8);
myTabsCss = IOUtils.toString(is, StandardCharsets.UTF_8);
myInlineCss = myInlineCss + myTabsCss;
}
try (InputStream is = JavaFxHtmlPanel.class.getResourceAsStream("darcula.css")) {
myInlineCssDarcula = myInlineCss + IOUtils.toString(is, StandardCharsets.UTF_8);
Expand Down Expand Up @@ -404,7 +406,7 @@ private String prepareHtml(@NotNull String html, Project project, Map<String, St

/* Add CSS line and JavaScript */
if (isAntora) {
html = AsciiDocWrapper.enrichPage(html, (isDarcula() ? myAntoraDarculaCssLink : myAntoraCssLink) + myFontAwesomeCssLink, myMermaidScript, myAsciidoctorTabsScript, attributes, project);
html = AsciiDocWrapper.enrichPage(html, (isDarcula() ? myAntoraDarculaCssLink : myAntoraCssLink) + myFontAwesomeCssLink + getCssLines(myTabsCss), myMermaidScript, myAsciidoctorTabsScript, attributes, project);
} else {
html = AsciiDocWrapper.enrichPage(html, getCssLines(isDarcula() ? myInlineCssDarcula : myInlineCss) + myFontAwesomeCssLink + myGoogleFontsCssLink + myDroidSansMonoCssLink + myDejavuCssLink, myMermaidScript, myAsciidoctorTabsScript, attributes, project);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ public void onLoadEnd(CefBrowser browser, CefFrame frame, int httpStatusCode) {
myInlineCss += IOUtils.toString(is, StandardCharsets.UTF_8);
}
try (InputStream is = JavaFxHtmlPanel.class.getResourceAsStream("/asciidoctor/tabs/tabs.css")) {
myInlineCss = myInlineCss + IOUtils.toString(is, StandardCharsets.UTF_8);
myTabsCss = IOUtils.toString(is, StandardCharsets.UTF_8);
myInlineCss = myInlineCss + myTabsCss;
}
try (InputStream is = JavaFxHtmlPanel.class.getResourceAsStream("darcula.css")) {
myInlineCssDarcula = myInlineCss + IOUtils.toString(is, StandardCharsets.UTF_8);
Expand Down Expand Up @@ -552,6 +553,8 @@ private String extractAndPatchAsciidoctorCss(String asciidoctorVersion) throws I
@Nullable
private String myInlineCss;
@Nullable
private String myTabsCss;
@Nullable
private String myInlineCssDarcula;
@Nullable
private String myFontAwesomeCssLink;
Expand All @@ -566,7 +569,6 @@ private String extractAndPatchAsciidoctorCss(String asciidoctorVersion) throws I

@Nullable
private String myMermaidScript;

@Nullable
private String myAsciidoctorTabsScript;

Expand Down Expand Up @@ -830,7 +832,7 @@ private String prepareHtml(@NotNull String html, @NotNull Map<String, String> at
}

if (isAntora) {
html = AsciiDocWrapper.enrichPage(html, (isDarcula() ? myAntoraDarculaCssLink : myAntoraCssLink) + myFontAwesomeCssLink, myMermaidScript, myAsciidoctorTabsScript, attributes, editor != null ? editor.getProject() : null);
html = AsciiDocWrapper.enrichPage(html, (isDarcula() ? myAntoraDarculaCssLink : myAntoraCssLink) + myFontAwesomeCssLink + AsciiDocHtmlPanel.getCssLines(myTabsCss), myMermaidScript, myAsciidoctorTabsScript, attributes, editor != null ? editor.getProject() : null);
} else {
html = AsciiDocWrapper.enrichPage(html, AsciiDocHtmlPanel.getCssLines(isDarcula() ? myInlineCssDarcula : myInlineCss) + myFontAwesomeCssLink + myGoogleFontsCssLink + myDejavuCssLink, myMermaidScript, myAsciidoctorTabsScript, attributes, editor != null ? editor.getProject() : null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,22 @@ xref:<error descr="Antora Module doesn't resolve">nocomponent:nomodule</error>:p

image::<error descr="Antora Module doesn't resolve">nocomponent:nomodule</error>:image.png[]



[tabs]
====
Tab A:: Contents of Tab A.ddddddddddddddd
dddddddd
Tab B::
+
Contents of Tab B.
Tab C::
+
--
Contents of Tab C.
Contains more than one block.
--
====

0 comments on commit 5284136

Please sign in to comment.