Skip to content

Commit db152d1

Browse files
committed
[docs] Configuration properties in single file
Title of single page configuration reference
1 parent 40cb711 commit db152d1

File tree

8 files changed

+171
-77
lines changed

8 files changed

+171
-77
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ bin/
1616
.project
1717
*/test/
1818
*/META-INF/
19-
src/main/docs/guide/appendix/propertyReference.adoc
19+
src/main/docs/generated/*.adoc

gradle/docs.gradle

+32-1
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,37 @@ task replaceAtLink {
108108
}
109109
}
110110

111+
task copyConfigurationReference(type: Copy) {
112+
ext {
113+
destinationFileName = "configurationreference.html"
114+
}
115+
group = DOCUMENTATION_GROUP
116+
from "${rootProject.projectDir}/src/main/docs/resources/style/page.html"
117+
into "${rootProject.buildDir}/docs/guide/"
118+
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
119+
projectVersion: projectVersion,
120+
pagetitle: 'Configuration Reference | Micronaut',
121+
docscontent: org.asciidoctor.Asciidoctor.Factory.create().render(new File("${project.projectDir}/src/main/docs/generated/propertyReference.adoc").exists() ? new File("${project.projectDir}/src/main/docs/generated/propertyReference.adoc").text : '', [:] as Map<String, Object>)])
122+
rename { String fileName ->
123+
fileName.replace("page.html", destinationFileName)
124+
}
125+
}
126+
127+
task cleanupGuideFiles(type: Delete) {
128+
group = DOCUMENTATION_GROUP
129+
delete fileTree("${rootProject.buildDir}/docs/guide") {
130+
include '*.html'
131+
exclude 'index.html'
132+
exclude copyConfigurationReference.destinationFileName
133+
}
134+
delete fileTree("${rootProject.buildDir}/docs/guide/pages") {
135+
include '*.html'
136+
}
137+
}
138+
111139
task mergeConfigProps() {
112140
inputs.files( fileTree( "$project.buildDir/config-props" ) ).skipWhenEmpty()
113-
outputs.file( "$project.projectDir/src/main/docs/guide/appendix/propertyReference.adoc" )
141+
outputs.file( "${project.projectDir}/src/main/docs/generated/propertyReference.adoc" )
114142
doLast {
115143
outputs.files.singleFile.withOutputStream { out ->
116144
List<File> files = new ArrayList<>(inputs.files.files).sort { File f -> f.name }
@@ -126,6 +154,8 @@ task mergeConfigProps() {
126154
}
127155
mustRunAfter 'replaceAtLink'
128156
}
157+
copyConfigurationReference.mustRunAfter mergeConfigProps
158+
copyConfigurationReference.finalizedBy cleanupGuideFiles
129159

130160
task publishGuide(type: grails.doc.gradle.PublishGuide) {
131161
group = DOCUMENTATION_GROUP
@@ -171,6 +201,7 @@ task publishGuide(type: grails.doc.gradle.PublishGuide) {
171201
}
172202
publishGuide.dependsOn mergeConfigProps
173203
publishGuide.dependsOn replaceAtLink
204+
publishGuide.dependsOn copyConfigurationReference
174205

175206
task docs(dependsOn:[javadoc, publishGuide]) {
176207
group = DOCUMENTATION_GROUP
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Folder where the generated @ConfigurationProperties table will be placed.

src/main/docs/guide/toc.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -281,5 +281,4 @@ appendix:
281281
faq: Frequently Asked Questions (FAQ)
282282
usingsnapshots: Using Snapshots
283283
problems: Common Problems
284-
breaks: Breaking Changes
285-
propertyReference: Configuration Property Reference
284+
breaks: Breaking Changes

src/main/docs/resources/css/custom.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ a:hover,
183183
.project {
184184
margin-top: 75px;
185185
}
186-
#main {
186+
body#docs #main {
187187
padding-left: 25em;
188188
margin-left: 0;
189189
margin-right: 0;

src/main/docs/resources/js/guide.js

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
function wrapElementsInLinks(x) {
2+
var i;
3+
for (i = 0; i < x.length; i++) {
4+
if (x[i].id !== '') {
5+
var link = document.createElement('a');
6+
link.innerHTML = x[i].outerHTML;
7+
link.setAttribute('href', 'index.html#'+x[i].id);
8+
x[i].parentNode.insertBefore(link, x[i]);
9+
x[i].remove();
10+
}
11+
}
12+
}
13+
wrapElementsInLinks(document.querySelectorAll("h1"));
14+
wrapElementsInLinks(document.querySelectorAll("h2"));
15+
wrapElementsInLinks(document.querySelectorAll("h3"));
16+
17+
var tocId = "table-of-content";
18+
var tocLink = "table-of-content-nav-link";
19+
var mainId = "main";
20+
function hideTableOfContents() {
21+
document.getElementById(tocId).style.display = "none";
22+
document.getElementById(mainId).style.paddingLeft = "0";
23+
var aEl = document.getElementById(tocLink).getElementsByTagName("a")[0];
24+
replaceLink(aEl, "javascript:showTableOfContents();", "[ - ]", 'Show Table of Contents');
25+
goToLocation();
26+
}
27+
28+
function goToLocation() {
29+
if(location.hash != '') {
30+
window.location = location;
31+
}
32+
}
33+
34+
function replaceLink(anchorElement, href, text, titleAttr) {
35+
anchorElement.setAttribute("href", href);
36+
anchorElement.setAttribute("title", titleAttr);
37+
anchorElement.innerText = text;
38+
}
39+
40+
function showTableOfContents() {
41+
document.getElementById(tocId).style.display = "block";
42+
document.getElementById(mainId).style.paddingLeft = "25em";
43+
var aEl = document.getElementById(tocLink).getElementsByTagName("a")[0];
44+
replaceLink(aEl, "javascript:hideTableOfContents();", "[ + ]", 'Hide Table of Contents');
45+
goToLocation();
46+
}
47+
48+
function scrollToTop() {
49+
document.getElementById(tocId).style.display = "block";
50+
document.body.scrollTop = 0; // For Safari
51+
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
52+
}
53+
54+
function highlightMenu() {
55+
var cssClass = 'toc-item-highlighted';
56+
var els = document.getElementsByClassName(cssClass);
57+
for (var x = 0; x < els.length; x++) {
58+
els[x].classList.remove(cssClass);
59+
}
60+
console.log("highlighting hash" + location.hash);
61+
if(location.hash != '') {
62+
var elId = "toc-item-"+location.hash.replace('#', '');
63+
if(document.getElementById(elId)) {
64+
document.getElementById(elId).getElementsByTagName('a')[0].classList.add(cssClass);
65+
document.getElementById(elId).scrollIntoView(true);
66+
}
67+
}
68+
}
69+
70+
goToLocation();
71+
highlightMenu();

src/main/docs/resources/style/layout.html

+8-72
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="${resourcesPath}/css/pdf.css" type="text/css" media="print" title="PDF" charset="utf-8" />
1010
<link rel="stylesheet" href="${resourcesPath}/css/highlight/agate.css">
1111
<script src="${resourcesPath}/js/highlight.pack.js"></script>
12+
<script src="${resourcesPath}/js/guide.js"></script>
1213
<script>hljs.initHighlightingOnLoad();</script>
1314
<script src="${resourcesPath}/js/docs.js"></script>
1415
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.13/clipboard.min.js"></script>
@@ -22,7 +23,7 @@
2223

2324
</head>
2425

25-
<body class="body" onload="addJsClass();" onhashchange="highlightMenu()">
26+
<body class="body" id="docs" onload="addJsClass();" onhashchange="highlightMenu()">
2627

2728
<div id="table-of-content-nav-link" class="desktop">
2829
<a title="Collapse/Open Table of contents" title="Hide Table of Contents" href="javascript:hideTableOfContents();" class="button">[ + ]</a>
@@ -66,6 +67,12 @@
6667
<li class="mobile">
6768
<a title="Go to API documentation" href="${path}/api/index.html" class="button">API</a>
6869
</li>
70+
<li class="desktop">
71+
<a title="Go to Configuration Reference documentation" href="${path}/guide/configurationreference.html" class="button">Configuration Reference</a>
72+
</li>
73+
<li class="mobile">
74+
<a title="Go to Configuration Reference documentation" href="${path}/guide/configurationreference.html" class="button">Conf</a>
75+
</li>
6976
</ul>
7077

7178
</div>
@@ -113,77 +120,6 @@ <h1>${title.encodeAsHtml()}</h1>
113120
</div>
114121

115122
<script type="text/javascript">
116-
function wrapElementsInLinks(x) {
117-
var i;
118-
for (i = 0; i < x.length; i++) {
119-
if (x[i].id !== '') {
120-
var link = document.createElement('a');
121-
link.innerHTML = x[i].outerHTML;
122-
link.setAttribute('href', 'index.html#'+x[i].id);
123-
x[i].parentNode.insertBefore(link, x[i]);
124-
x[i].remove();
125-
}
126-
}
127-
}
128-
wrapElementsInLinks(document.querySelectorAll("h1"));
129-
wrapElementsInLinks(document.querySelectorAll("h2"));
130-
wrapElementsInLinks(document.querySelectorAll("h3"));
131-
132-
var tocId = "table-of-content";
133-
var tocLink = "table-of-content-nav-link";
134-
var mainId = "main";
135-
function hideTableOfContents() {
136-
document.getElementById(tocId).style.display = "none";
137-
document.getElementById(mainId).style.paddingLeft = "0";
138-
var aEl = document.getElementById(tocLink).getElementsByTagName("a")[0];
139-
replaceLink(aEl, "javascript:showTableOfContents();", "[ - ]", 'Show Table of Contents');
140-
goToLocation();
141-
}
142-
143-
function goToLocation() {
144-
if(location.hash != '') {
145-
window.location = location;
146-
}
147-
}
148-
149-
function replaceLink(anchorElement, href, text, titleAttr) {
150-
anchorElement.setAttribute("href", href);
151-
anchorElement.setAttribute("title", titleAttr);
152-
anchorElement.innerText = text;
153-
}
154-
155-
function showTableOfContents() {
156-
document.getElementById(tocId).style.display = "block";
157-
document.getElementById(mainId).style.paddingLeft = "25em";
158-
var aEl = document.getElementById(tocLink).getElementsByTagName("a")[0];
159-
replaceLink(aEl, "javascript:hideTableOfContents();", "[ + ]", 'Hide Table of Contents');
160-
goToLocation();
161-
}
162-
163-
function scrollToTop() {
164-
document.getElementById(tocId).style.display = "block";
165-
document.body.scrollTop = 0; // For Safari
166-
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
167-
}
168-
169-
function highlightMenu() {
170-
var cssClass = 'toc-item-highlighted';
171-
var els = document.getElementsByClassName(cssClass);
172-
for (var x = 0; x < els.length; x++) {
173-
els[x].classList.remove(cssClass);
174-
}
175-
console.log("highlighting hash" + location.hash);
176-
if(location.hash != '') {
177-
var elId = "toc-item-"+location.hash.replace('#', '');
178-
if(document.getElementById(elId)) {
179-
document.getElementById(elId).getElementsByTagName('a')[0].classList.add(cssClass);
180-
document.getElementById(elId).scrollIntoView(true);
181-
}
182-
}
183-
}
184-
185-
goToLocation();
186-
highlightMenu();
187123

188124
</script>
189125
</body>
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4+
<head>
5+
<title>@pagetitle@</title>
6+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7+
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen, print" title="Style" charset="utf-8" />
8+
<link rel="stylesheet" href="../css/custom.css" type="text/css" media="screen, print" title="Style" charset="utf-8" />
9+
<link rel="stylesheet" href="../css/pdf.css" type="text/css" media="print" title="PDF" charset="utf-8" />
10+
<link rel="stylesheet" href="../css/highlight/agate.css">
11+
<script src="../js/highlight.pack.js"></script>
12+
<script src="../js/guide.js"></script>
13+
<script>hljs.initHighlightingOnLoad();</script>
14+
<script src="../js/docs.js"></script>
15+
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.5.13/clipboard.min.js"></script>
16+
</head>
17+
<body class="body">
18+
<div id="main">
19+
<div id="navigation">
20+
<div class="navTitle">
21+
<span id="logo"><a href="http://micronaut.io" title="Go to Micronaut Website"><img src="../img/micronaut-logo-white.svg" alt="Micronaut"/></a></span>
22+
</div>
23+
<div class="navLinks">
24+
<ul>
25+
<li id="table-of-content-nav-link-mobile" class="mobile">
26+
<a title="Scroll to Table of contents" href="javascript:scrollToTop();" class="button">Toc</a>
27+
</li>
28+
<li>
29+
<a title="Go to documentation" href="index.html" class="button">Docs</a>
30+
</li>
31+
<li class="desktop">
32+
<a title="Go to API documentation" href="../api/index.html" class="button">API Reference</a>
33+
</li>
34+
<li class="mobile">
35+
<a title="Go to API documentation" href="../api/index.html" class="button">API</a>
36+
</li>
37+
<li class="desktop">
38+
<a title="Go to Configuration Reference documentation" href="configurationreference.html" class="button">Configuration Reference</a>
39+
</li>
40+
<li class="mobile">
41+
<a title="Go to Configuration Reference documentation" href="configurationreference.html" class="button">Conf</a>
42+
</li>
43+
</ul>
44+
</div>
45+
</div>
46+
<div class="docs-content">
47+
<div class="project">
48+
<h1>Configuration Reference</h1>
49+
<p><strong>Version:</strong>@projectVersion@</p>
50+
<p></p>
51+
</div>
52+
@docscontent@
53+
</div>
54+
</div>
55+
</body>
56+
</html>

0 commit comments

Comments
 (0)