Skip to content

Commit

Permalink
Update environment and documentation (#81)
Browse files Browse the repository at this point in the history
Pandoc upgraded to v2.0.0.1

Swap anaconda packages to conda-forge

Update build.sh for pandoc 2.0

WeasyPrint was not renderring MathJax, so use --webtex to convert
equations to SVGs for PDF output. See
Kozea/WeasyPrint#59
  • Loading branch information
dhimmel authored Nov 1, 2017
1 parent 38effe8 commit ec186c2
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
4 changes: 2 additions & 2 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ For guidance on what CSL JSON should be like for different document types, refer
## Manuscript metadata

[`content/metadata.yaml`](content/metadata.yaml) contains manuscript metadata that gets passed through to Pandoc, via a [`yaml_metadata_block`](http://pandoc.org/MANUAL.html#extension-yaml_metadata_block).
`metadata.yaml` should contain the manuscript `title`, `authors` list, and `keywords`.
`metadata.yaml` should contain the manuscript `title`, `authors` list, `keywords`, and language (`lang`).
Additional metadata, such as `date`, will automatically be created by the Manubot.
Manubot uses the [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) specified in [`build.sh`](build/build.sh) for setting the manuscript's date.
For example, setting the `TZ` environment variable to `Etc/UTC` directs the Manubot to use Coordinated Universal Time.
Expand All @@ -147,7 +147,7 @@ If you experience any issues with the Manubot or would like to contribute to its

For additional examples, check out existing manuscripts that use the Manubot:

+ Satoshi Nakamoto's Bitcoin Whitepaper ([source](https://github.com/dhimmel/bitcoin-whitepaper/), [manuscript](https://dhimmel.github.io/bitcoin-whitepaper/))
+ Satoshi Nakamoto's Bitcoin Whitepaper ([source](https://github.com/dhimmel/bitcoin-whitepaper/), [manuscript](https://dhimmel.github.io/bitcoin-whitepaper/), [commentary](https://steemit.com/manubot/@dhimmel/how-i-used-the-manubot-to-reproduce-the-bitcoin-whitepaper))
+ The Sci-Hub Coverage Study ([source](https://github.com/greenelab/scihub-manuscript), [manuscript](https://greenelab.github.io/scihub-manuscript/))
+ A Report for the Vagelos Scholars Program by Michael Zietz ([source](https://github.com/zietzm/Vagelos2017), [manuscript](https://zietzm.github.io/Vagelos2017/))
+ The Deep Review ([source](https://github.com/greenelab/deep-review), [manuscript](https://greenelab.github.io/deep-review/))
Expand Down
40 changes: 25 additions & 15 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ echo "Exporting HTML manuscript"
pandoc --verbose \
--from=markdown \
--to=html5 \
--filter pandoc-fignos \
--filter pandoc-eqnos \
--filter pandoc-tablenos \
--filter=pandoc-fignos \
--filter=pandoc-eqnos \
--filter=pandoc-tablenos \
--bibliography=$BIBLIOGRAPHY_PATH \
--csl=$CSL_PATH \
--metadata link-citations=true \
--smart \
--mathjax \
--css=github-pandoc.css \
--include-in-header=build/assets/analytics.js \
Expand All @@ -44,30 +43,41 @@ pandoc --verbose \

# Create PDF output
echo "Exporting PDF manuscript"
weasyprint \
--verbose \
--presentational-hints \
webpage/index.html \
output/manuscript.pdf
ln --symbolic content/images images
pandoc \
--from=markdown \
--to=html5 \
--pdf-engine=weasyprint \
--pdf-engine-opt=--presentational-hints \
--filter=pandoc-fignos \
--filter=pandoc-eqnos \
--filter=pandoc-tablenos \
--bibliography=$BIBLIOGRAPHY_PATH \
--csl=$CSL_PATH \
--metadata link-citations=true \
--webtex=https://latex.codecogs.com/svg.latex? \
--css=webpage/github-pandoc.css \
--output=output/manuscript.pdf \
$INPUT_PATH
rm --recursive images

# Create DOCX output when user specifies to do so
if [ "$BUILD_DOCX" = "true" ];
then
echo "Exporting Word Docx manuscript"
ln --symbolic content/images images
pandoc --verbose \
--from=markdown \
--to=docx \
--filter pandoc-fignos \
--filter pandoc-tablenos \
--filter=pandoc-fignos \
--filter=pandoc-eqnos \
--filter=pandoc-tablenos \
--bibliography=$BIBLIOGRAPHY_PATH \
--csl=$CSL_PATH \
--metadata link-citations=true \
--reference-docx=$DOCX_PATH \
--smart \
--reference-doc=$DOCX_PATH \
--resource-path=.:content \
--output=output/manuscript.docx \
$INPUT_PATH
rm --recursive images
fi

echo "Build complete"
21 changes: 10 additions & 11 deletions build/environment.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
name: manubot
channels:
- anaconda
- conda-forge
dependencies:
- anaconda::jinja2=2.9.6
- anaconda::pandas=0.20.3
- anaconda::python=3.6.2
- anaconda::pyyaml=3.12
- anaconda::requests=2.14.2
- conda-forge::cairo=1.14.6
- conda-forge::cffi=1.10.0
- conda-forge::pandoc=1.19.2
- conda-forge::jinja2=2.9.6
- conda-forge::pandas=0.21.0
- conda-forge::pandoc=2.0.0.1
- conda-forge::python=3.6.3
- conda-forge::pyyaml=3.12
- conda-forge::requests=2.18.4
- conda-forge::watchdog=0.8.3
- pip:
- errorhandler==2.0.1
- ghp-import==0.5.5
- git+https://github.com/greenelab/manubot@367f0b5c8046e5ce2f1e5a0ef555ec29a4aefd59
- opentimestamps-client==0.5.0
- opentimestamps==0.1.0
- pandoc-eqnos==0.16
- pandoc-fignos==0.20
- pandoc-tablenos==0.16
- pandoc-eqnos==0.18.1
- pandoc-fignos==0.21.1
- pandoc-tablenos==0.17.1
- pybase62==0.3.2
- pysha3==1.0.2
- python-bitcoinlib==0.8.0
- requests-cache==0.4.13
- weasyprint==0.40
- weasyprint==0.41
1 change: 1 addition & 0 deletions content/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ keywords:
- markdown
- publishing
- manubot
lang: en-US
author_info:
-
github: johndoe
Expand Down

0 comments on commit ec186c2

Please sign in to comment.