Skip to content

Commit

Permalink
Merge pull request #4 from groovytron/upgrade-pandoc
Browse files Browse the repository at this point in the history
  • Loading branch information
groovytron authored Apr 5, 2020
2 parents ca79055 + a85af7a commit fcabd53
Show file tree
Hide file tree
Showing 18 changed files with 1,003 additions and 21 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
5 changes: 3 additions & 2 deletions .travis.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ services:

env:
matrix:
- PANDOC_VERSION=2.7.2
- PANDOC_VERSION=2.7.3
- PANDOC_VERSION=2.7
- PANDOC_VERSION=2.8
- PANDOC_VERSION=2.9

script:
- make "pandoc$PANDOC_VERSION"
Expand Down
2 changes: 1 addition & 1 deletion 2.7.2/Dockerfile → 2.7/Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ LABEL maintainer="Julien M'Poy <[email protected]>" \
org.opencontainers.image.title="Pandoc Container" \
org.opencontainers.image.url="https://github.com/groovytron/pandoc-container" \
org.opencontainers.image.vendor="Julien M'Poy <[email protected]>" \
org.opencontainers.image.version="2.7.2"
org.opencontainers.image.version="2.7"
101 changes: 101 additions & 0 deletions 2.8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# vim: set syntax=dockerfile:

FROM ubuntu:bionic

ARG PANDOC_VERSION
ARG PANDOC_CROSSREF_VERSION
ARG PANDOC_INCLUDE_CODE_VERSION

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get upgrade --quiet --yes \
&& apt-get update --quiet \
&& apt-get install --quiet --yes \
bash-completion \
curl \
fonts-inconsolata \
fonts-linuxlibertine \
fonts-croscore \
fonts-crosextra-carlito \
fonts-texgyre \
git \
inotify-tools \
lmodern \
locales \
librsvg2-bin \
make \
tex-gyre \
texlive-fonts-extra \
texlive-fonts-recommended \
texlive-lang-french \
texlive-latex-extra \
texlive-latex-recommended \
texlive-science \
texlive-xetex \
tzdata \
wget \
&& apt-get autoremove --quiet --yes \
&& apt-get clean \
&& wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-1-amd64.deb \
--output-document pandoc.deb \
--quiet \
&& dpkg -i pandoc.deb \
&& rm pandoc.deb \
&& wget https://github.com/lierdakil/pandoc-crossref/releases/download/v${PANDOC_CROSSREF_VERSION}/pandoc-crossref-Linux-2.8.1.tar.xz \
--output-document pandoc-crossref.tar.gz \
--quiet \
&& tar xf pandoc-crossref.tar.gz \
&& mv pandoc-crossref /usr/local/bin \
&& wget https://github.com/owickstrom/pandoc-include-code/releases/download/v${PANDOC_INCLUDE_CODE_VERSION}/pandoc-include-code-linux-ghc8-pandoc-1-19.tar.gz \
--output-document pandoc-include-code.tar.gz \
--quiet \
&& tar xf pandoc-include-code.tar.gz \
&& mv pandoc-include-code /usr/local/bin

# Set the locale
RUN locale-gen en_US
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

# Set timezone
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime

# Create less privileged user
RUN groupadd --gid 1000 dev \
&& useradd --uid 1000 --gid dev --shell /bin/bash --create-home dev

# Mount your app source code directory into that folder
WORKDIR /home/dev/doc

# Add bash completion
RUN echo 'source /etc/profile.d/bash_completion.sh' >> ~/.bashrc
RUN echo 'source /etc/profile.d/bash_completion.sh' >> /home/dev/.bashrc

# Fix permissions issues
RUN chmod -R a+wrx /home/dev
RUN chmod -R a+rx /usr/local/bin/pandoc-crossref
RUN chmod -R a+rx /usr/local/bin/pandoc-include-code

# Label schema related variables and metadata
ARG BUILD_DATE
ARG VCS_REF

LABEL maintainer="Julien M'Poy <[email protected]>" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.vcs-url="https://github.com/groovytron/pandoc-container" \
org.label-schema.schema-version="1.0" \
org.opencontainers.image.authors="Julien M'Poy <[email protected]>" \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.description="Container embedding pandoc and some pandoc filters to build documentation" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.revision=${VCS_REF} \
org.opencontainers.image.source="https://github.com/groovytron/pandoc-container" \
org.opencontainers.image.title="Pandoc Container" \
org.opencontainers.image.url="https://github.com/groovytron/pandoc-container" \
org.opencontainers.image.vendor="Julien M'Poy <[email protected]>" \
org.opencontainers.image.version="2.8"
4 changes: 2 additions & 2 deletions 2.7.3/Dockerfile → 2.9/Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN apt-get update \
--quiet \
&& dpkg -i pandoc.deb \
&& rm pandoc.deb \
&& wget https://github.com/lierdakil/pandoc-crossref/releases/download/v${PANDOC_CROSSREF_VERSION}/linux-pandoc_2_7.tar.gz \
&& wget https://github.com/lierdakil/pandoc-crossref/releases/download/v${PANDOC_CROSSREF_VERSION}/linux-pandoc_2_9_2.tar.gz \
--output-document pandoc-crossref.tar.gz \
--quiet \
&& tar xf pandoc-crossref.tar.gz \
Expand Down Expand Up @@ -98,4 +98,4 @@ LABEL maintainer="Julien M'Poy <[email protected]>" \
org.opencontainers.image.title="Pandoc Container" \
org.opencontainers.image.url="https://github.com/groovytron/pandoc-container" \
org.opencontainers.image.vendor="Julien M'Poy <[email protected]>" \
org.opencontainers.image.version="2.7.3"
org.opencontainers.image.version="2.9"
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changelog

# 1.0.0

- feature: add pandoc's versions `2.8` and `2.9` with updated versions of pandoc filters
- remove: `2.7.2` image is not maintained anymore (use `groovytron/pandoc:2.7` instead to have the most recent 2.7 version)

# 0.1.0

- feature: add pandoc `2.7.3` image

# 0.0.1

- feature: add pandoc `2.7.2` image
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Julien M'Poy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 20 additions & 4 deletions Makefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
BUILD_NAME=pandoc
OWNER=groovytron
COMPOSE_BUILD_NAME=pandoc-container
VERSIONS=2.7.3 2.7.2
VERSIONS=2.9 2.8 2.7
LATEST=3.8
LATEST_LABEL=latest
ALL=$(addprefix pandoc,$(VERSIONS))
VCS_REF="$(shell git rev-parse HEAD)"
BUILD_DATE="$(shell date -u +"%Y-%m-%dT%H:%m:%SZ")"
CURRENT_DATE="$(shell date +"%Y%m%d")"

.PHONY: all
all: $(ALL)
Expand All @@ -17,9 +21,21 @@ $(ALL):
docker-compose -f build.yaml build \
$@

# .PHONY:test
# test:
# ./test.sh
.PHONY:tag
tag:
for VERSION in $(VERSIONS); do \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(OWNER)/$(BUILD_NAME):$$VERSION && \
docker tag $(COMPOSE_BUILD_NAME):$$VERSION $(OWNER)/$(BUILD_NAME):$$VERSION-$(CURRENT_DATE); \
done && \
docker tag $(COMPOSE_BUILD_NAME):$(LATEST) $(OWNER)/$(BUILD_NAME):$(LATEST_LABEL)

.PHONY:publish
publish: tag
for VERSION in $(VERSIONS); do \
docker push $(OWNER)/$(BUILD_NAME):$$VERSION && \
docker push $(OWNER)/$(BUILD_NAME):$$VERSION-$(CURRENT_DATE); \
done && \
docker push $(OWNER)/$(BUILD_NAME):$(LATEST_LABEL)

.PHONY:clean
clean:
Expand Down
5 changes: 3 additions & 2 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Container embedding pandoc and some pandoc filter to convert files from a format

## Supported tags and respective `Dockerfile` links

- `2.7.3`, `latest` ([2.7.3/Dockerfile](https://github.com/groovytron/pandoc-container/blob/master/2.7.3/Dockerfile))
- `2.7.2` ([2.7.2/Dockerfile](https://github.com/groovytron/pandoc-container/blob/master/2.7.2/Dockerfile))
- `2.9`, `latest` ([2.9/Dockerfile](https://github.com/groovytron/pandoc-container/blob/master/2.9/Dockerfile))
- `2.8` ([2.8/Dockerfile](https://github.com/groovytron/pandoc-container/blob/master/2.8/Dockerfile))
- `2.7` ([2.7/Dockerfile](https://github.com/groovytron/pandoc-container/blob/master/2.7/Dockerfile))

## Softwares embedded in the container

Expand Down
28 changes: 20 additions & 8 deletions build.yaml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,35 @@
version: '3'

services:
pandoc2.7.3:
image: ${COMPOSE_BUILD_NAME}:2.7.3
pandoc2.7:
image: ${COMPOSE_BUILD_NAME}:2.7
build:
dockerfile: 2.7.3/Dockerfile
dockerfile: 2.7/Dockerfile
context: .
args:
- PANDOC_VERSION=2.7.3
- PANDOC_CROSSREF_VERSION=0.3.4.0d
- PANDOC_INCLUDE_CODE_VERSION=1.2.0.2
- VCS_REF=$VCS_REF
pandoc2.7.2:
image: ${COMPOSE_BUILD_NAME}:2.7.2

pandoc2.8:
image: ${COMPOSE_BUILD_NAME}:2.8
build:
dockerfile: 2.7.2/Dockerfile
dockerfile: 2.8/Dockerfile
context: .
args:
- PANDOC_VERSION=2.7.2
- PANDOC_CROSSREF_VERSION=0.3.4.0d
- PANDOC_VERSION=2.8.1
- PANDOC_CROSSREF_VERSION=0.4.0.0-alpha6b
- PANDOC_INCLUDE_CODE_VERSION=1.2.0.2
- VCS_REF=$VCS_REF

pandoc2.9:
image: ${COMPOSE_BUILD_NAME}:2.9
build:
dockerfile: 2.9/Dockerfile
context: .
args:
- PANDOC_VERSION=2.9.2.1
- PANDOC_CROSSREF_VERSION=0.3.6.2
- PANDOC_INCLUDE_CODE_VERSION=1.2.0.2
- VCS_REF=$VCS_REF
3 changes: 1 addition & 2 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash

git clone https://github.com/HE-Arc/rapport-technique.git || return 1
cd rapport-technique || return 1
cd test || return 1
make || return 1
46 changes: 46 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.phony: all
all: rapport.pdf rapport-gyre.pdf rapport-cros.pdf

%.pdf: %.md
pandoc $^ \
--standalone \
--from markdown+smart \
--to latex \
--pdf-engine xelatex \
--lua-filter english.lua \
--filter pandoc-crossref \
--filter pandoc-citeproc \
--variable documentclass=scrreprt \
--variable mainfont="Linux Libertine O" \
--variable sansfont="Linux Biolinum O" \
--variable monofont="Inconsolata" \
--output $@

%-gyre.pdf: %.md
pandoc $^ \
--standalone \
--from markdown+smart \
--to latex \
--pdf-engine xelatex \
--lua-filter english.lua \
--filter pandoc-crossref \
--filter pandoc-citeproc \
--variable documentclass=report \
--variable mainfont="TeX Gyre Pagella" \
--variable monofont="TeX Gyre Cursor" \
--output $@

%-cros.pdf: %.md
pandoc $^ \
--standalone \
--from markdown+smart \
--to latex \
--pdf-engine xelatex \
--lua-filter english.lua \
--filter pandoc-crossref \
--filter pandoc-citeproc \
--variable documentclass=scrreprt \
--variable mainfont="Carlito" \
--variable sansfont="Tinos" \
--variable monofont="Cousine" \
--output $@
5 changes: 5 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Test project

This folder contains the project used to test images. The code comes from [HE-Arc report template project](https://github.com/HE-Arc/rapport-technique).

Some code has been modified because some versions of pandoc do not support some instructions.
23 changes: 23 additions & 0 deletions test/bibliographie.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@article{arc2017,
title={Communication I : le rapport technique},
author={Perret, Michael and Raboud, Stéphane and Babey, Magali},
year={2017}
}

@article{timbal1982communication,
title={Communication. Comment exposer efficacement des id{\'e}es complexes: la m{\'e}thode {\guillemotleft}SPRI{\guillemotright}},
author={Timbal-Duclaux, L},
journal={Revue G{\'e}n{\'e}rale Nucl{\'e}aire},
number={5},
pages={459--462},
year={1982},
publisher={Revue G{\'e}n{\'e}rale de l{\'E}lectricit{\'e} SA}
}

@misc{webster2017chicago,
title={The Chicago Manual of Style},
author={Webster, Gretchen},
year={2017},
publisher={Springer}
}

13 changes: 13 additions & 0 deletions test/english.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local lang = 'en'

return {
{
Code = function(el)
return pandoc.Span(el, pandoc.Attr("", {}, {lang = lang}))
end,

CodeBlock = function(el)
return pandoc.Div(el, pandoc.Attr("", {}, {lang = lang}))
end,
}
}
Loading

0 comments on commit fcabd53

Please sign in to comment.