Skip to content

Commit 7e06be3

Browse files
marko-bekhtaDavideD
authored andcommitted
[#2560] Apply the unified Hibernate Documentation theme
- for javadocs - for asciidoc
1 parent 9ddaf6b commit 7e06be3

File tree

8 files changed

+99
-234
lines changed

8 files changed

+99
-234
lines changed

documentation/build.gradle

Lines changed: 56 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ plugins {
66
id "org.asciidoctor.jvm.convert"
77
}
88

9+
configurations {
10+
themezip
11+
}
12+
13+
dependencies {
14+
themezip 'org.hibernate.infra:hibernate-asciidoctor-theme:6.0.0.Final@zip'
15+
}
16+
917
ext {
1018
projectsToSkipWhenAggregatingJavadocs = [
1119
'example',
@@ -20,6 +28,23 @@ rootProject.subprojects { subproject ->
2028
}
2129
}
2230

31+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
// Prepare the theme for Javadocs/Asciidoc
33+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34+
tasks.register('unpackTheme', Copy) {
35+
def unpackDir = rootProject.layout.buildDirectory.dir("unpacked-theme")
36+
37+
onlyIf {
38+
!unpackDir.get().asFile.exists()
39+
}
40+
destinationDir = unpackDir.get().asFile
41+
42+
def zipFile = configurations.themezip.singleFile
43+
from zipTree(zipFile)
44+
45+
dependsOn configurations.themezip
46+
}
47+
2348
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2449
// Aggregated JavaDoc
2550
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -49,6 +74,9 @@ def aggregateJavadocsTask = tasks.register( 'aggregateJavadocs', Javadoc ) {
4974
windowTitle = 'Hibernate Reactive API documentation'
5075
docTitle = "Hibernate Reactive API documentation ($project.version)"
5176
bottom = "Copyright &copy; $inceptionYear-$currentYear <a href=\"http://redhat.com\">Red Hat, Inc</a>. All Rights Reserved."
77+
// Pick the styles for the JDK that is used to "build" the Javadocs:
78+
stylesheetFile = rootProject.layout.buildDirectory.dir("unpacked-theme").get()
79+
.dir("hibernate-asciidoctor-theme").dir("javadoc").dir("jdk21").file("stylesheet.css").asFile
5280
use = true
5381
options.encoding = 'UTF-8'
5482

@@ -89,6 +117,8 @@ def aggregateJavadocsTask = tasks.register( 'aggregateJavadocs', Javadoc ) {
89117
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
90118
}
91119
}
120+
121+
dependsOn 'unpackTheme'
92122
}
93123

94124
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -103,27 +133,47 @@ asciidoctor {
103133
def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumentation', AsciidoctorTask ) {
104134
description = 'Renders the Reference Documentation in HTML format using Asciidoctor.'
105135
sourceDir = file( 'src/main/asciidoc/reference' )
136+
asciidoctorj {
137+
version '3.0.0'
138+
docExtensions(project(':local-build-asciidoctor-extensions'))
139+
}
140+
106141
sources {
107142
include 'index.adoc'
108143
}
109144

110145
resources {
111146
from( sourceDir ) {
112147
include 'images/**'
148+
}
149+
from(rootProject.layout.buildDirectory.dir("unpacked-theme").get()
150+
.dir("hibernate-asciidoctor-theme").dir("asciidoc")) {
113151
include 'css/**'
152+
include 'images/**'
153+
include 'script/**'
114154
}
115155
}
116156

117157
outputDir = project.layout.buildDirectory.dir( "asciidoc/reference/html_single" ).get().asFile
118158
options logDocuments: true
119159

120160
attributes icons: 'font',
121-
'source-highlighter': 'rouge',
122-
experimental: true,
123-
linkcss: true,
124-
majorMinorVersion: project.projectVersion.family,
125-
fullVersion: project.version.toString(),
126-
docinfo: 'private'
161+
'source-highlighter': 'rouge',
162+
majorMinorVersion: project.projectVersion.family,
163+
fullVersion: project.version.toString(),
164+
stylesdir: "css",
165+
'iconfont-remote': false,
166+
'iconfont-name': 'font-awesome/css/solid',
167+
docinfo: 'shared,private',
168+
docinfodir: rootProject.layout.buildDirectory.dir("unpacked-theme").get()
169+
.dir("hibernate-asciidoctor-theme").dir("asciidoc").dir("docinfo").dir('hibernate').asFile.absolutePath,
170+
'html.meta.project-key': 'orm',
171+
'html.outdated-content.project-key': 'orm',
172+
'html-meta-description': 'Hibernate Reactive, reactive API for Hibernate ORM - Reference Documentation',
173+
'html-meta-keywords': 'hibernate, reactive, hibernate reactive, database, db, vert.x',
174+
'html-meta-version-family': project.projectVersion.family
175+
176+
dependsOn 'unpackTheme'
127177
}
128178

129179
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

documentation/src/main/asciidoc/reference/css/hibernate.css

Lines changed: 0 additions & 227 deletions
This file was deleted.
Binary file not shown.

documentation/src/main/asciidoc/reference/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
= Hibernate Reactive {fullVersion} Reference Documentation
22
Davide D'Alto <davide@hibernate.org>; Gavin King <gavin@hibernate.org>
3-
:stylesheet: css/hibernate.css
43
:toc2:
54
:toclevels: 3
65
:sectanchors:
76
:sourcedir: src/main/asciidoc/reference
87
:leveloffset: +1
8+
:version-selector-enabled: true
99

1010
include::{sourcedir}/preface.adoc[]
1111

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
6+
plugins {
7+
id "hr-java-library"
8+
}
9+
10+
description = 'Asciidoctor extensions for Hibernate Reactive'
11+
12+
dependencies {
13+
implementation "org.hibernate.infra:hibernate-asciidoctor-extensions:3.2.0.Final"
14+
implementation "org.asciidoctor:asciidoctorj:3.0.0"
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* Hibernate, Relational Persistence for Idiomatic Java
2+
*
3+
* SPDX-License-Identifier: Apache-2.0
4+
* Copyright: Red Hat Inc. and Hibernate Authors
5+
*/
6+
package org.hibernate.reactive.env.asciidoctor;
7+
8+
import org.hibernate.infra.asciidoctor.extensions.copytoclipboard.CopyToClipboardProcessor;
9+
import org.hibernate.infra.asciidoctor.extensions.customnumbering.CustomNumberingProcessor;
10+
// import org.hibernate.infra.asciidoctor.extensions.sourcecodelanguage.SourcecodeLanguagePreprocessor;
11+
12+
import org.asciidoctor.Asciidoctor;
13+
import org.asciidoctor.extension.JavaExtensionRegistry;
14+
import org.asciidoctor.jruby.extension.spi.ExtensionRegistry;
15+
16+
public class HibernateAsciidoctorExtensionRegistry implements ExtensionRegistry {
17+
18+
@Override
19+
public void register(Asciidoctor asciidoctor) {
20+
JavaExtensionRegistry javaExtensionRegistry = asciidoctor.javaExtensionRegistry();
21+
javaExtensionRegistry.docinfoProcessor( CopyToClipboardProcessor.class );
22+
javaExtensionRegistry.treeprocessor( CustomNumberingProcessor.class );
23+
// javaExtensionRegistry.preprocessor( SourcecodeLanguagePreprocessor.class );
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.hibernate.reactive.env.asciidoctor.HibernateAsciidoctorExtensionRegistry

0 commit comments

Comments
 (0)