Skip to content

Commit 5e7732c

Browse files
doc: Website improvements
- Show Release vs. SNAPSHOT - FURO theme - fix inline tab appearance
1 parent a558871 commit 5e7732c

File tree

13 files changed

+2507
-2201
lines changed

13 files changed

+2507
-2201
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
# Exclude the Auto-generated Changelog
99
/src/site/sphinx/changelog.rst
10-
/src/site/sphinx/javadoc.rst
11-
/src/site/sphinx/syntax.rst
10+
/src/site/sphinx/javadoc_stable.rst
11+
/src/site/sphinx/syntax_stable.rst
1212

1313
# Generated by javacc-maven-plugin
1414
/bin
@@ -29,3 +29,5 @@
2929
/nbproject/
3030

3131
/.gradle
32+
/src/site/sphinx/javadoc_snapshot.rst
33+
/src/site/sphinx/syntax_snapshot.rst

build.gradle

Lines changed: 53 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ plugins {
1818

1919
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "latest.release"
2020
id "me.champeau.jmh" version "latest.release"
21+
id "com.nwalsh.gradle.saxon.saxon-gradle" version "0.9.6"
2122
}
2223

2324
def getVersion = { boolean considerSnapshot ->
@@ -28,7 +29,7 @@ def getVersion = { boolean considerSnapshot ->
2829
def commit = null
2930
def snapshot = ""
3031
new ByteArrayOutputStream().withStream { os ->
31-
def result = exec {
32+
exec {
3233
args = [
3334
"--no-pager"
3435
, "describe"
@@ -58,7 +59,7 @@ def getVersion = { boolean considerSnapshot ->
5859
}
5960
return patch!=null
6061
? "${major}.${minor}.${patch}${snapshot}"
61-
: "${major}.${minor}${snapshot}";
62+
: "${major}.${minor}${snapshot}"
6263
}
6364
version = getVersion(true)
6465
group = 'com.github.jsqlparser'
@@ -137,18 +138,33 @@ javadoc {
137138
}
138139

139140
tasks.register('xmldoc', Javadoc) {
141+
def outFile = reporting.file(
142+
version.endsWith("-SNAPSHOT")
143+
? "xmlDoclet/javadoc_snapshot.xml"
144+
: "xmlDoclet/javadoc_stable.xml"
145+
)
146+
147+
def rstFile = reporting.file(
148+
version.endsWith("-SNAPSHOT")
149+
? "xmlDoclet/javadoc_snapshot.rst"
150+
: "xmlDoclet/javadoc_stable.rst"
151+
)
152+
140153
source = sourceSets.main.allJava
141154
// beware: Gradle deletes this folder automatically and there is no switch-off
142155
destinationDir = reporting.file("xmlDoclet")
143-
options.docletpath = configurations.xmlDoclet.files.asType(List)
156+
options.docletpath = configurations.xmlDoclet.files as List
144157
options.doclet = "com.github.markusbernhardt.xmldoclet.XmlDoclet"
158+
title = "API $version"
145159
options.addBooleanOption("rst", true)
160+
options.addBooleanOption("withFloatingToc", true)
146161
options.addStringOption("basePackage", "net.sf.jsqlparser")
162+
options.addStringOption("filename", outFile.getName())
147163

148164
dependsOn(compileJava)
149165
doLast {
150166
copy {
151-
from reporting.file("xmlDoclet/javadoc.rst")
167+
from rstFile
152168
into "${projectDir}/src/site/sphinx/"
153169
}
154170
}
@@ -349,11 +365,6 @@ tasks.register('renderRR') {
349365
"${buildDir}/rr/JSqlParserCC.ebnf"
350366
]
351367
}
352-
353-
//@todo: a Java based solution may be more appropriate here
354-
exec {
355-
commandLine "sh", "-c", "xsltproc src/main/resources/rr/xhtml2rst.xsl $buildDir/rr/JSqlParserCC.xhtml > src/site/sphinx/syntax.rst"
356-
}
357368
}
358369
}
359370

@@ -409,26 +420,38 @@ tasks.register('updateKeywords', JavaExec) {
409420
dependsOn(compileJava)
410421
}
411422

412-
tasks.register('sphinx', Exec) {
413-
dependsOn(gitChangelogTask, renderRR, updateKeywords, xmldoc)
423+
xslt {
424+
def outFile = version.endsWith("-SNAPSHOT")
425+
? file("src/site/sphinx/syntax_snapshot.rst")
426+
: file("src/site/sphinx/syntax_stable.rst")
414427

415-
doFirst() {
416-
exec {
417-
args = [
418-
"install"
419-
, "sphinx_rtd_theme"
420-
, "sphinx-book-theme"
421-
, "myst_parser"
422-
, "sphinx-prompt"
423-
, "sphinx_substitution_extensions"
424-
, "sphinx_issues"
425-
, "sphinx-tabs"
426-
, "sphinx_inline_tabs"
427-
, "pygments"
428-
]
429-
executable "pip"
430-
}
431-
}
428+
dependsOn(renderRR)
429+
stylesheet 'src/main/resources/rr/xhtml2rst.xsl'
430+
431+
// Transform every .xml file in the "input" directory.
432+
input "$buildDir/rr/JSqlParserCC.xhtml"
433+
output outFile
434+
}
435+
436+
tasks.register('sphinx', Exec) {
437+
dependsOn(gitChangelogTask, renderRR, xslt, updateKeywords, xmldoc)
438+
439+
// doFirst() {
440+
// exec {
441+
// args = [
442+
// "install"
443+
// , "sphinx_rtd_theme"
444+
// , "sphinx-book-theme"
445+
// , "myst_parser"
446+
// , "sphinx-prompt"
447+
// , "sphinx_substitution_extensions"
448+
// , "sphinx_issues"
449+
// , "sphinx_inline_tabs"
450+
// , "pygments"
451+
// ]
452+
// executable "pip"
453+
// }
454+
// }
432455

433456
String PROLOG = """
434457
.. |_| unicode:: U+00A0
@@ -487,8 +510,8 @@ publishing {
487510
}
488511
}
489512
pom {
490-
name = 'JSQLParser librar'
491-
description = 'JDBC Table or ResultSet to Parquet File Writer'
513+
name = 'JSQLParser library'
514+
description = 'Parse SQL Statements into Abstract Syntax Trees (AST)'
492515
url = 'https://github.com/JSQLParser/JSqlParser'
493516
licenses {
494517
license {

src/main/resources/rr/xhtml2rst.xsl

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#L%
1010
-->
1111

12-
<xsl:stylesheet version="1.1"
12+
<xsl:stylesheet version="2.0"
1313
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
1414
xmlns:xhtml="http://www.w3.org/1999/xhtml"
1515
xmlns:svg="http://www.w3.org/2000/svg"
@@ -21,16 +21,31 @@
2121
omit-xml-declaration="yes"
2222
indent="no" />
2323

24+
<xsl:param name="withFloatingToc" select="'true'" />
25+
2426
<!-- a default catch is needed to suppress all unwanted nodes -->
2527
<xsl:template match="*">
28+
<xsl:text disable-output-escaping="yes">
29+
.. raw:: html
30+
31+
&lt;div id="floating-toc"&gt;
32+
&lt;div class="search-container"&gt;
33+
&lt;input type="button" id="toc-hide-show-btn"&gt;&lt;/input&gt;
34+
&lt;input type="text" id="toc-search" placeholder="Search" /&gt;
35+
&lt;/div&gt;
36+
&lt;ul id="toc-list"&gt;&lt;/ul&gt;
37+
&lt;/div&gt;
38+
39+
40+
</xsl:text>
2641
<xsl:apply-templates select="/xhtml:html/xhtml:body"/>
2742
</xsl:template>
2843

2944
<xsl:template match="/xhtml:html/xhtml:body">
3045
<xsl:text disable-output-escaping="yes">
31-
********************
32-
Supported SQL Syntax
33-
********************
46+
*********************************************************************
47+
SQL Syntax |JSQLPARSER_SNAPSHOT_VERSION|
48+
*********************************************************************
3449

3550
The EBNF and Railroad Diagrams for JSQLParser-|JSQLPARSER_VERSION|.
3651

@@ -41,12 +56,10 @@ The EBNF and Railroad Diagrams for JSQLParser-|JSQLPARSER_VERSION|.
4156
<xsl:template match="svg:svg[preceding-sibling::*[1]/xhtml:a]">
4257
<xsl:text disable-output-escaping="yes">
4358
======================================================================================================================
44-
</xsl:text>
45-
<xsl:value-of select="translate(preceding-sibling::*[1]/xhtml:a/text(),'\:','')"/>
46-
<xsl:text disable-output-escaping="yes">
59+
</xsl:text><xsl:value-of select="translate(preceding-sibling::*[1]/xhtml:a/text(),'\:','')"/><xsl:text disable-output-escaping="yes">
4760
======================================================================================================================
4861

49-
</xsl:text>
62+
</xsl:text>
5063

5164
<xsl:text disable-output-escaping="yes">
5265
.. raw:: html
@@ -92,12 +105,12 @@ The EBNF and Railroad Diagrams for JSQLParser-|JSQLPARSER_VERSION|.
92105
<xsl:template match="xhtml:a">
93106
<li>
94107
<a>
95-
<xsl:attributeExpression name="href">
108+
<xsl:attribute name="href">
96109
<xsl:value-of select="@href" />
97-
</xsl:attributeExpression>
98-
<xsl:attributeExpression name="title">
110+
</xsl:attribute>
111+
<xsl:attribute name="title">
99112
<xsl:value-of select="@title" />
100-
</xsl:attributeExpression>
113+
</xsl:attribute>
101114
<xsl:value-of select="text()"/>
102115
</a>
103116
</li>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* Styling for the floating TOC */
2+
#floating-toc {
3+
position: fixed;
4+
top: 50%;
5+
right: 20px;
6+
transform: translateY(-50%);
7+
background-color: rgba(255, 255, 255, 0.72);
8+
border: 1px solid rgba(64, 64, 64, 0.2); /* Set the border style */
9+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
10+
z-index: 9999;
11+
height: 66%;
12+
overflow-y: hide;
13+
overflow-x: auto;
14+
width: 240px;
15+
}
16+
17+
/* Styling for TOC list items */
18+
#floating-toc ul {
19+
list-style-type: none;
20+
padding-left: 26px;
21+
margin-top: 36px;
22+
line-height: 2px;
23+
}
24+
25+
/* Styling for heading levels in TOC */
26+
#floating-toc ul li {
27+
/* no line breaks please */
28+
width: 250%;
29+
}
30+
31+
#floating-toc ul li a {
32+
font-size: 14px;
33+
font-weight: normal;
34+
}
35+
36+
#floating-toc ul li h1 a {
37+
font-weight: bold;
38+
font-size: 16px;
39+
}
40+
41+
#floating-toc ul li h2 a {
42+
font-weight: bold;
43+
}
44+
45+
#floating-toc ul li h3 a {
46+
font-style: italic;
47+
}
48+
49+
50+
/* Styling for search input */
51+
#floating-toc .search-container {
52+
position: sticky;
53+
top: 6px;
54+
padding: 0px;
55+
}
56+
57+
#floating-toc input[type="text"] {
58+
width: 186px;
59+
height: 24px;
60+
box-sizing: border-box;
61+
background-color: rgba(255, 255, 255, 1.00);
62+
color: rgba(128, 128, 128, 1.0); /* Set the text color */
63+
border: 1px solid rgba(0, 0, 0, 0.2); /* Set the border style */
64+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
65+
}
66+
67+
68+
#floating-toc input[type="button"] {
69+
position: float;
70+
width: 24px;
71+
height: 24px;
72+
padding: 0;
73+
margin: 0;
74+
box-sizing: border-box;
75+
background-color: rgba(255, 255, 255, 0.72);
76+
color: rgba(128, 128, 128, 1.0); /* Set the text color */
77+
border: 0px solid rgba(0, 0, 0, 0.2); /* Set the border style */
78+
}
79+
80+
/* Highlighting current caption in TOC */
81+
#floating-toc ul li a.active {
82+
font-weight: bold;
83+
}

0 commit comments

Comments
 (0)