Skip to content

Commit 1dd5491

Browse files
generate PDF with TOC, outline, but without cover
1 parent e0ed766 commit 1dd5491

File tree

3 files changed

+182
-7
lines changed

3 files changed

+182
-7
lines changed

docs/stylesheets/extra.css

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
text-decoration: underline;
1111
}
1212

13-
.md-nav__link--active, .md-nav__link:active {
13+
.md-nav__link--active,
14+
.md-nav__link:active {
1415
color: #ff1744;
1516
text-decoration: none;
1617
}
@@ -28,8 +29,13 @@
2829
}
2930

3031
/* disable scrollbar */
31-
.md-typeset__scrollwrap, .md-typeset table:not([class]), .md-typeset .md-typeset__table table, .md-container,
32-
.md-main, html {
32+
.md-typeset__scrollwrap,
33+
.md-typeset table:not([class]),
34+
.md-typeset
35+
.md-typeset__table table,
36+
.md-container,
37+
.md-main,
38+
html {
3339
overflow-x: hidden;
3440
-webkit-overflow-scrolling: hidden
3541
}
@@ -50,5 +56,40 @@
5056
#about {
5157
page-break-before: avoid;
5258
}
53-
}
5459

60+
[id="variables-types"],
61+
[id="numeric-data-types"],
62+
[id="character-data-types"],
63+
[id="boolean-data-types"],
64+
[id="large-objects"],
65+
[id="dml-sql"],
66+
[id="bulk-operations"],
67+
[id="control-structures"],
68+
[id="case-if-decode-nvl-nvl2-coalesce"],
69+
[id="flow-control"],
70+
[id="exception-handling"],
71+
[id="dynamic-sql"],
72+
[id="stored-objects"],
73+
[id="packages"],
74+
[id="procedures"],
75+
[id="functions"],
76+
[id="oracle-supplied-packages"],
77+
[id="object-types"],
78+
[id="triggers"],
79+
[id="sequences"],
80+
[id="patterns"],
81+
[id="access-objects-of-foreign-application-schemas"],
82+
[id="validating-input-parameter-size"],
83+
[id="ensure-single-execution-at-a-time-of-a-program-unit"],
84+
[id="use-dbms_application_info-package-to-follow-progress-of-a-process"] {
85+
page-break-before: always;
86+
}
87+
88+
[id^="g-"] {
89+
page-break-before: always;
90+
}
91+
92+
[id*="10-"], [id^="g-8420"] {
93+
page-break-before: avoid;
94+
}
95+
}

docs/stylesheets/toc.xsl

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xsl:stylesheet version="2.0"
3+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4+
xmlns:outline="http://wkhtmltopdf.org/outline"
5+
xmlns="http://www.w3.org/1999/xhtml">
6+
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" indent="yes" />
7+
<xsl:template match="outline:outline">
8+
<html>
9+
<head>
10+
<title>Table of Contents</title>
11+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
12+
<style>
13+
h1 {
14+
text-align: center;
15+
font-size: 20px;
16+
font-family: Roboto;
17+
}
18+
div {
19+
border-bottom: 1px dashed rgb(200,200,200);
20+
page-break-inside: avoid;
21+
}
22+
span {
23+
float: right;
24+
}
25+
li {
26+
list-style: none;
27+
padding-top: 20px;
28+
}
29+
li li {
30+
padding-top: 5px;
31+
}
32+
li li li {
33+
padding-top: 0px;
34+
}
35+
ul {
36+
font-size: 20px;
37+
font-family: Roboto;
38+
padding-left: 0em;
39+
}
40+
ul ul {
41+
font-size: 80%;
42+
padding-left: 1em;
43+
}
44+
ul ul ul ul {
45+
font-size: 12.8px;
46+
margin-top: 0px;
47+
margin-bottom: 0px;
48+
}
49+
ul ul ul ul ul {
50+
display: none;
51+
}
52+
a {text-decoration:none; color: black;}
53+
</style>
54+
</head>
55+
<body>
56+
<h1>Table of Contents</h1>
57+
<ul>
58+
<xsl:apply-templates select="outline:item/outline:item"/>
59+
</ul>
60+
</body>
61+
</html>
62+
</xsl:template>
63+
<xsl:template match="outline:item">
64+
<li>
65+
<xsl:if test="@title!='' and @title!='Reason' and @title!='Example (bad)' and @title!='Example (good)'">
66+
<div>
67+
<a>
68+
<xsl:if test="@link">
69+
<xsl:attribute name="href">
70+
<xsl:value-of select="@link"/>
71+
</xsl:attribute>
72+
</xsl:if>
73+
<xsl:if test="@backLink">
74+
<xsl:attribute name="name">
75+
<xsl:value-of select="@backLink"/>
76+
</xsl:attribute>
77+
</xsl:if>
78+
<xsl:value-of select="@title" />
79+
</a>
80+
<span>
81+
<xsl:value-of select="@page" />
82+
</span>
83+
</div>
84+
</xsl:if>
85+
<ul>
86+
<xsl:comment>added to prevent self-closing tags in QtXmlPatterns</xsl:comment>
87+
<xsl:apply-templates select="outline:item"/>
88+
</ul>
89+
</li>
90+
</xsl:template>
91+
</xsl:stylesheet>

tools/genpdf-in-container.sh

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function write_text(){
2626
function write_guidelines(){
2727
DIR=$1
2828
HEADER=$2
29-
for f in ${DATA_DIR}/docs/${DIR}/g-*.md
29+
for f in ${DATA_DIR}/docs/${DIR}/*.md
3030
do
3131
echo "" >> ${TARGET_DIR}/docs/index.md
3232
sed -e "s|# |${HEADER} |g" $f >> ${TARGET_DIR}/docs/index.md
@@ -44,6 +44,7 @@ function convert_to_pdf(){
4444
cd site
4545
wkhtmltopdf --javascript-delay 3000 \
4646
--outline-depth 6 \
47+
--outline \
4748
--print-media-type \
4849
--margin-top 10 \
4950
--margin-right 10 \
@@ -54,7 +55,9 @@ function convert_to_pdf(){
5455
--footer-font-size 8 \
5556
--footer-left "Version $(get_version)" \
5657
--footer-right "Page [page] of [topage]" \
57-
toc --toc-header-text "PL/SQL and SQL Coding Guidelines" \
58+
--title "PL/SQL & SQL Coding Guidelines Version $(get_version)" \
59+
toc \
60+
--xsl-style-sheet stylesheets/toc.xsl \
5861
index.html ${DATA_DIR}/PLSQL-and-SQL-Coding-Guidelines.pdf
5962
}
6063

@@ -70,7 +73,7 @@ write_file "3-coding-style/coding-style.md"
7073
write_text "# Language Usage"
7174
write_text "## General"
7275
write_guidelines "4-language-usage/1-general" "###"
73-
write_text "## Numeric Data Types"
76+
write_text "## Variables &amp; Types"
7477
write_text "### General"
7578
write_guidelines "4-language-usage/2-variables-and-types/1-general" "####"
7679
write_text "### Numeric Data Types"
@@ -84,6 +87,46 @@ write_guidelines "4-language-usage/2-variables-and-types/5-large-objects" "####"
8487
write_text "## DML &amp; SQL"
8588
write_text "### General"
8689
write_guidelines "4-language-usage/3-dml-and-sql/1-general" "####"
90+
write_text "### Bulk Operations"
91+
write_guidelines "4-language-usage/3-dml-and-sql/2-bulk-operations" "####"
92+
write_text "## Control Structures"
93+
write_text "### CURSOR"
94+
write_guidelines "4-language-usage/4-control-structures/1-cursor" "####"
95+
write_text "### CASE / IF / DECODE / NVL / NVL2 / COALESCE"
96+
write_guidelines "4-language-usage/4-control-structures/2-case-if-decode-nvl-nvl2-coalesce" "####"
97+
write_text "### Flow Control"
98+
write_guidelines "4-language-usage/4-control-structures/3-flow-control" "####"
99+
write_text "## Exception Handling"
100+
write_guidelines "4-language-usage/5-exception-handling" "###"
101+
write_text "## Dynamic SQL"
102+
write_guidelines "4-language-usage/6-dynamic-sql" "###"
103+
write_text "## Stored Objects"
104+
write_text "### General"
105+
write_guidelines "4-language-usage/7-stored-objects/1-general" "####"
106+
write_text "### Packages"
107+
write_guidelines "4-language-usage/7-stored-objects/2-packages" "####"
108+
write_text "### Procedures"
109+
write_guidelines "4-language-usage/7-stored-objects/3-procedures" "####"
110+
write_text "### Functions"
111+
write_guidelines "4-language-usage/7-stored-objects/4-functions" "####"
112+
write_text "### Oracle Supplied Packages"
113+
write_guidelines "4-language-usage/7-stored-objects/5-oracle-supplied-packages" "####"
114+
write_guidelines "4-language-usage/7-stored-objects/6-object-types" "###"
115+
write_text "### Triggers"
116+
write_guidelines "4-language-usage/7-stored-objects/7-triggers" "####"
117+
write_text "### Sequences"
118+
write_guidelines "4-language-usage/7-stored-objects/8-sequences" "####"
119+
write_text "## Patterns"
120+
write_text "### Checking the Number of Rows"
121+
write_guidelines "4-language-usage/8-patterns/1-checking-the-number-of-rows" "####"
122+
write_text "### Access objects of foreign application schemas"
123+
write_guidelines "4-language-usage/8-patterns/2-access-objects-of-foreign-application-schemas" "####"
124+
write_text "### Validating input parameter size"
125+
write_guidelines "4-language-usage/8-patterns/3-validating-input-parameter-size" "####"
126+
write_text "### Ensure single execution at a time of a program unit"
127+
write_guidelines "4-language-usage/8-patterns/4-ensure-single-execution-at-a-time-of-a-program-unit" "####"
128+
write_text "### Use dbms_application_info package to follow progress of a process"
129+
write_guidelines "4-language-usage/8-patterns/5-use-dbms-application-info-package-to-follow-progress-of-a-process" "####"
87130
write_file "5-complexity-analysis/complexity-analysis.md"
88131
write_file "6-code-reviews/code-reviews.md"
89132
write_file "7-tool-support/tool-support.md"

0 commit comments

Comments
 (0)