Skip to content
Open
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
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ ADD Gemfile.lock /tmp/
RUN cd /tmp && bundle config build.nokogiri --use-system-libraries && bundle install

# install pandoc 1.12 by from manually downloaded trusty deb packages (saucy only has 1.11, which is too old)
RUN apt-get install -y pandoc
#RUN apt-get install -y pandoc
RUN mkdir -p /tmp/debs/ && cd /tmp/debs && \
wget https://github.com/jgm/pandoc/releases/download/2.2.3.2/pandoc-2.2.3.2-1-amd64.deb && \
dpkg -i *.deb

EXPOSE 12736
WORKDIR /var/gdocs-export/
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ latex:
cp $(input_file) $(OUTPUT)/in.html

bundle exec ruby -C$(OUTPUT) "$$PWD/lib/pandoc-preprocess.rb" in.html > $(OUTPUT)/preprocessed.html
pandoc --parse-raw $(OUTPUT)/preprocessed.html -t json > $(OUTPUT)/pre.json
pandoc $(OUTPUT)/preprocessed.html -f html+raw_html -t json > $(OUTPUT)/pre.json
cat $(OUTPUT)/pre.json | ./lib/pandoc-filter.py > $(OUTPUT)/post.json

# use pandoc to create metadata.tex, main.tex (these are included by ew-template.tex)
pandoc $(OUTPUT)/post.json --no-wrap -t latex --template $(OUTPUT)/template-metadata.tex > $(OUTPUT)/metadata.tex
pandoc $(OUTPUT)/post.json --chapters --no-wrap -t latex > $(OUTPUT)/main.tex
pandoc $(OUTPUT)/post.json --wrap=none -t latex --template $(OUTPUT)/template-metadata.tex > $(OUTPUT)/metadata.tex
pandoc $(OUTPUT)/post.json --top-level-division=chapter --wrap=none -t latex > $(OUTPUT)/main.tex

# must use -o with docx output format, since its binary
pandoc $(OUTPUT)/post.json -s -t docx -o $(OUTPUT)/$(name).docx
Expand All @@ -64,13 +64,13 @@ pdf:
echo "Created $(OUTPUT)/$(name).tex, compiling into $(name).pdf"
# rubber will set output PDF filename based on latex input filename
cp -f $(OUTPUT)/template.tex $(OUTPUT)/$(name).tex
( cd $(OUTPUT); latexmk -pdf $(name))
( cd $(OUTPUT); rubber --pdf $(name))

convert: latex pdf

diff:
/usr/bin/perl "`which latexdiff`" --flatten $(outdir)/$(before)/$(before).tex $(OUTPUT)/$(name).tex > $(OUTPUT)/diff.tex
(cd $(OUTPUT); latexmk -pdf diff)
(cd $(OUTPUT); rubber --pdf diff)


#===============================================================================
Expand Down