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
144 stars 23 forks source link

Include pandoc-citeproc #123

Closed colindean closed 4 years ago

colindean commented 4 years ago

Is your feature request related to a problem? Please describe.

My build relies on pandoc-citeproc, which I've installed manually on my workstation. It's not available in pandocker, so I can't use pandocker for builds.

Describe the solution you'd like

pandoc-citeproc could be included in pandocker.

Describe alternatives you've considered

I could build and maintain my own forked container…

Additional context

pandoc-citeproc is available as a package in Debian: https://packages.debian.org/stretch/pandoc-citeproc

Otherwise https://github.com/jgm/pandoc-citeproc

colindean commented 4 years ago

pandoc-citeproc doesn't ship a binary, so we'd have to build it if we didn't use the package from Debian. That package doesn't appear to have a transitive dependency on pandoc itself.

daamien commented 4 years ago

Hi @colindean !

Can you provide a basic example so I can check that the filter workout with the CI tests ?

colindean commented 4 years ago

Yes!

bib.bibtex:

@Book{BJP+16,
  title     = {{S}ite {R}eliability {E}ngineering: {H}ow {G}oogle {R}uns {P}roduction {S}ystems},
  publisher = {O'Reilly},
  year      = {2016},
  author    = {Beyer, B. and Jones, C. and Petoff, J. and Murphy, N.R.},
  owner     = {colindean},
  timestamp = {2019-10-09},
  url       = {https://landing.google.com/sre/book.html
},
}

doc.md:

# This is a doc

@BJP+16 says SRE is cool.

command:


pandoc --filter pandoc-citeproc --bibliography=bib.bibtex -M link-citations doc.md --output doc.pdf```
daamien commented 4 years ago

So the good news is that pandoc-citeproc is already installed in the current image. The bad news is that I have absolutely no idea why.... 😅

the line above works for me with:

docker run --rm -v `pwd`:/pandoc dalibo/pandocker:stable --filter pandoc-citeproc --bibliography=bib.bibtex -M link-citations doc.md --output doc.pdf
colindean commented 4 years ago

…what?

It doesn't appear to be installed:

$ docker run -it --entrypoint bash dalibo/pandocker:latest -c 'dpkg --list | grep pandoc'
ii  pandoc                        2.7-1                             amd64        general markup converter

…does my example not actually employ pandoc-citeproc, I wonder?

…does my doc not actually need pandoc-citeproc? Have I been living a lie? LOL. I'll investigate some more.

I know it needs pandoc-crossref (#127), that's for sure.

daamien commented 4 years ago

Ok the trick is that I am installing the .deb package published on github. This package contains citeproc

$ docker run -it --entrypoint bash dalibo/pandocker:latest -c 'dpkg -L pandoc'
/.
/usr
/usr/bin
/usr/bin/pandoc
/usr/bin/pandoc-citeproc
/usr/share
/usr/share/doc
/usr/share/doc/pandoc
/usr/share/doc/pandoc/copyright
/usr/share/doc/pandoc-citeproc
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pandoc-citeproc.1.gz
/usr/share/man/man1/pandoc.1.gz
docker run -it --entrypoint bash dalibo/pandocker:latest -c 'pandoc-citeproc --help'
Usage: pandoc-citeproc [options] [file..]
  -h         --help            show usage information
             --man             print man page to stdout
             --license         print license to stdout
  -V         --version         show program version
  -y         --bib2yaml        convert bibliography to YAML
  -j         --bib2json        convert bibliography to JSON
  -q         --quiet           silence all warnings
  -f FORMAT  --format=FORMAT   bibliography format
  -c NUMBER  --columns=NUMBER  column width (or 0)

However this is not the correct way to make a debian package ( the "1 tool per package" principle) so the debian distibutes 2 packages : pandoc and pandoc-citeproc

colindean commented 4 years ago

I removed pandoc-citeproc from the command line and from my system and my example still works. Maybe I don't actually need it for my particular use case. I have apparenly misunderstood its role in my document building cycle for months 😩 .

But, you note that pandoc distributes pandoc-citeproc with it so let's close this as no-action-required?

daamien commented 4 years ago

Looks like we both learned something today 😄

I'm ok to close this issue but before that I will had citeproc in the list of supported filters

colindean commented 4 years ago

Cool. It might be a good idea to include something in the build that will fail the build if all of a sudden pandoc-citeproc isn't in the deb. It's a pretty safe assumption that it will stay there, but given that it shouldn't be there by convention, testing its existence seems like a good idea.

daamien commented 4 years ago

Fixed by #129