Skip to content

Commit 1fe5bc7

Browse files
Merge pull request #138 from Trivadis/feature/issue-127-update-mktools
Feature/issue 127 update mktools
2 parents e448c81 + ff72ab9 commit 1fe5bc7

File tree

7 files changed

+48
-56
lines changed

7 files changed

+48
-56
lines changed

custom-theme/partials/header.html

Lines changed: 0 additions & 41 deletions
This file was deleted.

docker/Dockerfile

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
1-
FROM oraclelinux:8
1+
FROM oraclelinux:8.6
2+
ARG TARGETPLATFORM
23

34
LABEL maintainer="philipp.salvisberg@trivadis.com"
45
LABEL description="Tools to generate HTML and PDF using Materials for MkDocs and wkhtmltopdf."
5-
LABEL build.command="docker build . --tag trivadis/mktools:latest"
6+
7+
# To build a mulit-architecture image and push it to the docker registry (load is not supported)
8+
LABEL build.prepare.command="docker buildx create --use --name mktools"
9+
LABEL build.multiarch.command="docker buildx build --platform linux/amd64,linux/arm64 . --tag trivadis/mktools:latest --push"
10+
11+
# To build a single-architecture image and load it into local docker images list (not possible for multi-architecture images)
12+
LABEL build.amd64.command="docker buildx build --platform linux/amd64 . --tag trivadis/mktools:latest --load"
13+
LABEL build.arm64.command="docker buildx build --platform linux/ard64 . --tag trivadis/mktools:latest --load"
614

715
# install python
816
RUN dnf -y update
9-
RUN dnf -y install python38 python38-pip
17+
RUN dnf -y install python39 python39-pip
1018

1119
# install git
1220
RUN dnf -y install git
@@ -15,14 +23,23 @@ RUN dnf -y install git
1523
# using "--root" should suppress "WARNING: Running pip install with root privileges is generally not a good idea." in future releases
1624
RUN python3 -m pip install --upgrade pip --root /
1725
RUN python3 -m pip install --root / \
18-
'mkdocs==1.1.2' \
19-
'mkdocs-material==6.2.8' \
20-
'mkdocs-awesome-pages-plugin==2.5.0' \
21-
'pymdown-extensions==8.1.1' \
22-
'mike==0.5.5'
23-
24-
# install wkhtmltox 0.12.6
25-
RUN dnf -y install https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
26+
'mkdocs==1.3.1' \
27+
'mkdocs-material==8.3.9' \
28+
'mkdocs-awesome-pages-plugin==2.8.0' \
29+
'pymdown-extensions==9.5' \
30+
'mike==1.1.2' \
31+
'setuptools==63.4.2'
32+
33+
# install wkhtmltox 0.12.6.1 r2
34+
RUN if [ "$TARGETPLATFORM" == "linux/amd64" ] ; \
35+
then dnf -y install https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux8.x86_64.rpm ; \
36+
else dnf -y install https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux8.aarch64.rpm ; \
37+
fi
38+
39+
# install Node.js, PostCSS Preset Env and csstools-cli (used to simplify CSS so that it is understood by wkhtmltopdf)
40+
RUN dnf -y module install nodejs:16
41+
RUN npm install postcss-preset-env -g
42+
RUN npm install @csstools/csstools-cli -g
2643

2744
# set environment
2845
ENV LANG=en_US.utf8
14.5 KB
Loading
-7.97 KB
Loading

docs/stylesheets/extra.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* fix logo size */
2-
.md-header-nav__button.md-logo img, .md-header-nav__button.md-logo svg {
1+
/* fix logo size, align Trivadis with PL/SQL Guidelines */
2+
.md-header__button.md-logo :-webkit-any(img,svg) {
33
width: auto;
44
height: 46px;
55
padding-top: 10px;

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ theme:
1010
icon:
1111
repo: fontawesome/brands/github-alt
1212
name: 'material'
13-
custom_dir: custom-theme
1413
favicon: images/favicon.ico
1514
palette:
1615
primary: 'white'

tools/run-in-container/genpdf.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ function fix_footnote_links() {
4343
sed -e 's/a class="footnote-ref"/a /g' index.ori.html > index.html
4444
}
4545

46+
function fix_unsupported_css() {
47+
mv index.html temp.html
48+
sed -e 's|<style>:root.*</style>|<style>html,body,input{font-family:"Roboto"}code,kbd,pre{font-family:"Roboto Mono"}</style>|g' temp.html > index.html
49+
rm temp.html
50+
51+
OPTIONS='{"stage":false,"features":{"color-functional-notation":{"preserver":false}}}'
52+
cp assets/stylesheets/main.1d29e8d0.min.css assets/stylesheets/main.1d29e8d0.min.ori.css
53+
csstools-cli postcss-preset-env assets/stylesheets/main.1d29e8d0.min.css --replace --plugin-options ${OPTIONS}
54+
55+
cp assets/stylesheets/palette.cbb835fc.min.css assets/stylesheets/palette.cbb835fc.min.ori.css
56+
csstools-cli postcss-preset-env assets/stylesheets/palette.cbb835fc.min.css --replace --plugin-options ${OPTIONS}
57+
}
58+
4659
function write_text(){
4760
TEXT=$1
4861
echo "" >> ${TARGET_DIR}/docs/index.md
@@ -58,7 +71,9 @@ function write_guidelines(){
5871
sed -e "s|# |${HEADER} |g" $f | \
5972
sed -e 's/..\/image/image/g' | \
6073
sed -e 's|../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3310|#g-3310-never-commit-within-a-cursor-loop|g' | \
61-
sed -e 's|../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3320|#g-3320-try-to-move-transactions-within-a-non-cursor-loop-into-procedures|g' >> ${TARGET_DIR}/docs/index.md
74+
sed -e 's|../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3320|#g-3320-try-to-move-transactions-within-a-non-cursor-loop-into-procedures|g' | \
75+
sed -e 's|../../../../4-language-usage/7-stored-objects/7-triggers/g-7740|#g-7740-never-handle-multiple-dml-events-per-trigger-if-primary-key-is-assigned-in-trigger|g' \
76+
>> ${TARGET_DIR}/docs/index.md
6277
done
6378
}
6479

@@ -72,6 +87,7 @@ function convert_to_pdf(){
7287
mkdocs build
7388
cd site
7489
fix_footnote_links
90+
fix_unsupported_css
7591
wkhtmltopdf --enable-local-file-access \
7692
--allow "." \
7793
--disable-smart-shrinking \
@@ -93,6 +109,7 @@ function convert_to_pdf(){
93109
toc \
94110
--xsl-style-sheet stylesheets/toc.xsl \
95111
index.html ${DATA_DIR}/docs/9-appendix/PLSQL-and-SQL-Coding-Guidelines.pdf
112+
echo docs/9-appendix/PLSQL-and-SQL-Coding-Guidelines.pdf produced.
96113
}
97114

98115
DATA_DIR="$(cd "$(dirname "${0}")/../.." && pwd)"

0 commit comments

Comments
 (0)