From f99263d683ec5ccc2c34c5b23a3fa3893e48d7c4 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Tue, 21 Feb 2023 09:28:03 -0500 Subject: [PATCH 1/7] GH actions: permissions.contents.write refs https://github.com/manubot/rootstock/issues/485#issuecomment-1430048424 Some users might have their repository workflow permissions set to read only. This change should ensure the workflow job can write commits back to the output and gh-pages branches on GitHub. --- .github/workflows/manubot.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/manubot.yaml b/.github/workflows/manubot.yaml index a386328..99cdf69 100644 --- a/.github/workflows/manubot.yaml +++ b/.github/workflows/manubot.yaml @@ -38,6 +38,8 @@ jobs: manubot: name: Manubot runs-on: ubuntu-latest + permissions: + contents: write env: GITHUB_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} # Set SPELLCHECK to true/false for whether to check spelling in this action. From 26bec7c03fc9b7cde726698fb743c7f2a806af65 Mon Sep 17 00:00:00 2001 From: Milton Pividori Date: Sat, 11 Mar 2023 08:32:54 -0500 Subject: [PATCH 2/7] docx output: mastodon icon dimensions merges https://github.com/manubot/rootstock/pull/487 * add width/height to mastodon icon in front-matter * update mastodon icon from Front Awesome * remove dimensions from SVG files, since these are specified in the front matter. Co-authored-by: Vincent Rubinetti --- content/00.front-matter.md | 2 +- content/images/github.svg | 4 ++-- content/images/mastodon.svg | 47 +++---------------------------------- content/images/orcid.svg | 6 ++--- content/images/twitter.svg | 4 ++-- 5 files changed, 11 insertions(+), 52 deletions(-) diff --git a/content/00.front-matter.md b/content/00.front-matter.md index 720a3df..ed5e3e0 100644 --- a/content/00.front-matter.md +++ b/content/00.front-matter.md @@ -52,7 +52,7 @@ Published: {{manubot.date_long}} {%- endif %} {%- if author.mastodon is defined and author.mastodon is not none and author["mastodon-server"] is defined and author["mastodon-server"] is not none %} {%- set has_ids = true %} - · ![Mastodon icon](images/mastodon.svg){.inline_icon} + · ![Mastodon icon](images/mastodon.svg){.inline_icon width=16 height=16} [\@{{author.mastodon}}@{{author["mastodon-server"]}}](https://{{author["mastodon-server"]}}/@{{author.mastodon}}) {%- endif %} {%- if has_ids %} diff --git a/content/images/github.svg b/content/images/github.svg index 2c77c4c..5f377da 100644 --- a/content/images/github.svg +++ b/content/images/github.svg @@ -1,4 +1,4 @@ - - + + diff --git a/content/images/mastodon.svg b/content/images/mastodon.svg index da42299..261cb0e 100644 --- a/content/images/mastodon.svg +++ b/content/images/mastodon.svg @@ -1,45 +1,4 @@ - - - - - - + + + diff --git a/content/images/orcid.svg b/content/images/orcid.svg index efc939b..2a635df 100644 --- a/content/images/orcid.svg +++ b/content/images/orcid.svg @@ -1,4 +1,4 @@ - - - + + + diff --git a/content/images/twitter.svg b/content/images/twitter.svg index 7f676e3..7bfb686 100644 --- a/content/images/twitter.svg +++ b/content/images/twitter.svg @@ -1,4 +1,4 @@ - - + + From f3e0520060162f71f0950ea88d44de526d241ad1 Mon Sep 17 00:00:00 2001 From: Milton Pividori Date: Sun, 12 Mar 2023 09:38:44 -0400 Subject: [PATCH 3/7] Add librsvg as dependency merges https://github.com/manubot/rootstock/pull/489 closes https://github.com/manubot/rootstock/issues/488 * environment: add librsvg * add note about using SVG files from URL and exporting to docx --- build/environment.yml | 1 + content/02.delete-me.md | 1 + 2 files changed, 2 insertions(+) diff --git a/build/environment.yml b/build/environment.yml index 8c21b40..30fb360 100644 --- a/build/environment.yml +++ b/build/environment.yml @@ -7,6 +7,7 @@ dependencies: - ghp-import=2.1.0 - jinja2=3.1.2 - jsonschema=4.17.0 + - librsvg=2.52.5 - pandoc=2.19.2 - pango=1.48.10 - pip=22.3.1 diff --git a/content/02.delete-me.md b/content/02.delete-me.md index 387c467..1d57328 100644 --- a/content/02.delete-me.md +++ b/content/02.delete-me.md @@ -186,6 +186,7 @@ Loaded from a specific (hashed) version of the image on GitHub. **A vector `.svg` image loaded from GitHub.** The parameter `sanitize=true` is necessary to properly load SVGs hosted via GitHub URLs. White background specified to serve as a backdrop for transparent sections of the image. +Note that if you want to export to Word (`.docx`), you need to download the image and reference it locally (e.g. `content/images/vector.svg`) instead of using a URL. ](https://raw.githubusercontent.com/manubot/resources/main/test/vector.svg?sanitize=true "Vector image"){#fig:vector-image height=2.5in .white} ## Tables From 72a96c90f2aab350de5e06f57587f654d5df1d6b Mon Sep 17 00:00:00 2001 From: Anthony Gitter Date: Sun, 23 Apr 2023 16:33:24 -0500 Subject: [PATCH 4/7] Set write permissions in AI workflow merges https://github.com/manubot/rootstock/pull/493 closes https://github.com/manubot/rootstock/issues/492 * Set write permissions in AI workflow * Add pull-requests write permissions --- .github/workflows/ai-revision.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ai-revision.yaml b/.github/workflows/ai-revision.yaml index fbae61d..58eb0d3 100644 --- a/.github/workflows/ai-revision.yaml +++ b/.github/workflows/ai-revision.yaml @@ -27,6 +27,9 @@ jobs: ai-revise: name: AI Revise runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write defaults: run: shell: bash --login {0} From f9fff34656752c8d268d50c59981f4076036764b Mon Sep 17 00:00:00 2001 From: Anthony Gitter Date: Mon, 17 Jul 2023 14:41:41 -0500 Subject: [PATCH 5/7] Correct setup script typos merges https://github.com/manubot/rootstock/pull/498 --- setup.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.bash b/setup.bash index 4319cc3..6278299 100755 --- a/setup.bash +++ b/setup.bash @@ -15,7 +15,7 @@ echo "OWNER and REPO refer to the details of your manuscript repo location:" echo "i.e. https://github.com/OWNER/REPO." echo echo "Options:" -echo " -o --owner GitHub user or organisation name." +echo " -o --owner GitHub user or organization name." echo " -r --repo Name of the repository for your new manuscript." echo " -y --yes Non-interactive mode. Continue script without asking for confirmation that the repo exists." echo " -s --ssh Use SSH to authenticate GitHub account. HTTPS is used by default." @@ -104,7 +104,7 @@ if [ -z "${OWNER}" ] || [ -z "${REPO}" ]; then echo "First, we need to specify where to create the GitHub repo for your manuscript." echo echo "The URL will take this format: https://github.com/OWNER/REPO." - echo "OWNER is your username or organisation" + echo "OWNER is your username or organization" echo "REPO is the name of your repository" echo read -r -p "Type in the OWNER now:" input @@ -188,13 +188,13 @@ fi case $AUTH in 0) echo - echo "Seting origin URL using its https web address" + echo "Setting origin URL using its https web address" echo git remote set-url origin https://github.com/${OWNER}/${REPO}.git ;; 1) echo - echo "Seting origin URL using SSH" + echo "Setting origin URL using SSH" echo git remote set-url origin git@github.com:$OWNER/$REPO.git ;; From 299abcea4c710cdda024017b54148e24c8d37228 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Mon, 31 Jul 2023 13:51:49 -0400 Subject: [PATCH 6/7] CI: install environment using mamba merges https://github.com/manubot/rootstock/pull/501 CI: install environment using mamba. mamba is faster and has better error messages than conda. build/README.md: add mamba instructions to create environment. --- .github/workflows/manubot.yaml | 2 ++ build/README.md | 12 ++++++++++-- ci/install.sh | 6 +++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/manubot.yaml b/.github/workflows/manubot.yaml index 99cdf69..1ef5e98 100644 --- a/.github/workflows/manubot.yaml +++ b/.github/workflows/manubot.yaml @@ -84,7 +84,9 @@ jobs: activate-environment: manubot environment-file: build/environment.yml auto-activate-base: false + miniforge-variant: Mambaforge miniforge-version: 'latest' + use-mamba: true - name: Install Spellcheck if: env.SPELLCHECK == 'true' run: bash ci/install-spellcheck.sh diff --git a/build/README.md b/build/README.md index 28893ab..20e72cd 100644 --- a/build/README.md +++ b/build/README.md @@ -20,12 +20,17 @@ To change the options, either edit the YAML files directly or add additional `-- Note: currently, **Windows is not supported**. -Install the [conda](https://conda.io) environment specified in [`environment.yml`](environment.yml) by running the following commands +The Manubot environment is managed with [conda](https://conda.io). +If you do not have `conda` installed, we recommend using the Miniforge3 (includes `conda`) or Mambaforge (includes `conda` and `mamba`) installers from [miniforge](https://github.com/conda-forge/miniforge). +Install the environment from [`environment.yml`](environment.yml) by running one of following commands (from the repository's root directory): ```sh -# Install the environment +# Install the environment using conda conda env create --file build/environment.yml + +# Install the environment using mamba (faster) +mamba env create --file build/environment.yml ``` If the `manubot` environment is already installed, but needs to be updated to reflect changes to `environment.yml`, use one of the following options: @@ -38,6 +43,9 @@ conda env update --file build/environment.yml # Slower than option 1, but guarantees a fresh environment. conda env remove --name manubot conda env create --file build/environment.yml + +# option 3: reinstall the manubot environment faster using mamba. +mamba env create --force --file build/environment.yml ``` Activate with `conda activate manubot` (assumes `conda` version of [at least](https://github.com/conda/conda/blob/9d759d8edeb86569c25f6eb82053f09581013a2a/CHANGELOG.md#440-2017-12-20) 4.4). diff --git a/ci/install.sh b/ci/install.sh index c264b08..6b20f0e 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -7,7 +7,7 @@ set -o errexit \ -o pipefail -wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge-pypy3-$(uname)-$(uname -m).sh \ +wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh \ --output-document miniforge.sh bash miniforge.sh -b -p $HOME/miniconda source $HOME/miniconda/etc/profile.d/conda.sh @@ -15,8 +15,8 @@ hash -r conda config \ --set always_yes yes \ --set changeps1 no -conda env create --quiet --file build/environment.yml -conda list --name manubot +mamba env create --quiet --file build/environment.yml +mamba list --name manubot conda activate manubot # Install Spellcheck filter for Pandoc From 8c1a803748961dcf6b7e8ed4d5ec8f8ce6d5a2a9 Mon Sep 17 00:00:00 2001 From: Anthony Gitter Date: Mon, 14 Aug 2023 13:40:02 -0500 Subject: [PATCH 7/7] Improve DOCX environment variable documentation merges https://github.com/manubot/rootstock/pull/503 closes https://github.com/manubot/rootstock/issues/500 --- USAGE.md | 2 ++ build/README.md | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/USAGE.md b/USAGE.md index c867139..5ce07a5 100644 --- a/USAGE.md +++ b/USAGE.md @@ -322,6 +322,8 @@ metadata: csl: https://github.com/citation-style-language/styles/raw/906cd6d43d0c136190ecfbb12f6af0ca794e3c5b/peerj.csl ``` +Instructions for generating additional manuscript output formats such as DOCX can be found in [`build/README.md`](build/README.md). + ## Spellchecking When the `SPELLCHECK` environment variable is `true`, the pandoc [spellcheck filter](https://github.com/pandoc/lua-filters/tree/master/spellcheck) is run. diff --git a/build/README.md b/build/README.md index 20e72cd..3c09035 100644 --- a/build/README.md +++ b/build/README.md @@ -7,8 +7,19 @@ However, setting the `BUILD_PDF` environment variable to `false` will suppress P For example, run local builds using the command `BUILD_PDF=false bash build/build.sh`. To build a DOCX file of the manuscript, set the `BUILD_DOCX` environment variable to `true`. -For example, use the command `BUILD_DOCX=true bash build/build.sh`. -To export DOCX for all CI builds, set an environment variable (see docs for [GitHub Actions](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables)). +For example, use the command `BUILD_DOCX=true bash build/build.sh` locally. +To export DOCX for all CI builds, set an environment variable in the CI configuration file. +For GitHub Actions, set the variable in `.github\workflows\manubot.yaml` (see [docs](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables)): + +```yaml +name: Manubot +env: + BUILD_DOCX: true +``` + +To generate a single DOCX output of the latest manuscript with GitHub Actions, click the "Actions" tab at the top of the repository. +Select the "Manubot" workflow, then the "Run workflow" button and check "generate DOCX output" before clicking the green "Run workflow" button. + Currently, equation numbers via `pandoc-eqnos` are not supported for DOCX output. Format conversion is done using [Pandoc](https://pandoc.org/MANUAL.html).