diff --git a/documentation/build.gradle b/documentation/build.gradle index 95c3dcb2b..d03928930 100644 --- a/documentation/build.gradle +++ b/documentation/build.gradle @@ -6,6 +6,14 @@ plugins { id "org.asciidoctor.jvm.convert" } +configurations { + themezip +} + +dependencies { + themezip 'org.hibernate.infra:hibernate-asciidoctor-theme:6.0.0.Final@zip' +} + ext { projectsToSkipWhenAggregatingJavadocs = [ 'example', @@ -20,6 +28,23 @@ rootProject.subprojects { subproject -> } } +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Prepare the theme for Javadocs/Asciidoc +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +tasks.register('unpackTheme', Copy) { + def unpackDir = rootProject.layout.buildDirectory.dir("unpacked-theme") + + onlyIf { + !unpackDir.get().asFile.exists() + } + destinationDir = unpackDir.get().asFile + + def zipFile = configurations.themezip.singleFile + from zipTree(zipFile) + + dependsOn configurations.themezip +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Aggregated JavaDoc // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -49,6 +74,9 @@ def aggregateJavadocsTask = tasks.register( 'aggregateJavadocs', Javadoc ) { windowTitle = 'Hibernate Reactive API documentation' docTitle = "Hibernate Reactive API documentation ($project.version)" bottom = "Copyright © $inceptionYear-$currentYear Red Hat, Inc. All Rights Reserved." + // Pick the styles for the JDK that is used to "build" the Javadocs: + stylesheetFile = rootProject.layout.buildDirectory.dir("unpacked-theme").get() + .dir("hibernate-asciidoctor-theme").dir("javadoc").dir("jdk21").file("stylesheet.css").asFile use = true options.encoding = 'UTF-8' @@ -89,6 +117,8 @@ def aggregateJavadocsTask = tasks.register( 'aggregateJavadocs', Javadoc ) { classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath } } + + dependsOn 'unpackTheme' } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -103,6 +133,11 @@ asciidoctor { def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumentation', AsciidoctorTask ) { description = 'Renders the Reference Documentation in HTML format using Asciidoctor.' sourceDir = file( 'src/main/asciidoc/reference' ) + asciidoctorj { + version '3.0.0' + docExtensions(project(':local-build-asciidoctor-extensions')) + } + sources { include 'index.adoc' } @@ -110,7 +145,12 @@ def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumenta resources { from( sourceDir ) { include 'images/**' + } + from(rootProject.layout.buildDirectory.dir("unpacked-theme").get() + .dir("hibernate-asciidoctor-theme").dir("asciidoc")) { include 'css/**' + include 'images/**' + include 'script/**' } } @@ -118,12 +158,22 @@ def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumenta options logDocuments: true attributes icons: 'font', - 'source-highlighter': 'rouge', - experimental: true, - linkcss: true, - majorMinorVersion: project.projectVersion.family, - fullVersion: project.version.toString(), - docinfo: 'private' + 'source-highlighter': 'rouge', + majorMinorVersion: project.projectVersion.family, + fullVersion: project.version.toString(), + stylesdir: "css", + 'iconfont-remote': false, + 'iconfont-name': 'font-awesome/css/solid', + docinfo: 'shared,private', + docinfodir: rootProject.layout.buildDirectory.dir("unpacked-theme").get() + .dir("hibernate-asciidoctor-theme").dir("asciidoc").dir("docinfo").dir('hibernate').asFile.absolutePath, + 'html.meta.project-key': 'orm', + 'html.outdated-content.project-key': 'orm', + 'html-meta-description': 'Hibernate Reactive, reactive API for Hibernate ORM - Reference Documentation', + 'html-meta-keywords': 'hibernate, reactive, hibernate reactive, database, db, vert.x', + 'html-meta-version-family': project.projectVersion.family + + dependsOn 'unpackTheme' } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/documentation/src/main/asciidoc/reference/css/hibernate.css b/documentation/src/main/asciidoc/reference/css/hibernate.css deleted file mode 100644 index bffef8d93..000000000 --- a/documentation/src/main/asciidoc/reference/css/hibernate.css +++ /dev/null @@ -1,227 +0,0 @@ -/* Asciidoctor default stylesheets */ -@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700"; -@import "https://cdn.jsdelivr.net/gh/asciidoctor/asciidoctor@2.0/data/stylesheets/asciidoctor-default.css"; - -body:before { - content: url(../images/hibernate_logo_smaller.png); - box-shadow: 0 2px 2px #ddd; - display: block; - padding: 20px 20px 10px 15px; -} - -/* - * I'm using the '!important' because the plugin includes the hibernate.css file before the rouge one, - * I cannot override the default any other way. - * Everything else is the same as the default rouge CSS. - */ -pre.rouge .cm { - color: #999988; - font-style: italic; -} -pre.rouge .cp { - color: #999999; - font-weight: normal !important; -} -pre.rouge .c1 { - color: #999988; - font-style: italic; -} -pre.rouge .cs { - color: #999999; - font-weight: normal !important; - font-style: italic; -} -pre.rouge .c, pre.rouge .ch, pre.rouge .cd, pre.rouge .cpf { - color: #999988; - font-style: italic; -} -pre.rouge .err { - color: #a61717; - background-color: #e3d2d2; -} -pre.rouge .gd { - color: #000000; - background-color: #ffdddd; -} -pre.rouge .ge { - color: #000000; - font-style: italic; -} -pre.rouge .gr { - color: #aa0000; -} -pre.rouge .gh { - color: #999999; -} -pre.rouge .gi { - color: #000000; - background-color: #ddffdd; -} -pre.rouge .go { - color: #888888; -} -pre.rouge .gp { - color: #555555; -} -pre.rouge .gs { - font-weight: normal !important; -} -pre.rouge .gu { - color: #aaaaaa; -} -pre.rouge .gt { - color: #aa0000; -} -pre.rouge .kc { - color: #008 !important; - font-weight: normal !important; -} -pre.rouge .kd { - color: #008 !important; - font-weight: normal !important; -} -pre.rouge .kn { - color: #000000; - font-weight: normal !important; -} -pre.rouge .kp { - color: #000000; - font-weight: normal !important; -} -pre.rouge .kr { - color: #000000; - font-weight: normal !important; -} -pre.rouge .kt { - color: #445588; - font-weight: normal !important; -} -pre.rouge .k, pre.rouge .kv { - color: #606 !important; - font-weight: normal !important; -} -pre.rouge .mf { - color: #009999; -} -pre.rouge .mh { - color: #009999; -} -pre.rouge .il { - color: #009999; -} -pre.rouge .mi { - color: #009999; -} -pre.rouge .mo { - color: #009999; -} -pre.rouge .m, pre.rouge .mb, pre.rouge .mx { - color: #009999; -} -pre.rouge .sa { - color: #000000; - font-weight: normal !important; -} -pre.rouge .sb { - color: #d14; -} -pre.rouge .sc { - color: #d14; -} -pre.rouge .sd { - color: #d14; -} -pre.rouge .s2 { - color: #d14; -} -pre.rouge .se { - color: #d14; -} -pre.rouge .sh { - color: #d14; -} -pre.rouge .si { - color: #d14; -} -pre.rouge .sx { - color: #d14; -} -pre.rouge .sr { - color: #009926; -} -pre.rouge .s1 { - color: #d14; -} -pre.rouge .ss { - color: #990073; -} -pre.rouge .s, pre.rouge .dl { - color: #080 !important; -} -pre.rouge .na { - color: #000 !important; -} -pre.rouge .bp { - color: #999999; -} -pre.rouge .nb { - color: #0086B3; -} -pre.rouge .nc { - color: #606 !important; - font-weight: normal !important; -} -pre.rouge .no { - color: #008080; -} -pre.rouge .nd { - color: #066 !important; - font-weight: normal !important; -} -pre.rouge .ni { - color: #800080; -} -pre.rouge .ne { - color: #990000; - font-weight: normal !important; -} -pre.rouge .nf, pre.rouge .fm { - color: #990000; - font-weight: normal !important; -} -pre.rouge .nl { - color: #990000; - font-weight: normal !important; -} -pre.rouge .nn { - color: #555555; -} -pre.rouge .nt { - color: #000080; -} -pre.rouge .vc { - color: #008080; -} -pre.rouge .vg { - color: #008080; -} -pre.rouge .vi { - color: #008080; -} -pre.rouge .nv, pre.rouge .vm { - color: #008080; -} -pre.rouge .ow { - color: #000000; - font-weight: normal !important; -} -pre.rouge .o { - color: #000000; - font-weight: normal !important; -} -pre.rouge .w { - color: #bbbbbb; -} -pre.rouge { - background-color: #f8f8f8; -} \ No newline at end of file diff --git a/documentation/src/main/asciidoc/reference/images/hibernate_logo_smaller.png b/documentation/src/main/asciidoc/reference/images/hibernate_logo_smaller.png deleted file mode 100644 index a5a5b1953..000000000 Binary files a/documentation/src/main/asciidoc/reference/images/hibernate_logo_smaller.png and /dev/null differ diff --git a/documentation/src/main/asciidoc/reference/index.adoc b/documentation/src/main/asciidoc/reference/index.adoc index 3acdb5b73..c410c02b6 100644 --- a/documentation/src/main/asciidoc/reference/index.adoc +++ b/documentation/src/main/asciidoc/reference/index.adoc @@ -1,11 +1,11 @@ = Hibernate Reactive {fullVersion} Reference Documentation Davide D'Alto ; Gavin King -:stylesheet: css/hibernate.css :toc2: :toclevels: 3 :sectanchors: :sourcedir: src/main/asciidoc/reference :leveloffset: +1 +:version-selector-enabled: true include::{sourcedir}/preface.adoc[] diff --git a/local-build-asciidoctor-extensions/build.gradle b/local-build-asciidoctor-extensions/build.gradle new file mode 100644 index 000000000..97bc7cec8 --- /dev/null +++ b/local-build-asciidoctor-extensions/build.gradle @@ -0,0 +1,15 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * Copyright Red Hat Inc. and Hibernate Authors + */ + +plugins { + id "hr-java-library" +} + +description = 'Asciidoctor extensions for Hibernate Reactive' + +dependencies { + implementation "org.hibernate.infra:hibernate-asciidoctor-extensions:3.2.0.Final" + implementation "org.asciidoctor:asciidoctorj:3.0.0" +} diff --git a/local-build-asciidoctor-extensions/src/main/java/org/hibernate/reactive/env/asciidoctor/HibernateAsciidoctorExtensionRegistry.java b/local-build-asciidoctor-extensions/src/main/java/org/hibernate/reactive/env/asciidoctor/HibernateAsciidoctorExtensionRegistry.java new file mode 100644 index 000000000..38f773d17 --- /dev/null +++ b/local-build-asciidoctor-extensions/src/main/java/org/hibernate/reactive/env/asciidoctor/HibernateAsciidoctorExtensionRegistry.java @@ -0,0 +1,25 @@ +/* Hibernate, Relational Persistence for Idiomatic Java + * + * SPDX-License-Identifier: Apache-2.0 + * Copyright: Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.reactive.env.asciidoctor; + +import org.hibernate.infra.asciidoctor.extensions.copytoclipboard.CopyToClipboardProcessor; +import org.hibernate.infra.asciidoctor.extensions.customnumbering.CustomNumberingProcessor; +// import org.hibernate.infra.asciidoctor.extensions.sourcecodelanguage.SourcecodeLanguagePreprocessor; + +import org.asciidoctor.Asciidoctor; +import org.asciidoctor.extension.JavaExtensionRegistry; +import org.asciidoctor.jruby.extension.spi.ExtensionRegistry; + +public class HibernateAsciidoctorExtensionRegistry implements ExtensionRegistry { + + @Override + public void register(Asciidoctor asciidoctor) { + JavaExtensionRegistry javaExtensionRegistry = asciidoctor.javaExtensionRegistry(); + javaExtensionRegistry.docinfoProcessor( CopyToClipboardProcessor.class ); + javaExtensionRegistry.treeprocessor( CustomNumberingProcessor.class ); + // javaExtensionRegistry.preprocessor( SourcecodeLanguagePreprocessor.class ); + } +} diff --git a/local-build-asciidoctor-extensions/src/main/resources/META-INF/services/org.asciidoctor.jruby.extension.spi.ExtensionRegistry b/local-build-asciidoctor-extensions/src/main/resources/META-INF/services/org.asciidoctor.jruby.extension.spi.ExtensionRegistry new file mode 100644 index 000000000..e828da0a6 --- /dev/null +++ b/local-build-asciidoctor-extensions/src/main/resources/META-INF/services/org.asciidoctor.jruby.extension.spi.ExtensionRegistry @@ -0,0 +1 @@ +org.hibernate.reactive.env.asciidoctor.HibernateAsciidoctorExtensionRegistry diff --git a/settings.gradle b/settings.gradle index b894dfc9a..e01676615 100644 --- a/settings.gradle +++ b/settings.gradle @@ -138,6 +138,7 @@ include 'bytecode-enhancements-it' include 'verticle-postgres-it' include 'techempower-postgres-it' include 'hibernate-validator-postgres-it' +include 'local-build-asciidoctor-extensions' // Examples for ( project in rootProject.children ) {