Skip to content
Snippets Groups Projects
Commit 13206e51 authored by Marcel Huber's avatar Marcel Huber
Browse files

Merge branch 'RemoveDuplicateBuildEntries' into 'master'

Remove duplicate build entries

See merge request ifs/GitlabMarkdownToPDF!7
parents cc0fdff5 9edd4d5d
No related branches found
No related tags found
No related merge requests found
Pipeline #94310 failed
...@@ -39,7 +39,7 @@ TagPandocImage: ...@@ -39,7 +39,7 @@ TagPandocImage:
- docker - docker
script: script:
# build exercices output # build exercices output
- git config core.hooksPath hooks/ - git config core.hooksPath /gitinfo-hooks/
# checkout again to execute custom git-hooks # checkout again to execute custom git-hooks
- git checkout $CI_COMMIT_SHA - git checkout $CI_COMMIT_SHA
# build with eisvogel template # build with eisvogel template
...@@ -47,46 +47,23 @@ TagPandocImage: ...@@ -47,46 +47,23 @@ TagPandocImage:
( cd $CI_JOB_NAME && ( cd $CI_JOB_NAME &&
pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji
-t latex --latex-engine=xelatex -t latex --latex-engine=xelatex
--template=$CI_PROJECT_DIR/templates/eisvogel --template=eisvogel
--filter=/filters/gfm_cleanup.py --filter=/filters/gitlab_links.py --filter=gfm_cleanup.py --filter=gitlab_links.py
--filter=/filters/plantuml.py --filter=/filters/svg_convert.py --filter=plantuml.py --filter=svg_convert.py
-Vinstitute=""
-Vdate=$(date "+%Y-%m-%d") -Vdate=$(date "+%Y-%m-%d")
-o ${CI_JOB_NAME}.pdf README.pandoc_prelude README.md -o ${CI_JOB_NAME}.pdf README.md pandoc_meta.yaml
) ||
( cd $CI_JOB_NAME &&
pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji
-t latex --latex-engine=xelatex
--template=$CI_PROJECT_DIR/templates/eisvogel
--filter=/filters/gfm_cleanup.py --filter=/filters/gitlab_links.py
--filter=/filters/plantuml.py --filter=/filters/svg_convert.py
-Vinstitute=""
-Vdate=$(date "+%Y-%m-%d")
-o ${CI_JOB_NAME}.pdf README.pandoc_prelude README.md
) )
# build exercices solutions output # build exercices solutions output
- > - >
( cd $CI_JOB_NAME && ( cd $CI_JOB_NAME &&
pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji
-t latex --latex-engine=xelatex -t latex --latex-engine=xelatex
--template=$CI_PROJECT_DIR/templates/eisvogel --template=eisvogel
--filter=/filters/inline_solutions.py --filter=inline_solutions.py
--filter=/filters/gfm_cleanup.py --filter=/filters/gitlab_links.py --filter=gfm_cleanup.py --filter=gitlab_links.py
--filter=/filters/plantuml.py --filter=/filters/svg_convert.py --filter=plantuml.py --filter=svg_convert.py
-Vinstitute=""
-Vdate=$(date "+%Y-%m-%d")
-o ${CI_JOB_NAME}-Solutions.pdf README.pandoc_prelude README.md
) ||
( cd $CI_JOB_NAME &&
pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji
-t latex --latex-engine=xelatex
--template=$CI_PROJECT_DIR/templates/eisvogel
--filter=/filters/inline_solutions.py
--filter=/filters/gfm_cleanup.py --filter=/filters/gitlab_links.py
--filter=/filters/plantuml.py --filter=/filters/svg_convert.py
-Vinstitute=""
-Vdate=$(date "+%Y-%m-%d") -Vdate=$(date "+%Y-%m-%d")
-o ${CI_JOB_NAME}-Solutions.pdf README.pandoc_prelude README.md -o ${CI_JOB_NAME}-Solutions.pdf README.md pandoc_meta.yaml
) )
artifacts: artifacts:
expire_in: 3 mos expire_in: 3 mos
...@@ -107,21 +84,21 @@ Create-Solutions-And-Cleanup-Markdown: ...@@ -107,21 +84,21 @@ Create-Solutions-And-Cleanup-Markdown:
( for n in $(find . -mindepth 2 -name README.md -print); do ( for n in $(find . -mindepth 2 -name README.md -print); do
echo $n; echo $n;
( cd $(dirname $n) && ( cd $(dirname $n) &&
cat README.pandoc_prelude README.md 2>/dev/null | sed -e 's|[„“”]|"|g' -e "s|[’]|'|g" -e "s|[–]|-|g" | cat pandoc_meta.yaml README.md 2>/dev/null | sed -e 's|[„“”]|"|g' -e "s|[’]|'|g" -e "s|[–]|-|g" |
pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji
-t markdown+pipe_tables-grid_tables-simple_tables-multiline_tables-header_attributes-fenced_code_attributes-fenced_code_blocks+backtick_code_blocks+emoji -t markdown+pipe_tables-grid_tables-simple_tables-multiline_tables-header_attributes-fenced_code_attributes-fenced_code_blocks+backtick_code_blocks+emoji
--atx-headers --wrap=auto --columns=80 --normalize --smart --atx-headers --columns=80 --normalize
-o README.md; ) -o README.md; )
done ) done )
- > - >
( for n in $(find . -mindepth 2 -name README.md -exec grep -q SOLUTION {} \; -print); do ( for n in $(find . -mindepth 2 -name README.md -exec grep -q SOLUTION {} \; -print); do
echo ${n/.md/.solutions.md}; echo ${n/.md/.solutions.md};
( cd $(dirname $n) && ( cd $(dirname $n) &&
cat README.pandoc_prelude README.md 2>/dev/null | sed -e 's|[„“”]|"|g' -e "s|[’]|'|g" -e "s|[–]|-|g" | cat pandoc_meta.yaml README.md 2>/dev/null | sed -e 's|[„“”]|"|g' -e "s|[’]|'|g" -e "s|[–]|-|g" |
pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji pandoc -f markdown+fancy_lists+startnum+fenced_code_attributes+link_attributes+emoji
-t markdown+pipe_tables-grid_tables-simple_tables-multiline_tables-header_attributes-fenced_code_attributes-fenced_code_blocks+backtick_code_blocks+emoji -t markdown+pipe_tables-grid_tables-simple_tables-multiline_tables-header_attributes-fenced_code_attributes-fenced_code_blocks+backtick_code_blocks+emoji
--atx-headers --wrap=auto --columns=80 --normalize --smart --atx-headers --columns=80 --normalize
--filter=/filters/inline_solutions.py --filter=inline_solutions.py
-o README.solutions.md; ) -o README.solutions.md; )
done ) done )
artifacts: artifacts:
......
# Gitlab-Pandoc Markdown Cheat Sheet # Gitlab-Pandoc Markdown Cheat Sheet
This file as [PDF See this document as a collection of best practices on how to write markdown
output](/../builds/artifacts/master/file/CheatSheet/CheatSheet.pdf?job=CheatSheet) files being nicely rendered on gitlab and producing good looking pdf docs
generated using pandoc.
The full list of supported *gitlab flavoured markdown* can be found This requires that our markdown has primarily to be gitlab compatible with the
[here](https://docs.gitlab.com/ce/user/markdown.html) possibility to adjust/style for other media. To achieve this we have to make use
of [filters](#filters) to tailor the [*gitlab flavoured
markdown*](https://docs.gitlab.com/ce/user/markdown.html) file for use with
pandoc.
View this file as [PDF output on
gitlab](/../builds/artifacts/master/file/CheatSheet/CheatSheet.pdf?job=CheatSheet)
## Filters ## Filters
Content filtering using python scripts. [`pandoc`](https://pandoc.org) allows using either `haskell` or `python`
programs which act as filters on the processed content. Filters can be used to
modify the structure or contents of the document before going through the output
processor.
To use `python` filters, the python package
[`pandocfilters`](https://github.com/jgm/pandocfilters) must be installed for
your python version. Check the examples section of the repository to get an
overview and examples what can be done.
### Special link treatment (`gitlab_links.py`)
Using the [`gitlab_links.py`](m1huber/pandocfilters/gitlab_links.py) filter,
`/../` prefixes in internal references will be replaced with the correct project
url. In Addition, relative links, `./` and `../` will also be prepended with the
location (`CI_PROJECT_URL`) to the gitlab repository.
#### `?adaptformat[=extension]` or `?af[=extension]`
In order to preserve relative links in `HTML` or `PDF` output, add `adaptformat`
or `af` (short form) as query attribute to the link reference. This will keep
relative links to markdown (`.md`) files but change the extension to either
`.html` for `HTML[5]` output or `.pdf` for `latex` output.
Example link format:
[Link name](../path/to/file.md?af)
results in (html pseudocode):
href='../path/to/file.html'
### Hidden content, aka solution filtering (`inline_solutions.py`)
To conditionally hide content from being shown on gitlab and in an output file,
wrap it inside an html comment block like shown here:
<!-- SOLUTION
- Solutions Entry
This content is visible in generated file using inline_solutions.py filter.
SOLUTION -->
To enable its content, the
[`inline_solutions.py`](m1huber/pandocfilters/inline_solutions.py) filter is
used. See the full PDF output
[here](/../builds/artifacts/master/file/CheatSheet/CheatSheet-Solutions.pdf?job=CheatSheet)
<!-- SOLUTION
- Solutions Entry
This content was enabled using filter [`inline_solutions.py`](m1huber/pandocfilters/inline_solutions.py).
SOLUTION -->
### git commit marking (`gitinfo2`)
This \LaTeX package can be used to mark documents with a git version. It is
included in the debian package `texlive-latex-extra` or can be retrieved at its
[github origin](https://github.com/Hightor/gitinfo2) location.
tbd. [eisvogel template](https://github.com/Wandmalfarbe/pandoc-latex-template) contains extension
***Version matching***
The hook used to create a latex style git description assumes that your tags
follow this convention: `[0-9]*.*`. If your tags are prefixed or look different,
you need to adapt the variable [`RELTAG`](hooks/post-checkout#L12) in
[`hooks/post-checkout`](hooks/post-checkout). According to [git describe
docs](https://git-scm.com/docs/git-describe#git-describe---matchltpatterngt), it
is a glob string so take care.
## References / Links ## References / Links
| **Reference Type** | **Markdown** | **Rendered** | | **Reference Type** | **Markdown** | **Rendered** |
|:---|:---|:---| |:------------------------|:----------------------------------|:------------------|
| External Reference I | `[pgAdmin](https://www.pgadmin.org/)` | [pgAdmin](https://www.pgadmin.org/) | | External Reference I | `[pgAdmin](https://www.pgadmin.org/)` | [pgAdmin](https://www.pgadmin.org/) |
| External Reference II | `<https://www.pgadmin.org/>` | <https://www.pgadmin.org/> | | External Reference II | `<https://www.pgadmin.org/>` | <https://www.pgadmin.org/> |
| Reference to repository file or directory | `[pandoc prelude](CheatSheet/README.pandoc_prelude)` | [pandoc prelude](CheatSheet/README.pandoc_prelude) | | Reference to repository file or directory | `[pandoc prelude](CheatSheet/pandoc_meta.yaml)` | [pandoc prelude](CheatSheet/pandoc_meta.yaml) |
| Reference to repository md file | `[README.md](CheatSheet/README.md)` | [README.md](CheatSheet/README.md) | | Reference to repository md file | `[README](CheatSheet/README.md)` | [README](CheatSheet/README.md) |
| Reference to repository md file as pdf | `[README.md](./README.md?adaptformat)` | [README.md](./README.md?adaptformat) | | Reference to repository md file as pdf/html | `[README](./README.md?adaptformat)` | [README](./README.md?adaptformat) |
| Reference to file/dir on different branch | `[Solutions Readme](/../tree/Demo-Solutions/CheatSheet/README.solutions.md)` | [Solutions Readme](/../tree/Demo-Solutions/CheatSheet/README.solutions.md) | | Reference to file/dir on different branch | `[Solutions Readme](/../tree/Demo-Solutions/` `CheatSheet/README.solutions.md)` | [Solutions Readme](/../tree/Demo-Solutions/CheatSheet/README.solutions.md) |
| Reference to artifacts file | `[PDF output](/../builds/artifacts/master/file/CheatSheet/CheatSheet.pdf?job=CheatSheet)` | [PDF output](/../builds/artifacts/master/file/CheatSheet/CheatSheet.pdf?job=CheatSheet) | | Reference to artifacts file | `[PDF output](/../builds/artifacts` `/master/file/CheatSheet/` `CheatSheet.pdf?job=CheatSheet)` | [PDF output](/../builds/artifacts/master/file/CheatSheet/CheatSheet.pdf?job=CheatSheet) |
| Internal reference to heading (anchor) | `[Filters](#filters)` | [Filters](#filters) | | Internal reference to heading (anchor) | `[Filters](#filters)` | [Filters](#filters) |
| | | |
| | | |
Using the [`gfm_cleanup.py`](m1huber/pandocfilters/gfm_cleanup.py) filter, `/../` prefixes in internal references will be replaced with the correct project url.
## Source Code formatting / Code Blocks ## Source Code formatting / Code Blocks
...@@ -51,7 +123,18 @@ Please stick to the following convention to specify code blocks. ...@@ -51,7 +123,18 @@ Please stick to the following convention to specify code blocks.
## Tables ## Tables
It is best to stick with pipe-tables. It is best to stick with pipe-tables to have nice output on gitlab and in pdf
output. [Formatting the
table](https://pandoc.org/MANUAL.html#extension-pipe_tables) is a bit tricky as
the width and proportions of the *separator lines* are relevant. According to
the docs, `--columns` should be 72 but it seems to be 80 for the current
document. Therefore you should spend at most 80 characters for column
formatting. As an example you can look at the formatting of the [references
links table](#references-links) in the [source](CheatSheet/README.md#L16) of
this document. If table contents are narrower than the reserved space, the table
will shrink appropriately.
A table formatted like the following
| **titel** | **bitmap**| | **titel** | **bitmap**|
|:-----------|-----------:| |:-----------|-----------:|
...@@ -59,7 +142,7 @@ It is best to stick with pipe-tables. ...@@ -59,7 +142,7 @@ It is best to stick with pipe-tables.
| Dr. | 0110000010| | Dr. | 0110000010|
| Dr. habil. | 0001000000| | Dr. habil. | 0001000000|
results in results in:
| **titel** | **bitmap**| | **titel** | **bitmap**|
|:-----------|-----------:| |:-----------|-----------:|
...@@ -69,10 +152,46 @@ results in ...@@ -69,10 +152,46 @@ results in
## Images / Figures ## Images / Figures
tbd. It is possible to insert images and figures either *inline* or *floating*.
### inline
An inline image should render inline
![Link name](HSR_Logo_trans_56mm_300dpi.png){width="30%"}\
with your text depending on the output format and the layout engine.
To include an *inline* image, use the following syntax:
![Link name](HSR_Logo_trans_56mm_300dpi.png){width="30%"}\
Note the trailing backslash which is **important**.
## floating but referrable
A *floating* image will be placed somewhere around your text but its position
can not be influenced. Instead you can [reference](#idifs) your image to let
your document viewer possibliy jump to it. It can contain a caption (figure
text) and some other options.
![Figure
description](IFS_Institute_for_Software_trans_56mm_300dpi.png "some text"){#idifs
.class width="30%"}
To include a *floating* image, use the following syntax:
![Figure description](IFS_Institute_..._56mm_300dpi.png "some text"){#idifs .class width="30%"}
## Plantuml / Graphviz ## Plantuml / Graphviz
[Plantuml](http://plantuml.com/) can be used to dynamically render images base
on text input. Many different
[languages](http://plantuml.com/sitemap-language-specification) are supported
including [`graphviz`/`dot`](http://plantuml.com/dot) capabilities.
### Sequence diagram
``` plantuml ``` plantuml
a->b a->b
``` ```
...@@ -91,49 +210,49 @@ $`a^2+b^2=c^2`$ ...@@ -91,49 +210,49 @@ $`a^2+b^2=c^2`$
$`N + M * \frac{N}{(B-2)} = 50 + 1000 * \frac{50}{50} = 1050`$ $`N + M * \frac{N}{(B-2)} = 50 + 1000 * \frac{50}{50} = 1050`$
## Hidden content, aka solution ## Styling Output
To conditionally hide content from being shown on gitlab and in an output file, To override the default templates, customized templates can be used. Default
wrap it inside an html comment block like shown here: search directory is [`$HOME/.pandoc`](https://pandoc.org/MANUAL.html) but can be
overriden specifying `--data-dir=/my/templates/path`.
`--template=myfancytemplate` specifies to use `myfancytemplate.latex` in case
\LaTeX output is requested.
<!-- SOLUTION ## Cross referencing `pandoc-crossref`
- Solutions Entry
This content is only visible in generated file having filter [`inline_solutions.py`](m1huber/pandocfilters/inline_solutions.py) specified. If you want to use cross referencing of sections, figures etc.,
SOLUTION --> [`pandoc-crossref`](https://github.com/lierdakil/pandoc-crossref) is the tool
you might need.
To enable its content, the [`inline_solutions.py`](m1huber/pandocfilters/inline_solutions.py) filter is used. See the full ### Section numbering
PDF output
[here](/../builds/artifacts/master/file/CheatSheet/CheatSheet-Solutions.pdf?job=CheatSheet)
<!-- SOLUTION tbd.
- Solutions Entry
This content is only visible in generated file having filter [`inline_solutions.py`](m1huber/pandocfilters/inline_solutions.py) specified. ### Figure / Image / Code references
SOLUTION -->
## Styling Output
To override the default templates, customized templates can be used. Default search directory is [`$HOME/.pandoc`](https://pandoc.org/MANUAL.html) tbd.
but can be overriden specifying `--data-dir=/my/templates/path`. `--template=myfancytemplate` specifies to use `myfancytemplate.latex` in case \LaTeX output is requested.
## Emoji and Special/Unicode characters ## Emoji and Special/Unicode characters
I recommend using latex Boxes for best result in bot gitlab and pdf output: Rendering special characters, like unicode and emoji, require a capable font. A
font which is partly capable of displaying Unicode characters is `DejaVuSerif`.
Set `mainfont=DejaVuSerif` to make use of it.
- $`\Box`$ latex `\Box` A more capable font is `FreeSerif` as it has more Unicode characters available
- $`\boxtimes`$ latex `\boxtimes` and also supports emojis. It seems to be a bit narrower than the default font
but its output looks quite nice.
Maybe in the future we can make use of something different like: When changing the font is not an option, I recommend using latex Boxes for best
results in both gitlab and pdf output:
- [ ] Hallo - $`\Box`$ latex `\Box`
- [X] Gugus - $`\boxtimes`$ latex `\boxtimes`
- [ ] Hallo - will be rendered as html checkbox on gitlab
- [X] Gugus - will be rendered as html checkbox on gitlab
- :white_medium_square: unchecked - :white_medium_square: unchecked
- :ballot_box_with_check: checked - :ballot_box_with_check: checked
- &#9744; unchecked unicode [Unicode Chars](http://unexpected-vortices.com/doc-notes/some-common-unicode-characters.html) - &#9744; unchecked unicode [Unicode Chars](http://unexpected-vortices.com/doc-notes/some-common-unicode-characters.html)
- &#9745; checkmarked unicode - &#9745; checkmarked unicode
- &#9746; checked unicode - &#9746; checked unicode
`:zap:` Emoji requires special \LaTeX configuration and font settings. This is Emoji's like `:zap:`, :zap:, are possible when using a capable font setting like `mainfont=FreeSerif`.
also not possible at the moment.
:zap:
...@@ -6,14 +6,15 @@ author: "Marcel Huber" ...@@ -6,14 +6,15 @@ author: "Marcel Huber"
institute: ["HSR Hochschule für Technik, Rapperswil"] institute: ["HSR Hochschule für Technik, Rapperswil"]
keywords: [pandoc, markdown] keywords: [pandoc, markdown]
date: 2017-09-15 date: 2017-09-15
lang: de lang: en
otherlangs: [en] #otherlangs: [de]
papersize: a4 papersize: a4
fontsize: 10pt
classoption: oneside, parskip classoption: oneside, parskip
geometry: margin=2.0cm,top=1.2cm,bottom=1.2cm # use margin=2.5cm for template.latex geometry: margin=2.0cm,top=1.2cm,bottom=1.2cm # use margin=2.5cm for template.latex
documentclass: scrartcl # scrreprt #scrartcl documentclass: scrartcl # scrreprt #scrartcl
mainfont: FreeSerif
colorlinks: true colorlinks: true
lof: false
links-as-notes: true links-as-notes: true
gitinfo: true gitinfo: true
gitinfo-options: gitinfo-options:
...@@ -22,4 +23,5 @@ gitinfo-options: ...@@ -22,4 +23,5 @@ gitinfo-options:
link-citations: true link-citations: true
header-includes: header-includes:
- \renewcommand{\gitMark}{\gitDescribe} - \renewcommand{\gitMark}{\gitDescribe}
- \renewcommand{\RHeadDefault}{\gitAuthorDate}
... ...
FROM ubuntu:devel FROM ubuntu:artful
MAINTAINER Marcel Huber <marcel.huber@hsr.ch> MAINTAINER Marcel Huber <marcel.huber@hsr.ch>
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
git curl ca-certificates make \ git curl ca-certificates make \
p7zip-full \ p7zip-full parallel \
locales language-pack-en nano \ locales language-pack-en nano \
&& apt-get clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
python-pip python-setuptools python-wheel \ python-pip python-setuptools python-wheel \
&& apt-get clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
pandoc pandoc-citeproc \ pandoc pandoc-citeproc \
&& apt-get clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
graphviz plantuml fonts-liberation \ graphviz plantuml \
lmodern ttf-dejavu \ fonts-liberation \
fonts-freefont-ttf \
fonts-lmodern \
fonts-dejavu \
fonts-roboto-hinted \
librsvg2-bin \ librsvg2-bin \
&& apt-get clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
texlive \ texlive \
texlive-luatex \ texlive-luatex \
texlive-xetex \ texlive-xetex \
latexmk \ latexmk \
&& apt-get clean \ lmodern \
&& apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN sh -e -c 'TDIR=$(mktemp -d); INSTDIR=/usr/share/texlive/texmf-dist/; \
( cd $TDIR; \
export DEBIAN_FRONTEND=noninteractive; \
apt update; \
apt install -y -q --no-install-recommends texlive-font-utils lcdf-typetools; \
for r in latex-sourcesanspro latex-sourcecodepro latex-sourceserifpro; do \
git clone --single-branch --branch master --depth 1 https://github.com/silkeh/$r; \
( cd $r; \
./rebuild.sh; \
tar cf - doc fonts tex | tar xf - -C $INSTDIR; \
); \
rm -rf $r; \
done; \
fc-cache; \
texhash; \
apt remove -y -q texlive-font-utils lcdf-typetools; apt -y -q autoremove; \
apt clean; \
rm -rf /var/lib/apt/lists/*; \
); \
rm -rf $TDIR'
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
texlive-science \ texlive-science \
texlive-generic-recommended \ texlive-generic-recommended \
texlive-fonts-extra \
texlive-bibtex-extra biber \ texlive-bibtex-extra biber \
&& apt-get clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN export DEBIAN_FRONTEND=noninteractive && \ RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y -q --no-install-recommends \ apt update && apt install -y -q --no-install-recommends \
wkhtmltopdf \ wkhtmltopdf xvfb \
&& apt-get clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ARG VCS_REF ARG VCS_REF
ARG GIT_LFS_VERSION=2.3.0 ARG GIT_LFS_VERSION=2.3.4
ARG PANDOCFILTERS_TAG=1.4.2 ARG PANDOCFILTERS_TAG=1.4.2
ARG IFSFILTERS_TAG=0.9
ARG PANDOC_CROSSREF_TAG=0.2.6.0
ENV _COMMIT_ID_=$VCS_REF \ ENV _COMMIT_ID_=$VCS_REF \
LANG=en_US.UTF-8 LANG=en_US.UTF-8 \
EXAMPLEFILTERSDIR=/pandocfilters \
IFSFILTERSDIR=/filters
RUN sh -c 'TDIR=$(mktemp -d); \ RUN sh -c 'TDIR=$(mktemp -d); \
( cd $TDIR && \ ( cd $TDIR && \
curl -sSL https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-amd64-${GIT_LFS_VERSION}.tar.gz | tar xzf - --strip-components=1 && \ curl -sSL https://github.com/git-lfs/git-lfs/releases/download/v${GIT_LFS_VERSION}/git-lfs-linux-amd64-${GIT_LFS_VERSION}.tar.gz | tar xzf - --strip-components=1 && \
./install.sh ); \ ./install.sh ); \
rm -rf $TDIR' rm -rf $TDIR'
RUN pip install pandocfilters==$PANDOCFILTERS_TAG RUN sh -c 'TDIR=$(mktemp -d); \
RUN cd / && git clone --single-branch --branch master --depth 1 https://gitlab.dev.ifs.hsr.ch/m1huber/pandocfilters.git filters && ls -lart /filters ( cd $TDIR && \
curl -sSL https://github.com/lierdakil/pandoc-crossref/releases/download/v${PANDOC_CROSSREF_TAG}/linux-ghc8-pandoc-1-19.tar.gz | tar xzf - -C /usr/local/bin; \
); \
rm -rf $TDIR'
RUN sh -c 'TDIR=$(mktemp -d); \
( cd $TDIR && \
git clone --branch $PANDOCFILTERS_TAG https://github.com/jgm/pandocfilters.git && \
cd pandocfilters && \
python setup.py install && \
mkdir -p $EXAMPLEFILTERSDIR && \
cp -p examples/*.py $EXAMPLEFILTERSDIR/ && \
chmod +x $EXAMPLEFILTERSDIR/*.py ); \
rm -rf $TDIR'
RUN sh -e -c 'TDIR=$(mktemp -d); \
( cd $TDIR; \
git clone --branch $IFSFILTERS_TAG https://gitlab.dev.ifs.hsr.ch/m1huber/pandocfilters.git; \
cd pandocfilters; \
mkdir -p $IFSFILTERSDIR; \
cp -p *.py $IFSFILTERSDIR/; \
rm -f $IFSFILTERSDIR/conftest.py; \
chmod +x $IFSFILTERSDIR/*.py; \
); \
rm -rf $TDIR'
ADD templates/* /templates/
ADD hooks/* /gitinfo-hooks/
RUN mkdir -p /root/.pandoc && ln -s /templates /root/.pandoc/templates
ENV PATH=$IFSFILTERSDIR:$EXAMPLEFILTERSDIR:$PATH
CMD ["/bin/bash"] CMD ["/bin/bash"]
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# Get the first tag found in the history from the current HEAD # Get the first tag found in the history from the current HEAD
FIRSTTAG=$(git describe --tags --always --dirty='-*' 2>/dev/null) FIRSTTAG=$(git describe --tags --always --dirty='-*' 2>/dev/null)
# Get the first tag in history that looks like a Release # Get the first tag in history that looks like a Release
RELTAG=$(git describe --tags --long --always --dirty='-*' --match '[0-9]*.*' 2>/dev/null) RELTAG=$(git describe --tags --long --always --dirty='-*' --match '[A-Za-z]*[0-9]*.*' 2>/dev/null)
# Hoover up the metadata # Hoover up the metadata
git --no-pager log -1 --date=short --decorate=short \ git --no-pager log -1 --date=short --decorate=short \
--pretty=format:"\usepackage[% --pretty=format:"\usepackage[%
......
...@@ -315,6 +315,13 @@ $endif$ ...@@ -315,6 +315,13 @@ $endif$
\def\fps@figure{htbp} \def\fps@figure{htbp}
\makeatother \makeatother
\newcommand{\LHeadDefault}{$title$}
\newcommand{\CHeadDefault}{$subject$}
\newcommand{\RHeadDefault}{$date$}
\newcommand{\LFootDefault}{$for(author)$$author$$sep$, $endfor$}
\newcommand{\CFootDefault}{}
\newcommand{\RFootDefault}{\thepage}
$for(header-includes)$ $for(header-includes)$
$header-includes$ $header-includes$
$endfor$ $endfor$
...@@ -602,12 +609,12 @@ $endif$ ...@@ -602,12 +609,12 @@ $endif$
\pagestyle{fancy} \pagestyle{fancy}
\fancyhead{} \fancyhead{}
\fancyfoot{} \fancyfoot{}
\lhead{$title$} \lhead{\LHeadDefault}
\chead{$subject$} \chead{\CHeadDefault}
\rhead{$if(gitinfo)$\gitAuthorDate$else$$date$$endif$} \rhead{\RHeadDefault}
\lfoot{$for(author)$$author$$sep$, $endfor$} \lfoot{\LFootDefault}
\cfoot{} \cfoot{\CFootDefault}
\rfoot{\thepage} \rfoot{\RFootDefault}
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
......
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
$if(colorlinks)$
\PassOptionsToPackage{dvipsnames,svgnames*,x11names*,table}{xcolor}
$endif$
%
\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(handout)$handout,$endif$$if(beamer)$ignorenonframetext,$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbols$if(navigation)$$navigation$$else$empty$endif$
$if(fontfamily)$
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc}
\usepackage[utf8]{inputenc}
$if(euro)$
\usepackage{eurosym}
$endif$
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
$for(fontfamilies)$
\newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$}
$endfor$
$if(euro)$
\newcommand{\euro}{€}
$endif$
$if(mainfont)$
\setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}
$endif$
$if(sansfont)$
\setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}
$endif$
$if(monofont)$
\setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}
$endif$
$if(mathfont)$
\setmathfont(Digits,Latin,Greek)[$for(mathfontoptions)$$mathfontoptions$$sep$,$endfor$]{$mathfont$}
$endif$
$if(CJKmainfont)$
\usepackage{xeCJK}
\setCJKmainfont[$for(CJKoptions)$$CJKoptions$$sep$,$endfor$]{$CJKmainfont$}
$endif$
\fi
$if(colorlinks)$
\usepackage{xcolor}
\definecolor{default-linkcolor}{HTML}{800000}
\definecolor{default-citecolor}{HTML}{4077C0}
\definecolor{default-urlcolor}{HTML}{4077C0}
$endif$
$if(theme)$
\usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
$endif$
$if(colortheme)$
\usecolortheme{$colortheme$}
$endif$
$if(fonttheme)$
\usefonttheme{$fonttheme$}
$endif$
$if(mainfont)$
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
$endif$
$if(innertheme)$
\useinnertheme{$innertheme$}
$endif$
$if(outertheme)$
\useoutertheme{$outertheme$}
$endif$
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
$if(lang)$
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel}
$if(babel-newcommands)$
$babel-newcommands$
$endif$
\else
\usepackage{polyglossia}
\setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}
$for(polyglossia-otherlangs)$
\setotherlanguage[$polyglossia-otherlangs.options$]{$polyglossia-otherlangs.name$}
$endfor$
\fi
$endif$
\newif\ifbibliography
$if(natbib)$
\usepackage{natbib}
\bibliographystyle{$if(biblio-style)$$biblio-style$$else$plainnat$endif$}
$endif$
$if(biblatex)$
\usepackage[$if(biblio-style)$style=$biblio-style$,$endif$$for(biblatexoptions)$$biblatexoptions$$sep$,$endfor$]{biblatex}
$for(bibliography)$
\addbibresource{$bibliography$}
$endfor$
$endif$
$if(verbatim-in-note)$
\usepackage{fancyvrb}
$endif$
\hypersetup{
$if(title-meta)$
pdftitle={$title-meta$},
$endif$
$if(author-meta)$
pdfauthor={$author-meta$},
$endif$
$if(keywords)$
pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},
$endif$
$if(colorlinks)$
colorlinks=true,
linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,
citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,
urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,
$else$
pdfborder={0 0 0},
$endif$
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
$if(verbatim-in-note)$
\VerbatimFootnotes % allows verbatim text in footnotes
$endif$
$if(listings)$
\usepackage{listings}
$endif$
$if(lhs)$
\lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}
$endif$
$if(highlighting-macros)$
$highlighting-macros$
$endif$
$if(tables)$
\usepackage{longtable,booktabs}
\usepackage{caption}
% These lines are needed to make table captions work with longtable:
\makeatletter
\def\fnum@table{\tablename~\thetable}
\makeatother
$endif$
$if(graphics)$
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight0.8\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
$endif$
% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom
$if(section-titles)$
\AtBeginPart{
\let\insertpartnumber\relax
\let\partname\relax
\frame{\partpage}
}
\AtBeginSection{
\ifbibliography
\else
\let\insertsectionnumber\relax
\let\sectionname\relax
\frame{\sectionpage}
\fi
}
\AtBeginSubsection{
\let\insertsubsectionnumber\relax
\let\subsectionname\relax
\frame{\subsectionpage}
}
$endif$
$if(links-as-notes)$
% Make links footnotes instead of hotlinks:
\renewcommand{\href}[2]{#2\footnote{\url{#1}}}
$endif$
$if(strikeout)$
\usepackage[normalem]{ulem}
% avoid problems with \sout in headers with hyperref:
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
$endif$
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
$if(numbersections)$
\setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$}
$else$
\setcounter{secnumdepth}{0}
$endif$
$if(dir)$
\ifxetex
% load bidi as late as possible as it modifies e.g. graphicx
$if(latex-dir-rtl)$
\usepackage[RTLdocument]{bidi}
$else$
\usepackage{bidi}
$endif$
\fi
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\TeXXeTstate=1
\newcommand{\RL}[1]{\beginR #1\endR}
\newcommand{\LR}[1]{\beginL #1\endL}
\newenvironment{RTL}{\beginR}{\endR}
\newenvironment{LTR}{\beginL}{\endL}
\fi
$endif$
$for(header-includes)$
$header-includes$
$endfor$
$if(title)$
\title{$title$}
$endif$
$if(subtitle)$
\subtitle{$subtitle$}
$endif$
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$}
$endif$
$if(institute)$
\institute{$for(institute)$$institute$$sep$ \and $endfor$}
$endif$
\date{$date$}
\begin{document}
$if(title)$
\frame{\titlepage}
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\begin{frame}
\tableofcontents[hideallsubsections]
\end{frame}
$endif$
$body$
$if(natbib)$
$if(bibliography)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\begin{frame}[allowframebreaks]{$biblio-title$}
\bibliographytrue
\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}
\end{frame}
$endif$
$endif$
$if(biblatex)$
\begin{frame}[allowframebreaks]{$biblio-title$}
\bibliographytrue
\printbibliography[heading=none]
\end{frame}
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}
...@@ -264,6 +264,13 @@ $endif$ ...@@ -264,6 +264,13 @@ $endif$
\def\fps@figure{htbp} \def\fps@figure{htbp}
\makeatother \makeatother
\newcommand{\LHeadDefault}{$title$}
\newcommand{\CHeadDefault}{$subject$}
\newcommand{\RHeadDefault}{$date$}
\newcommand{\LFootDefault}{$for(author)$$author$$sep$, $endfor$}
\newcommand{\CFootDefault}{}
\newcommand{\RFootDefault}{\thepage}
$for(header-includes)$ $for(header-includes)$
$header-includes$ $header-includes$
$endfor$ $endfor$
...@@ -291,12 +298,12 @@ $endif$ ...@@ -291,12 +298,12 @@ $endif$
\pagestyle{fancy} \pagestyle{fancy}
\fancyhead{} \fancyhead{}
\fancyfoot{} \fancyfoot{}
\lhead{$title$} \lhead{\LHeadDefault}
\chead{$subject$} \chead{\CHeadDefault}
\rhead{$if(gitinfo)$\gitAuthorDate$else$$date$$endif$} \rhead{\RHeadDefault}
\lfoot{$for(author)$$author$$sep$, $endfor$} \lfoot{\LFootDefault}
\cfoot{} \cfoot{\CFootDefault}
\rfoot{\thepage} \rfoot{\RFootDefault}
\renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt} \renewcommand{\footrulewidth}{0.4pt}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment