Skip to content

Commit e87a727

Browse files
marko-bekhtaDavideD
authored andcommitted
[#2560] Apply the unified Hibernate Documentation theme
- for javadocs - for asciidoc
1 parent 0c6ff81 commit e87a727

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
@@ -7,6 +7,14 @@ plugins {
77
id "hr-java-library"
88
}
99

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

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

@@ -90,6 +118,8 @@ def aggregateJavadocsTask = tasks.register( 'aggregateJavadocs', Javadoc ) {
90118
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
91119
}
92120
}
121+
122+
dependsOn 'unpackTheme'
93123
}
94124

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

111146
resources {
112147
from( sourceDir ) {
113148
include 'images/**'
149+
}
150+
from(rootProject.layout.buildDirectory.dir("unpacked-theme").get()
151+
.dir("hibernate-asciidoctor-theme").dir("asciidoc")) {
114152
include 'css/**'
153+
include 'images/**'
154+
include 'script/**'
115155
}
116156
}
117157

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

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

130180
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Lines changed: 0 additions & 227 deletions
This file was deleted.
-20 KB
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+
}
Lines changed: 25 additions & 0 deletions
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+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.hibernate.reactive.env.asciidoctor.HibernateAsciidoctorExtensionRegistry

0 commit comments

Comments
 (0)