Skip to content

Feature/issue 127 update mktools #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 0 additions & 41 deletions custom-theme/partials/header.html

This file was deleted.

39 changes: 28 additions & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
FROM oraclelinux:8
FROM oraclelinux:8.6
ARG TARGETPLATFORM

LABEL maintainer="[email protected]"
LABEL description="Tools to generate HTML and PDF using Materials for MkDocs and wkhtmltopdf."
LABEL build.command="docker build . --tag trivadis/mktools:latest"

# To build a mulit-architecture image and push it to the docker registry (load is not supported)
LABEL build.prepare.command="docker buildx create --use --name mktools"
LABEL build.multiarch.command="docker buildx build --platform linux/amd64,linux/arm64 . --tag trivadis/mktools:latest --push"

# To build a single-architecture image and load it into local docker images list (not possible for multi-architecture images)
LABEL build.amd64.command="docker buildx build --platform linux/amd64 . --tag trivadis/mktools:latest --load"
LABEL build.arm64.command="docker buildx build --platform linux/ard64 . --tag trivadis/mktools:latest --load"

# install python
RUN dnf -y update
RUN dnf -y install python38 python38-pip
RUN dnf -y install python39 python39-pip

# install git
RUN dnf -y install git
Expand All @@ -15,14 +23,23 @@ RUN dnf -y install git
# using "--root" should suppress "WARNING: Running pip install with root privileges is generally not a good idea." in future releases
RUN python3 -m pip install --upgrade pip --root /
RUN python3 -m pip install --root / \
'mkdocs==1.1.2' \
'mkdocs-material==6.2.8' \
'mkdocs-awesome-pages-plugin==2.5.0' \
'pymdown-extensions==8.1.1' \
'mike==0.5.5'

# install wkhtmltox 0.12.6
RUN dnf -y install https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos8.x86_64.rpm
'mkdocs==1.3.1' \
'mkdocs-material==8.3.9' \
'mkdocs-awesome-pages-plugin==2.8.0' \
'pymdown-extensions==9.5' \
'mike==1.1.2' \
'setuptools==63.4.2'

# install wkhtmltox 0.12.6.1 r2
RUN if [ "$TARGETPLATFORM" == "linux/amd64" ] ; \
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 ; \
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 ; \
fi

# install Node.js, PostCSS Preset Env and csstools-cli (used to simplify CSS so that it is understood by wkhtmltopdf)
RUN dnf -y module install nodejs:16
RUN npm install postcss-preset-env -g
RUN npm install @csstools/csstools-cli -g

# set environment
ENV LANG=en_US.utf8
Expand Down
Binary file modified docs/images/steven-feuerstein-signature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/urban-lankes-signature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* fix logo size */
.md-header-nav__button.md-logo img, .md-header-nav__button.md-logo svg {
/* fix logo size, align Trivadis with PL/SQL Guidelines */
.md-header__button.md-logo :-webkit-any(img,svg) {
width: auto;
height: 46px;
padding-top: 10px;
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ theme:
icon:
repo: fontawesome/brands/github-alt
name: 'material'
custom_dir: custom-theme
favicon: images/favicon.ico
palette:
primary: 'white'
Expand Down
19 changes: 18 additions & 1 deletion tools/run-in-container/genpdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ function fix_footnote_links() {
sed -e 's/a class="footnote-ref"/a /g' index.ori.html > index.html
}

function fix_unsupported_css() {
mv index.html temp.html
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
rm temp.html

OPTIONS='{"stage":false,"features":{"color-functional-notation":{"preserver":false}}}'
cp assets/stylesheets/main.1d29e8d0.min.css assets/stylesheets/main.1d29e8d0.min.ori.css
csstools-cli postcss-preset-env assets/stylesheets/main.1d29e8d0.min.css --replace --plugin-options ${OPTIONS}

cp assets/stylesheets/palette.cbb835fc.min.css assets/stylesheets/palette.cbb835fc.min.ori.css
csstools-cli postcss-preset-env assets/stylesheets/palette.cbb835fc.min.css --replace --plugin-options ${OPTIONS}
}

function write_text(){
TEXT=$1
echo "" >> ${TARGET_DIR}/docs/index.md
Expand All @@ -58,7 +71,9 @@ function write_guidelines(){
sed -e "s|# |${HEADER} |g" $f | \
sed -e 's/..\/image/image/g' | \
sed -e 's|../../../../4-language-usage/3-dml-and-sql/3-transaction-control/g-3310|#g-3310-never-commit-within-a-cursor-loop|g' | \
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
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' | \
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' \
>> ${TARGET_DIR}/docs/index.md
done
}

Expand All @@ -72,6 +87,7 @@ function convert_to_pdf(){
mkdocs build
cd site
fix_footnote_links
fix_unsupported_css
wkhtmltopdf --enable-local-file-access \
--allow "." \
--disable-smart-shrinking \
Expand All @@ -93,6 +109,7 @@ function convert_to_pdf(){
toc \
--xsl-style-sheet stylesheets/toc.xsl \
index.html ${DATA_DIR}/docs/9-appendix/PLSQL-and-SQL-Coding-Guidelines.pdf
echo docs/9-appendix/PLSQL-and-SQL-Coding-Guidelines.pdf produced.
}

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