Skip to content

Commit

Permalink
Merge pull request #167 from ndw/print
Browse files Browse the repository at this point in the history
Improvements, mostly related to CSS and especially CSS print formatting
  • Loading branch information
ndw authored Jul 24, 2022
2 parents 40e03c2 + 182d490 commit 4af8cdd
Show file tree
Hide file tree
Showing 592 changed files with 11,606 additions and 1,827 deletions.
72 changes: 17 additions & 55 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ task setupXsltExplorer(type: Download) {
}

task copyResources(type: Copy,
dependsOn: ['copyTestMedia', 'makePrintCSS', 'zipStageResources',
dependsOn: ['copyTestMedia', 'zipStageResources',
'zipStageMisc']) {
from "${buildDir}/stage/zip/resources"
into "${buildDir}/actual"
Expand Down Expand Up @@ -341,21 +341,6 @@ task copyDocker(type: Copy) {
}
}

task makePrintCSS(type: Exec, dependsOn: ['copyTestMedia']) {
inputs.file("${projectDir}/src/main/web/css/docbook.css")
inputs.file("${projectDir}/src/main/web/css/docbook-paged.css")
inputs.file("${projectDir}/tools/flattencss.py")
outputs.file("${buildDir}/actual/css/print.css")
commandLine "python3", "${projectDir}/tools/flattencss.py",
"--version", xslTNGversion, "--title", xslTNGtitle,
"--source", "${projectDir}/src/main/web/css/docbook.css",
"--source", "${projectDir}/src/main/web/css/docbook-paged.css",
"--output", "${buildDir}/actual/css/print.css"
doFirst {
mkdir "${buildDir}/actual/css"
}
}

task copyReportResources(type: Copy,
dependsOn: ['copyReportSources',
'copyExpectedResources',
Expand Down Expand Up @@ -1049,7 +1034,7 @@ task makeXslt(type: Copy,
into "${buildDir}/xslt"
}

task makeUriList(dependsOn: ["makeXslt","zipStageResources","zipStagePrintCSS","zipStageDocker",
task makeUriList(dependsOn: ["makeXslt","zipStageResources","zipStageDocker",
"zipStageXslt", "zipStageBin"]) {
inputs.files fileTree("${buildDir}/xslt")
inputs.files fileTree("${buildDir}/stage/zip")
Expand Down Expand Up @@ -1201,21 +1186,7 @@ task zipStageResources(type: Copy, dependsOn: ["zipStagePygments"]) {
}
}

task zipStagePrintCSS(type: Copy, dependsOn: ['makePrintCSS']) {
from "${buildDir}/actual"
include "css/print.css"
into "${buildDir}/stage/zip/resources"
filter { String line ->
if (line.indexOf("@@") >= 0) {
line = line
.replace("@@TITLE@@", xslTNGtitle)
.replace("@@VERSION@@", xslTNGversion)
}
line
}
}

task zipStageSamples(dependsOn: ["zipStageResources", "zipStagePrintCSS"]) {
task zipStageSamples(dependsOn: ["zipStageResources"]) {
doLast {
copy {
from "${buildDir}/stage/zip/resources"
Expand Down Expand Up @@ -1341,25 +1312,6 @@ task guideCustomResources(type: Copy) {
into "${buildDir}/guide/"
}

task guidePrintCSS(type: Exec, dependsOn: ['guideDocBookResources']) {
inputs.file("${projectDir}/src/main/web/css/docbook.css")
inputs.file("${projectDir}/src/main/web/css/docbook-paged.css")
inputs.file("${projectDir}/src/guide/resources/css/guide.css")
inputs.file("${projectDir}/src/guide/resources/css/guide-paged.css")
inputs.file("${projectDir}/tools/flattencss.py")
outputs.file("${buildDir}/guide/css/print.css")
commandLine "python3", "${projectDir}/tools/flattencss.py",
"--version", xslTNGversion, "--title", xslTNGtitle,
"--source", "${projectDir}/src/main/web/css/docbook.css",
"--source", "${projectDir}/src/main/web/css/docbook-paged.css",
"--source", "${projectDir}/src/guide/resources/css/guide.css",
"--source", "${projectDir}/src/guide/resources/css/guide-paged.css",
"--output", "${buildDir}/guide/css/print.css"
doFirst {
mkdir "${buildDir}/guide/css"
}
}

task xincludeGuide(type: SaxonXsltTask, dependsOn: ['guideResources']) {
inputs.files fileTree(dir: "${projectDir}/src/guide/xml")
inputs.file "${projectDir}/tools/xinclude.xsl"
Expand All @@ -1383,8 +1335,13 @@ task validateGuide(type: RelaxNGValidateTask, dependsOn: ['copyGuide']) {
output "${buildDir}/guide/validated.xml"
}

task guide(type: SaxonXsltTask, dependsOn: ['makeXslt', 'validateGuide', 'explorer']) {
task guide(
type: SaxonXsltTask,
dependsOn: ['makeXslt', 'validateGuide', 'explorer']
) {
inputs.files fileTree(dir: "${buildDir}/xslt")
inputs.files fileTree(dir: "${projectDir}/src/guide/xml")
inputs.files fileTree(dir: "${projectDir}/src/guide/xsl")
inputs.file("${buildDir}/docbook-xslTNG.xml")
outputs.file("${buildDir}/guide/index.html")

Expand All @@ -1404,11 +1361,15 @@ task guide(type: SaxonXsltTask, dependsOn: ['makeXslt', 'validateGuide', 'explor
)
}

task "guide.pdf.html"(type: SaxonXsltTask, dependsOn: ['makeXslt', 'validateGuide', 'explorer']) {
task "guide.pdf.html"(
type: SaxonXsltTask,
dependsOn: ['makeXslt', 'validateGuide', 'explorer']
) {
inputs.files fileTree(dir: "${buildDir}/xslt")
inputs.file "${buildDir}/docbook-xslTNG.xml"
inputs.files fileTree(dir: "${projectDir}/src/guide/xsl")

pluginConfiguration "docbook"
input "${buildDir}/guide/guide.xml"
stylesheet "${projectDir}/src/guide/xsl/print.xsl"
output "${buildDir}/guide/guide.pdf.html"
Expand All @@ -1419,12 +1380,13 @@ task "guide.pdf.html"(type: SaxonXsltTask, dependsOn: ['makeXslt', 'validateGuid
'mediaobject-input-base-uri': "file:${buildDir}/src/guide/resources/",
'mediaobject-output-base-uri': './',
'profile-outputformat': 'print',
'page-style': 'book',
'resource-base-uri': ''
)
}

if (pdftool == "prince") {
task "guide.pdf"(type: Exec, dependsOn: ["guide.pdf.html", 'guidePrintCSS']) {
task "guide.pdf"(type: Exec, dependsOn: ["guide.pdf.html"]) {
inputs.file("${buildDir}/guide/guide.pdf.html")
inputs.files fileTree(dir: "${buildDir}/guide/css")
outputs.file("${buildDir}/guide/guide.pdf")
Expand All @@ -1433,7 +1395,7 @@ if (pdftool == "prince") {
"-o", "${buildDir}/guide/guide.pdf"
}
} else {
task "guide.pdf"(type: Exec, dependsOn: ["guide.pdf.html", 'guidePrintCSS']) {
task "guide.pdf"(type: Exec, dependsOn: ["guide.pdf.html"]) {
inputs.file("${buildDir}/guide/guide.pdf.html")
inputs.files fileTree(dir: "${buildDir}/guide/css")
outputs.file("${buildDir}/guide/guide.pdf")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ xspecVersion=2.2.4
xsltExplorerVersion=0.1.10

pdftool=antennahouse
antennahouse=/usr/local/AHFormatterV70/bin/AHFCmd
antennahouse=/usr/local/AHFormatterV72/bin/AHFCmd
prince=/usr/local/bin/prince

# List of test documents that are in the Publishers schema
Expand Down
6 changes: 3 additions & 3 deletions properties.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
ext {
xslTNGtitle = 'DocBook xslTNG'
xslTNGbaseName = 'docbook-xslTNG'
xslTNGversion = '1.7.1'
guideVersion = '1.7.1'
xslTNGversion = '1.8.0'
guideVersion = '1.8.0'

docbookVersion = '5.2CR1'
publishersVersion = '5.2CR1'
Expand All @@ -16,7 +16,7 @@ ext {

metadataExtractorVersion = '2.15.0'
jingVersion = '20220510'
xmlresolverVersion = '4.4.0'
xmlresolverVersion = '4.4.3'
sincludeVersion = '4.1.0'
slf4jVersion = '1.7.30'
}
74 changes: 57 additions & 17 deletions src/guide/resources/css/guide-online.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ html {
line-height: 1.5;
}

.book header .fill {
.book > header .fill {
display: grid;
grid-template-rows: auto 1fr auto;
grid-template-columns: 100%;
min-height: 640px;
}

.book header {
padding-bottom: 1rem;
}

.book header {
.book > header {
display: table;
padding: 0;
border-left: none;
Expand All @@ -27,21 +23,25 @@ html {
text-align: right;
}

.book header .cover {
.book > header {
padding-bottom: 1rem;
}

.book > header .cover {
display: table-row;
}

.book header .cover .image {
.book > header .cover .image {
display: table-cell;
vertical-align: top;
}

.book header .cover .text {
.book > header .cover .text {
display: table-cell;
vertical-align: top;
}

.book header h1 {
.book > header h1 {
text-align: right;
}

Expand Down Expand Up @@ -181,6 +181,45 @@ div.copyrightfooter {
font-size: 14px;
}

.revhistory {
background-color: var(--secondary-color);
border-radius: 0.5em;
}

.revhistory code {
background-color: inherit;
border-color: var(--primary-variant-color);
}

.revhistory header {
display: none;
}

.revhistory > ul {
list-style: none;
padding-left: 0;
}

.revnumber::before {
content: "Version ";
}

.revhistory ul li div.revnumber {
margin-left: 2rem;
}

.revhistory ul li div.revnumber {
text-indent: -1rem;
}

.revhistory ul li div.revnumber::before {
content: "• ";
}

.revhistory ul li div.revdescription {
margin-left: 1rem;
}

@media screen and (max-width: 374px) {
.book header h1 {
font-size: 2rem;
Expand Down Expand Up @@ -215,20 +254,20 @@ div.copyrightfooter {
padding-right: 2rem;
}

.book header {
.book > header {
font-size: 1rem;
line-height: 1.25;
}

.book header h1 {
.book > header h1 {
font-size: 2.5rem;
}

.cover img {
max-height: 480px;
}

.book header .fill {
.book > header .fill {
min-height: 480px;
}
}
Expand All @@ -247,24 +286,25 @@ div.copyrightfooter {
padding-right: 1rem;
}

.book header {
.book > header {
border: 2px solid #afafaf;
padding: 1rem;
}

.book header {
.book > header {
text-align: left;
}

.book header h1 {
.book > header h1 {
text-align: left;
}

.book header .fill {
.book > header .fill {
min-height: inherit;
}

header img {
display: none;
}
}

Loading

0 comments on commit 4af8cdd

Please sign in to comment.