dalibo / pandocker

🐳 A simple docker image for pandoc with filters, templates, fonts, and the latex bazaar
https://hub.docker.com/r/dalibo/pandocker/
BSD 3-Clause "New" or "Revised" License
143 stars 23 forks source link

Addition of texlive-lang-dutch or dutch.ldf ? #141

Closed DigitalTravelDuck closed 4 years ago

DigitalTravelDuck commented 4 years ago

Is your feature request related to a problem? Please describe. While producing PDF I do get error message:

Error producing PDF. ! Package babel Error: Unknown option `dutch'. Either you misspelled it (babel) or the language definition file dutch.ldf was not found.

Describe the solution you'd like Would be nice to have dutch language included in set of languages besides German and French.

Describe alternatives you've considered By not using Pandocker but pandoc with all its plugins, but I do like to use Pandocker in a continues integration pipeline for software development.

Additional context log/error message as stated on top.

Thanks a lot, greetings, Arnold.

daamien commented 4 years ago

Hallo @DigitalTravelDuck !

Thanks for this request, I'm going to work on it. Do you have a sample text in Dutch that I could use for testing ?

daamien commented 4 years ago

Hi !

I created a tag named 141_dutch to test the dutch lang package.

Can you download it and test it ?

$ docker pull dalibo/pandocker:141_dutch
$ docker run --rm -v `pwd`:/pandoc dalibo/pandocker:141_dutch --template=yourtemplate.tex foo.md -o foo.pdf
DigitalTravelDuck commented 4 years ago

Will test. I got some other issue, with latestvversion of pandocker, when I run: docker run --rm -u id -u:id -g -v pwd:/pandoc dalibo/pandocker test.md -o testoutput.pdf

id - u give me 1000 id - g give me 1000

I got Error: pandoc: MCS-test.pdf: openBinaryFile: permission denied (Permission denied)

Any idea?

Thanks a lot, greetings, Arnold.

daamien commented 4 years ago

Hi @DigitalTravelDuck !

This is a separate issue, you can check the permission on the file MCS-test.pdf. One possiblity is that you already produce the MCS-test.pdf once without the -u option. In this case, the output file will belong your system root user. You can can solve this either by renaming the ouput file or changing the owner with chown....

Another solution is to avoid using the docker -u option.

DigitalTravelDuck commented 4 years ago

It does work with - - privileged argument in docker run. But not a safe way.

On Wed, 8 Jan 2020, 15:14 damien clochard, notifications@github.com wrote:

Hi @DigitalTravelDuck https://github.com/DigitalTravelDuck !

This is a separate issue, you can check the permission on the file MCS-test.pdf. One possiblity is that you already produce the MCS-test.pdf once without the -u option. In this case, the output file will belong your system root user. You can can solve this either by renaming the ouput file or changing the owner with chown....

Another solution is to avoid using the docker -u option.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dalibo/pandocker/issues/141?email_source=notifications&email_token=ANK6JHHGNJAYGWZWZ5UE3SDQ4XNV5A5CNFSM4KDV5MF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIMSK7A#issuecomment-572073340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANK6JHB7XGBVCRSYUIIQQ6DQ4XNV5ANCNFSM4KDV5MFQ .

daamien commented 4 years ago

yes using --privileged is generally a bad practice. Although in this case the pandocker image is "deaf", which means it does not listen to any port so the risk of an external attack is limited. There's always the risk of a backdoor installed through one of the dependencies but most of the packages we install come from trusted sources....

That being said if you want to handle the input and output files properly, the best solution is to declare a volume. For instance:

$ docker create --name my_docs dalibo/pandocker
$ docker cp foo.md docs:/pandoc/
$ docker cp my_template.tex docs:/pandoc/
$ docker run --rm --volumes-from docs dalibo/pandocker --template=my_template.tex foo.md -o foo.pdf
$ docker cp docs:/pandoc/foo.pdf .
$ docker rm --force --volumes docs

This should work without the --privileged option but it's a bit clumsy

There's another nice solution, if you don't need you use your own template. You can pass the document through the container with a pipe, like this

$ cat foo.md |  docker run --rm -i dalibo/pandocker --template=eisvogel -t pdf > foo.pdf

If security is a priority for you this is probably the cleanest solution...

DigitalTravelDuck commented 4 years ago

Hi !

I created a tag named 141_dutch to test the dutch lang package.

Can you download it and test it ?

$ docker pull dalibo/pandocker:141_dutch
$ docker run --rm -v `pwd`:/pandoc dalibo/pandocker:141_dutch --template=yourtemplate.tex foo.md -o foo.pdf

Works great ! Thanks a lot. greetings, Arnold.

daamien commented 4 years ago

Thanks for this idea !

daamien commented 4 years ago

The patch was merge into the latest branch. It will be part the next stable release that we will publish next month...

DigitalTravelDuck commented 4 years ago

I was looking for something like this :

find . -type f -name "*.md" -exec docker run \;

To convert multiple files in different folders into pdf.

Got some suggestions on this?

Greetings, Arnold.

On Wed, 8 Jan 2020, 23:24 damien clochard, notifications@github.com wrote:

yes using --privileged is generally a bad practice. Although in this case the pandocker image is "deaf", which means it does not listen to any port so the risk of an external attack is limited. There's always the risk of a backdoor installed through one of the dependencies but most of the packages we install come from trusted sources....

That being said if you want to handle the input and output files properly, the best solution is to declare a volume. For instance:

$ docker create --name my_docs dalibo/pandocker $ docker cp foo.md docs:/pandoc/ $ docker cp my_template.tex docs:/pandoc/ $ docker run --rm --volumes-from docs dalibo/pandocker --template=my_template.tex foo.md -o foo.pdf $ docker cp docs:/pandoc/foo.pdf . $ docker docker rm --force --volumes docs

This should without privileged option.

There's another nice solution, if you don't need you use your own template. You can pass the document through the container with a pipe, like this

$ cat foo.md | docker run --rm -i dalibo/pandocker --template=eisvogel -t pdf > foo.pdf

If security is a priority for you this is probably the cleanest solution...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dalibo/pandocker/issues/141?email_source=notifications&email_token=ANK6JHCXFCVQLI5CKELXKZTQ4ZHBVA5CNFSM4KDV5MF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIOGROQ#issuecomment-572287162, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANK6JHH7BUWHB27QTS26IXDQ4ZHBVANCNFSM4KDV5MFQ .

daamien commented 4 years ago

Personnally I like to use simple Makefile rules. Something like:


## path to pandoc
TAG?=latest
PANDOC?=docker run --rm  -v `pwd`:/pandoc dalibo/pandocker:$(TAG)
TEMPLATE?=eisvogel

## Source and artifacts
SOURCES  := $(shell find . -name '*.md')
OBJECTS_EPUB := $(patsubst %.md, %.epub, $(SOURCES) )
OBJECTS_PDF := $(patsubst %.md, %.pdf, $(SOURCE) )

## Targets

all:  pdf

.PHONY: epub
epub: $(OBJECTS_EPUB)

.PHONY: pdf
pdf: $(OBJECTS_PDF)

%.epub: %.md
    $(PANDOC) $^ -o $@

%.pdf: %.md
    $(PANDOC) --pdf-engine=xelatex --template $(TEMPLATE) $^ -o $@

This approach comes directly from a "code-and-build" mindset and the Makefile syntax can be really esoteric sometimes.... But I find it really useful when I when to rebuild only the docs that have changed since the last time.

Here's 2 basic examples :

DigitalTravelDuck commented 4 years ago

Hello Damien,

Do you know if it is possible to give the vars.yaml file as an argument with - - filter pandoc-mustache? or any other way to use one markdown file and 2 different vars file to generate 2 different pdf's out of 1 markdown ?

would be great.

Thanks, Arnold.

On Fri, 10 Jan 2020, 11:08 damien clochard, notifications@github.com wrote:

Personnally I like to use simple Makefile rules. Something like:

path to pandocTAG?=latestPANDOC?=docker run --rm -v pwd:/pandoc dalibo/pandocker:$(TAG)TEMPLATE?=eisvogel

Source and artifactsSOURCES := $(shell find . -name '*.md')OBJECTS_EPUB := $(patsubst %.md, %.epub, $(SOURCES) )OBJECTS_PDF := $(patsubst %.md, %.pdf, $(SOURCE) )

Targets

all: pdf .PHONY: epubepub: $(OBJECTS_EPUB) .PHONY: pdfpdf: $(OBJECTS_PDF) %.epub: %.md $(PANDOC) $^ -o $@ %.pdf: %.md $(PANDOC) --pdf-engine=xelatex --template $(TEMPLATE) $^ -o $@

This approach comes directly from a "code-and-build" mindset and the Makefile syntax can be really esoteric sometimes.... But I find it really useful when I when to rebuild only the docs that have changed since the last time.

Here's 2 basic examples :

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/dalibo/pandocker/issues/141?email_source=notifications&email_token=ANK6JHHRNS6NWADFT2PB4PDQ5BCJ3A5CNFSM4KDV5MF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEITMUTY#issuecomment-572967503, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANK6JHG25CRR4RA4Z57HZ7TQ5BCJ3ANCNFSM4KDV5MFQ .

daamien commented 4 years ago

Hi !

This is a separate issue from the original problem. I prefer having only topic per issue, it's easier on many levels.

So if you don't mind, I'm going to open a brand issue and copy/paste your question there.

daamien commented 4 years ago

My answer here: https://github.com/dalibo/pandocker/issues/144#issuecomment-577893611