From ec186c275c972411e027a4fdbc6a6cf1f611a003 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Wed, 1 Nov 2017 12:46:34 -0400 Subject: [PATCH] Update environment and documentation (#81) 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 https://github.com/Kozea/WeasyPrint/issues/59 --- USAGE.md | 4 ++-- build/build.sh | 40 +++++++++++++++++++++++++--------------- build/environment.yml | 21 ++++++++++----------- content/metadata.yaml | 1 + 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/USAGE.md b/USAGE.md index c53c22c6..19f410fe 100644 --- a/USAGE.md +++ b/USAGE.md @@ -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. @@ -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/)) diff --git a/build/build.sh b/build/build.sh index e64ee6fc..2c7bb47c 100644 --- a/build/build.sh +++ b/build/build.sh @@ -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 \ @@ -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" diff --git a/build/environment.yml b/build/environment.yml index 2f00e28d..113ddd49 100644 --- a/build/environment.yml +++ b/build/environment.yml @@ -1,16 +1,15 @@ 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 @@ -18,11 +17,11 @@ dependencies: - 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 diff --git a/content/metadata.yaml b/content/metadata.yaml index a95482dc..fbcb6e3b 100644 --- a/content/metadata.yaml +++ b/content/metadata.yaml @@ -4,6 +4,7 @@ keywords: - markdown - publishing - manubot +lang: en-US author_info: - github: johndoe