From 67c788fe69147d4bccbe7a70dc74099e41812847 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Tue, 24 Nov 2020 08:33:07 +0100 Subject: [PATCH] Init from an internal repo. Commit d5b6f8e831fc5c933af5ceb1267f51ef6af6c438 --- .gitignore | 2 + CHANGELOG.md | 5 + README.md | 144 + cookiecutter.json | 19 + hooks/post_gen_project.sh | 111 + hooks/pre_gen_project.sh | 6 + main.yml | 66 + test/configs/acl.yml | 3 + test/configs/coling.yml | 3 + test/configs/eacl-appendix.yml | 4 + test/configs/eacl.yml | 3 + test/configs/emnlp.yml | 2 + test/configs/llncs.yml | 3 + test/configs/nle.yml | 3 + test/configs/poleval.yml | 3 + test/configs/pw-thesis.yml | 3 + test/configs/sigconf.yml | 3 + test/configs/tacl.yml | 3 + test/configs/vanilla.yml | 3 + test/run_tests.sh | 29 + .../.cookiecutter.yml | 18 + {{cookiecutter.paper_repo_name}}/.gitignore | 157 + .../.gitlab-ci.yml | 10 + .../ACM-Reference-Format.bst | 2913 ++++ {{cookiecutter.paper_repo_name}}/Jenkinsfile | 66 + {{cookiecutter.paper_repo_name}}/Makefile | 106 + {{cookiecutter.paper_repo_name}}/README.md | 5 + .../acl2020-template-appendix.tex | 50 + .../acl2020-template-meta.tex | 12 + .../_latex-templates/acl2020-template.tex | 65 + .../coling2020-template-meta.tex | 14 + .../_latex-templates/coling2020-template.tex | 64 + .../emnlp2020-template-appendix.tex | 44 + .../emnlp2020-template-meta.tex | 12 + .../_latex-templates/emnlp2020-template.tex | 61 + .../_latex-templates/llncs-template-meta.tex | 22 + .../_latex-templates/llncs-template.tex | 50 + .../_latex-templates/nle-template-meta.tex | 20 + .../_latex-templates/nle-template.tex | 49 + .../poleval-template-meta.tex | 12 + .../_latex-templates/poleval-template.tex | 33 + .../_latex-templates/poleval.bst | 1214 ++ .../_latex-templates/poleval.cls | 214 + .../pw-thesis-template-meta.tex | 6 + .../pw-thesis-template-titlepage-en.tex | 84 + .../_latex-templates/pw-thesis-template.tex | 338 + .../sigconf-template-meta.tex | 83 + .../_latex-templates/sigconf-template.tex | 170 + .../tacl2018v2-template-meta.tex | 13 + .../_latex-templates/tacl2018v2-template.tex | 97 + .../vanilla-template-meta.tex | 17 + .../_latex-templates/vanilla-template.tex | 50 + .../_optional_files/_appendix/appendix.tex | 6 + .../_optional_files/_pl_files/abstract-pl.tex | 1 + .../_optional_files/_pl_files/keywords-pl.tex | 1 + .../_optional_files/_pw-thesis/arial.ttf | Bin 0 -> 367112 bytes .../_optional_files/_pw-thesis/img/master.png | Bin 0 -> 66653 bytes .../_optional_files/_pw-thesis/img/wut.png | Bin 0 -> 209068 bytes {{cookiecutter.paper_repo_name}}/abstract.tex | 1 + {{cookiecutter.paper_repo_name}}/acl.bst | 1322 ++ {{cookiecutter.paper_repo_name}}/acmart.cls | 2907 ++++ .../autozoil-extras.tex | 5 + .../autozoil-via-docker.sh | 3 + .../bibliography.bib | 29 + {{cookiecutter.paper_repo_name}}/build.sh | 4 + .../coling2020.sty | 382 + {{cookiecutter.paper_repo_name}}/config.tex | 22 + .../contributions.yaml | 12 + .../cup_logo-eps-converted-to.pdf | Bin 0 -> 22003 bytes {{cookiecutter.paper_repo_name}}/cup_logo.eps | 11044 ++++++++++++++++ .../extract-score-files.pl | 20 + {{cookiecutter.paper_repo_name}}/extras.tex | 10 + .../helpers/flatten-structure.pl | 28 + .../generate-pdf-from-arxiv-package.sh | 32 + .../helpers/get-sentences.sh | 3 + .../helpers/pdf-to-plain-text.sh | 3 + .../helpers/prepare-arxiv-package.sh | 133 + .../helpers/stats.sh | 18 + .../helpers/strip-references.pl | 28 + .../helpers/synchro.sh | 24 + {{cookiecutter.paper_repo_name}}/helpers/vars | 2 + .../install-hooks.sh | 4 + {{cookiecutter.paper_repo_name}}/keywords.tex | 1 + {{cookiecutter.paper_repo_name}}/llncs.cls | 1220 ++ {{cookiecutter.paper_repo_name}}/main.tex | 12 + {{cookiecutter.paper_repo_name}}/nle.cls | 4212 ++++++ {{cookiecutter.paper_repo_name}}/nlelike.bst | 1107 ++ .../other-extras.tex | 40 + {{cookiecutter.paper_repo_name}}/preamble.tex | 4 + .../run-gitlab-runner.sh | 33 + {{cookiecutter.paper_repo_name}}/splncs04.bst | 1550 +++ 91 files changed, 30710 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 cookiecutter.json create mode 100755 hooks/post_gen_project.sh create mode 100755 hooks/pre_gen_project.sh create mode 100644 main.yml create mode 100644 test/configs/acl.yml create mode 100644 test/configs/coling.yml create mode 100644 test/configs/eacl-appendix.yml create mode 100644 test/configs/eacl.yml create mode 100644 test/configs/emnlp.yml create mode 100644 test/configs/llncs.yml create mode 100644 test/configs/nle.yml create mode 100644 test/configs/poleval.yml create mode 100644 test/configs/pw-thesis.yml create mode 100644 test/configs/sigconf.yml create mode 100644 test/configs/tacl.yml create mode 100644 test/configs/vanilla.yml create mode 100755 test/run_tests.sh create mode 100644 {{cookiecutter.paper_repo_name}}/.cookiecutter.yml create mode 100644 {{cookiecutter.paper_repo_name}}/.gitignore create mode 100644 {{cookiecutter.paper_repo_name}}/.gitlab-ci.yml create mode 100644 {{cookiecutter.paper_repo_name}}/ACM-Reference-Format.bst create mode 100644 {{cookiecutter.paper_repo_name}}/Jenkinsfile create mode 100644 {{cookiecutter.paper_repo_name}}/Makefile create mode 100644 {{cookiecutter.paper_repo_name}}/README.md create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/acl2020-template-appendix.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/acl2020-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/acl2020-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/coling2020-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/coling2020-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/emnlp2020-template-appendix.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/emnlp2020-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/emnlp2020-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/llncs-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/llncs-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/nle-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/nle-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/poleval-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/poleval-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/poleval.bst create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/poleval.cls create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/pw-thesis-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/pw-thesis-template-titlepage-en.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/pw-thesis-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/sigconf-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/sigconf-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/tacl2018v2-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/tacl2018v2-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/vanilla-template-meta.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_latex-templates/vanilla-template.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_optional_files/_appendix/appendix.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_optional_files/_pl_files/abstract-pl.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_optional_files/_pl_files/keywords-pl.tex create mode 100644 {{cookiecutter.paper_repo_name}}/_optional_files/_pw-thesis/arial.ttf create mode 100644 {{cookiecutter.paper_repo_name}}/_optional_files/_pw-thesis/img/master.png create mode 100644 {{cookiecutter.paper_repo_name}}/_optional_files/_pw-thesis/img/wut.png create mode 100644 {{cookiecutter.paper_repo_name}}/abstract.tex create mode 100644 {{cookiecutter.paper_repo_name}}/acl.bst create mode 100644 {{cookiecutter.paper_repo_name}}/acmart.cls create mode 100644 {{cookiecutter.paper_repo_name}}/autozoil-extras.tex create mode 100755 {{cookiecutter.paper_repo_name}}/autozoil-via-docker.sh create mode 100644 {{cookiecutter.paper_repo_name}}/bibliography.bib create mode 100755 {{cookiecutter.paper_repo_name}}/build.sh create mode 100644 {{cookiecutter.paper_repo_name}}/coling2020.sty create mode 100644 {{cookiecutter.paper_repo_name}}/config.tex create mode 100644 {{cookiecutter.paper_repo_name}}/contributions.yaml create mode 100644 {{cookiecutter.paper_repo_name}}/cup_logo-eps-converted-to.pdf create mode 100644 {{cookiecutter.paper_repo_name}}/cup_logo.eps create mode 100755 {{cookiecutter.paper_repo_name}}/extract-score-files.pl create mode 100644 {{cookiecutter.paper_repo_name}}/extras.tex create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/flatten-structure.pl create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/generate-pdf-from-arxiv-package.sh create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/get-sentences.sh create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/pdf-to-plain-text.sh create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/prepare-arxiv-package.sh create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/stats.sh create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/strip-references.pl create mode 100755 {{cookiecutter.paper_repo_name}}/helpers/synchro.sh create mode 100644 {{cookiecutter.paper_repo_name}}/helpers/vars create mode 100755 {{cookiecutter.paper_repo_name}}/install-hooks.sh create mode 100644 {{cookiecutter.paper_repo_name}}/keywords.tex create mode 100644 {{cookiecutter.paper_repo_name}}/llncs.cls create mode 100644 {{cookiecutter.paper_repo_name}}/main.tex create mode 100644 {{cookiecutter.paper_repo_name}}/nle.cls create mode 100644 {{cookiecutter.paper_repo_name}}/nlelike.bst create mode 100644 {{cookiecutter.paper_repo_name}}/other-extras.tex create mode 100644 {{cookiecutter.paper_repo_name}}/preamble.tex create mode 100755 {{cookiecutter.paper_repo_name}}/run-gitlab-runner.sh create mode 100644 {{cookiecutter.paper_repo_name}}/splncs04.bst diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5529fbe --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +test/lorem-ipsum-paper/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..76f98b3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ + + +## 4.0.0 (2020-11-24) + +Init from an internal project ver. 3.8.4 (d5b6f8e831fc5c933af5ceb1267f51ef6af6c43) diff --git a/README.md b/README.md new file mode 100644 index 0000000..e5d4525 --- /dev/null +++ b/README.md @@ -0,0 +1,144 @@ +Template for LaTeX papers +========================= + +The template itself is in the `{{cookiecutter.paper_id}}-paper`. + +In order to generate a project from the template: + +* install cookiecutter +* find a paper-cutter tag applicable (usually the latest tag listed at ), say VERSION +* run: `cookiecutter https://git.wmi.amu.edu.pl/filipg/paper-cutter.git --checkout VERSION` + +You will be asked to choose a LaTeX template, at the moment the +following templates are handled: + +* “Vanilla” — just a standard LaTeX article template (`vanilla`), +* TACL (`tacl`), +* ACL (`acl`), +* Natural Language Engineering journal (`nle`), +* ACM SIGCONF template (`sigconf`), e.g. for the SIGIR conference, +* MSc thesis at Warsaw University of Technology (`pw-thesis`) +* COLING (`coling`) +* LLNCS (`llncs`) +* EMNLP (`emnlp`) +* EACL (`eacl`) +* PolEval (`poleval`) + +If you are to use another template, prepare an MR to this repo first! +Do not add directly to your specific paper. + +Interoperation with Overleaf +---------------------------- + +Overleaf handles git but in an imperfect way (to put it mildly). It's better to upload a +package to Overleaf first: + +1. Create a project locally. +2. Run `make` +3. Run `make source-pack` +4. Upload the zip file to Overleaf. +5. Copy project to some other place. +5. Clone the repo from Overleaf: `git clone https://git.overleaf.com/FUNNY-OVERLEAF-CODE PAPERID-paper` +6. Set remotes: + +``` +git remote add overleaf https://git.overleaf.com/FUNNY-OVERLEAF-CODE +git remote set-url origin YOUR-GIT-REPO +``` + +7. Set credential helper so that stupid Overleaf won't ask about + password: `git config credential.helper "cache --timeout=10000000"` +8. Unfortunately, Overleaf will discard hidden files (`.*`) when a zip + is uploaded, also file permissions will be somewhat broken +9. … so you need to copy `.cookiecutter.yml` file and re-apply the template (`cookiecutter https://git.wmi.amu.edu.pl/filipg/paper-cutter.git --checkout VERSION --output-dir .. --config-file .cookiecutter.yml --no-input --overwrite-if-exists`) +10. Re-commit the files (including recovered `.*` files). +11. Push the repo to Overleaf (fortunately, the `.*` will be treated + correctly when this is done by git): `git push overleaf master` +12. Push the repo to GitLab. `git push origin master` +13. Set the Overleaf git remote in `helpers/vars` +14. Now you can synchronize between GitLab repo and Overleaf manually or using `helpers/synchro.sh` script + +Updating package with updated template +-------------------------------------- + +To keep your codebase in sync with template you need to occasionally reapply the template. +Here's how: + +* find a paper-cutter tag applicable, say VERSION +* (do *not* refer to master in your projects!) +* go to project root +* run: `cookiecutter https://git.wmi.amu.edu.pl/filipg/paper-cutter.git --checkout VERSION --output-dir .. --config-file .cookiecutter.yml --no-input --overwrite-if-exists` +* check changes with git + +Editing the files +----------------- + +Please do **not** modify the file `PAPER_ID.tex` (this file is +supplied by this template — and will be switched when you switch to +another journal/conference template, see below) . Modify +`metadata.tex` and `main.text` files. + +If you really need to change `PAPER_ID.tex`, please prepare a merge +request to this template repo. + +Switching to another conference/journal template +------------------------------------------------ + +Switching to another conference or journal template is easy. + +1. Check whether the template is already handled. (See above for the list of LaTeX templates handled.) + If not, get in touch with Filip Graliński. +2. Commit or stash any uncommitted changes. +3. Change the `latex_template` value accordingly in the `.cookiecutter.yml` file. Commit the changes. +4. Re-run the template (as if updating, see above: `cookiecutter https://git.wmi.amu.edu.pl/filipg/paper-cutter.git --checkout VERSION --output-dir .. --config-file .cookiecutter.yml --no-input --overwrite-if-exists`). +5. Compare `metadata.tex` against the right metadata template file + (`*/*-template-meta.tex` in `_latex-templates/`) and make any fixes + needed. This is the only thing that needs to be done manually + (unfortunately, LaTeX templates differ in commands for authors, their affiliations, etc.). +6. Run `make` to generate PDF. +7. If you have an appendix, make sure it is rendered correctly. + +Versioning the template +----------------------- + +Always use a specific tag in the `.gitlab-ci.yml` file for your +project when including `main.yml` from this repository. + +This template is versioned with a Semantic-Versioning-like scheme, i.e. +a version is expected to be of the form M.N.P, where: + +* _M_ is changed in case of breaking changes for which manual actions + other then update with the `cookiecutter` command is required +* _N_ is changed when a new feature is added or a significant bugfix + happened, it means that the files need to be updated in a project + with the `cookiecutter` command +* _P_ is changed in case of minor changes or bugfixes, it should be OK even + if changes are not update with the `cookiecutter` command + +### Releasing a new version of the template + +* change the version in the + `{{cookiecutter.paper_id}}-paper/.gitlab-ci.yml` template file +* add an item to `CHANGELOG.md` +* in case of breaking changes (_M_ is incremented) describe clearly + what actions are to be taken in `CHANGELOG.md` +* tag master with the version (the same as in `{{cookiecutter.paper_id}}-paper/.gitlab-ci.yml`) + +Variables to be set in GitLab UI +-------------------------------- + +* `SLACK_RELEASE_BOT_SECRET` - secret to a Slack bot to inform about new releases + (go to , click + "Incoming WebHooks" / "Add", then configure the hook and + and set the string such as "ABCDEFGHI12/ABCDEFGHI12/aaaaaaaaaaaaaaaaaaaaaaaa" + as `SLACK_RELEASE_BOT_SECRET`) + +## Authors + +Prepared by Filip Graliński (Applica.ai). + +### Contributors + +* Łukasz Garncarek +* Piotr Halama (including the project name) +* Tomasz Stanisławek diff --git a/cookiecutter.json b/cookiecutter.json new file mode 100644 index 0000000..10dda3a --- /dev/null +++ b/cookiecutter.json @@ -0,0 +1,19 @@ +{ + "paper_id": "lorem-ipsum", + "paper_repo_name": "{{ cookiecutter.paper_id + '-paper' }}", + "paper_short_description": "Sample paper", + "paper_title": "Paper title", + "gitlab_group": "research/papers", + "main_contributor": "jan.iksinski", + "main_contributor_name": "Jan Iksiński", + "latex_template": "vanilla", + "git_host": "git.wmi.amu.edu.pl", + "locale": "en_US", + "with_appendix": "no", + "extra_locale": "{{ 'none' if cookiecutter.latex_template != 'pw-thesis' else 'pl_PL' }}", + "with_arxiv_package": "{{ 'yes' if cookiecutter.latex_template != 'pw-thesis' else 'no' }}", + "discipline": "none", + "specialization": "none", + "supervisor": "none", + "album_no": "none" +} diff --git a/hooks/post_gen_project.sh b/hooks/post_gen_project.sh new file mode 100755 index 0000000..ad01f75 --- /dev/null +++ b/hooks/post_gen_project.sh @@ -0,0 +1,111 @@ +#!/bin/bash -xe + +get_files() +{ + url=$1 + shift + dump_dir=$(mktemp -d) + dumped_file=$dump_dir/file.zip + wget -O $dumped_file "$url" + (cd $dump_dir && unzip -j file.zip) + for file in $@ + do + sfile=$dump_dir/$file + if [[ -r $sfile ]] + then + cp $sfile . + else + echo >&2 "Cannot find '$file' in '$url'" + exit 1 + fi + done +} + +fix_noexpand_issue() +{ + # see https://tex.stackexchange.com/questions/487428/patch-failed-in-emnlp-style-template + file_to_be_patched="$1" + sed -i 's|{\\errmessage{\\noexpand patch failed}}|{}|g' "$1" +} + +if [ "{{ cookiecutter.latex_template }}" = "vanilla" ]; then + cp -r _latex-templates/vanilla-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/vanilla-template-meta.tex metadata.tex +elif [ "{{ cookiecutter.latex_template }}" = "tacl" ]; then + wget 'https://transacl.org/tacl-submission-templates/tacl2018v2.sty' + wget 'https://transacl.org/tacl-submission-templates/acl_natbib.bst' + cp -r _latex-templates/tacl2018v2-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/tacl2018v2-template-meta.tex metadata.tex +elif [ "{{ cookiecutter.latex_template }}" = "acl" ]; then + get_files "http://acl2020.org/downloads/acl2020-templates.zip" \ + acl2020.sty \ + acl_natbib.bst + fix_noexpand_issue acl2020.sty + cp -r _latex-templates/acl2020-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/acl2020-template-meta.tex metadata.tex + if [ "{{ cookiecutter.with_appendix }}" = "yes" ]; then + cp -r _latex-templates/acl2020-template-appendix.tex the-appendix.tex + fi +elif [ "{{ cookiecutter.latex_template }}" = "nle" ]; then + cp -r _latex-templates/nle-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/nle-template-meta.tex metadata.tex +elif [ "{{ cookiecutter.latex_template }}" = "sigconf" ]; then + cp -r _latex-templates/sigconf-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/sigconf-template-meta.tex metadata.tex +elif [ "{{ cookiecutter.latex_template }}" = "pw-thesis" ]; then + cp -r _latex-templates/pw-thesis-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/pw-thesis-template-meta.tex metadata.tex + cp -r _latex-templates/pw-thesis-template-titlepage-en.tex titlepage.tex + + cp -r _optional_files/_pw-thesis/* . +elif [ "{{ cookiecutter.latex_template }}" = "coling" ]; then + cp -r _latex-templates/coling2020-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/coling2020-template-meta.tex metadata.tex +elif [ "{{ cookiecutter.latex_template }}" = "llncs" ]; then + cp -r _latex-templates/llncs-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/llncs-template-meta.tex metadata.tex +elif [ "{{ cookiecutter.latex_template }}" = "emnlp" ]; then + get_files "https://2020.emnlp.org/files/emnlp2020-templates.zip" \ + acl_natbib.bst \ + emnlp2020.sty + cp -r _latex-templates/emnlp2020-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/emnlp2020-template-meta.tex metadata.tex + cp -r _latex-templates/emnlp2020-template-appendix.tex the-appendix.tex +elif [ "{{ cookiecutter.latex_template }}" = "eacl" ]; then + get_files "https://2021.eacl.org/downloads/eacl2021-templates.zip" \ + acl_natbib.bst \ + eacl2021.sty + cp -r _latex-templates/acl2020-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/acl2020-template-meta.tex metadata.tex + + if [ "{{ cookiecutter.with_appendix }}" = "yes" ]; then + cp -r _latex-templates/acl2020-template-appendix.tex the-appendix.tex + fi +elif [ "{{ cookiecutter.latex_template }}" = "poleval" ]; then + cp -r _latex-templates/poleval-template.tex {{cookiecutter.paper_id}}.tex + cp -r _latex-templates/poleval-template-meta.tex metadata.tex + cp -r _latex-templates/poleval.{bst,cls} . +fi + +if [ "{{ cookiecutter.with_appendix }}" = "yes" ]; then + cp -r _optional_files/_appendix/* . +fi + +if [ "{{ cookiecutter.extra_locale }}" = "pl_PL" ]; then + cp -r _optional_files/_pl_files/* . +fi + +rm -rf _latex-templates _optional_files + +if [ -e .git ]; then + git checkout README.md main.tex abstract.tex preamble.tex metadata.tex bibliography.bib contributions.yaml + for f in helpers/vars abstract-pl.tex keywords.tex keywords-pl.tex appendix.tex + do + git checkout $f || true + done +else + git init + git add --all + git commit -m 'init' + git remote add origin git@{{cookiecutter.git_host}}:{{cookiecutter.gitlab_group}}/{{cookiecutter.paper_repo_name}}.git +fi diff --git a/hooks/pre_gen_project.sh b/hooks/pre_gen_project.sh new file mode 100755 index 0000000..3c85b48 --- /dev/null +++ b/hooks/pre_gen_project.sh @@ -0,0 +1,6 @@ +#!/bin/bash -xe + +if [[ -e .git && ! -z "$(git status --untracked-files=no --porcelain)" ]]; then + >&2 echo "Uncommited changes, commit your changes first" + exit 1 +fi diff --git a/main.yml b/main.yml new file mode 100644 index 0000000..b50fca9 --- /dev/null +++ b/main.yml @@ -0,0 +1,66 @@ + +variables: + WITH_ARXIV_PACKAGE: "{{cookiecutter.with_arxiv_package}}" + + +image: loxygen/autozoil:1.2.1 + +# work-around for GitLab shortcomings +# (https://gitlab.com/gitlab-org/gitlab-ce/issues/23434) +.default_stuff: &default_stuff + tags: + - openshift + +stages: + - build + - arxiv + - lint + - pack + +build-pdf: + <<: *default_stuff + stage: build + script: + - make + artifacts: + paths: + - ${PAPER_ID}.pdf + - ${PAPER_ID}.log + - stats.txt + - abstract.txt + - supplement.zip + - sentences.txt + +autozoil: + <<: *default_stuff + stage: lint + script: + - ls -l + - make autozoil-log.txt + artifacts: + paths: + - autozoil-log.txt + +source-pack: + <<: *default_stuff + stage: pack + script: + - make source-pack + artifacts: + paths: + - ${PAPER_ID}.zip + +arxiv: + <<: *default_stuff + stage: arxiv + script: + - git clone https://github.com/google-research/arxiv-latex-cleaner.git + - (cd arxiv-latex-cleaner && python3 setup.py install) + - make arxiv-${PAPER_ID}.pdf + artifacts: + paths: + - arxiv-${PAPER_ID}.pdf + - arxiv-${PAPER_ID}.tar.gz + only: + variables: + - $WITH_ARXIV_PACKAGE == "yes" diff --git a/test/configs/acl.yml b/test/configs/acl.yml new file mode 100644 index 0000000..6d569ef --- /dev/null +++ b/test/configs/acl.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'acl' diff --git a/test/configs/coling.yml b/test/configs/coling.yml new file mode 100644 index 0000000..c41ec2d --- /dev/null +++ b/test/configs/coling.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'coling' diff --git a/test/configs/eacl-appendix.yml b/test/configs/eacl-appendix.yml new file mode 100644 index 0000000..401aa87 --- /dev/null +++ b/test/configs/eacl-appendix.yml @@ -0,0 +1,4 @@ + +default_context: + latex_template: 'eacl' + with_appendix: 'yes' diff --git a/test/configs/eacl.yml b/test/configs/eacl.yml new file mode 100644 index 0000000..f18b576 --- /dev/null +++ b/test/configs/eacl.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'eacl' diff --git a/test/configs/emnlp.yml b/test/configs/emnlp.yml new file mode 100644 index 0000000..e59ac1c --- /dev/null +++ b/test/configs/emnlp.yml @@ -0,0 +1,2 @@ +default_context: + latex_template: 'emnlp' diff --git a/test/configs/llncs.yml b/test/configs/llncs.yml new file mode 100644 index 0000000..7bf961d --- /dev/null +++ b/test/configs/llncs.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'llncs' diff --git a/test/configs/nle.yml b/test/configs/nle.yml new file mode 100644 index 0000000..fd787ce --- /dev/null +++ b/test/configs/nle.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'nle' diff --git a/test/configs/poleval.yml b/test/configs/poleval.yml new file mode 100644 index 0000000..7a7e544 --- /dev/null +++ b/test/configs/poleval.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'poleval' diff --git a/test/configs/pw-thesis.yml b/test/configs/pw-thesis.yml new file mode 100644 index 0000000..c64eddd --- /dev/null +++ b/test/configs/pw-thesis.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'pw-thesis' diff --git a/test/configs/sigconf.yml b/test/configs/sigconf.yml new file mode 100644 index 0000000..85fed2d --- /dev/null +++ b/test/configs/sigconf.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'sigconf' diff --git a/test/configs/tacl.yml b/test/configs/tacl.yml new file mode 100644 index 0000000..85619e9 --- /dev/null +++ b/test/configs/tacl.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'tacl' diff --git a/test/configs/vanilla.yml b/test/configs/vanilla.yml new file mode 100644 index 0000000..e1d50d9 --- /dev/null +++ b/test/configs/vanilla.yml @@ -0,0 +1,3 @@ + +default_context: + latex_template: 'vanilla' diff --git a/test/run_tests.sh b/test/run_tests.sh new file mode 100755 index 0000000..fcd0a43 --- /dev/null +++ b/test/run_tests.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -euo pipefail + +PAPER_ID=lorem-ipsum +PAPER_DIR="${PAPER_ID}-paper" + +check() +{ + config_file="$1" + echo "=========================================================================================" + echo "*** TESTING $config_file" + echo "=========================================================================================" + rm -rf "$PAPER_DIR" + cookiecutter https://git.wmi.amu.edu.pl/filipg/paper-cutter.git --config-file "$config_file" --no-input --checkout master + cd "$PAPER_DIR" + make clean + make + if [[ "$config_file" != "configs/pw-thesis.yml" ]] + then + make arxiv-$PAPER_ID.tar.gz + fi + cd .. +} + +for config in configs/*.yml +do + check $config +done diff --git a/{{cookiecutter.paper_repo_name}}/.cookiecutter.yml b/{{cookiecutter.paper_repo_name}}/.cookiecutter.yml new file mode 100644 index 0000000..7d538e4 --- /dev/null +++ b/{{cookiecutter.paper_repo_name}}/.cookiecutter.yml @@ -0,0 +1,18 @@ +default_context: + paper_id: '{{ cookiecutter.paper_id }}' + paper_repo_name: '{{ cookiecutter.paper_repo_name }}' + paper_short_description: '{{ cookiecutter.paper_short_description }}' + paper_title: '{{ cookiecutter.paper_title }}' + gitlab_group: '{{ cookiecutter.gitlab_group }}' + main_contributor: '{{ cookiecutter.main_contributor }}' + main_contributor_name: '{{ cookiecutter.main_contributor_name }}' + latex_template: '{{ cookiecutter.latex_template }}' + git_host: '{{ cookiecutter.git_host }}' + locale: '{{ cookiecutter.locale }}' + with_appendix: '{{ cookiecutter.with_appendix }}' + extra_locale: '{{ cookiecutter.extra_locale }}' + with_arxiv_package: '{{ cookiecutter.with_arxiv_package }}' + discipline: '{{ cookiecutter.discipline }}' + specialization: '{{ cookiecutter.specialization }}' + supervisor: '{{ cookiecutter.supervisor }}' + album_no: '{{ cookiecutter.album_no }}' diff --git a/{{cookiecutter.paper_repo_name}}/.gitignore b/{{cookiecutter.paper_repo_name}}/.gitignore new file mode 100644 index 0000000..5307d8b --- /dev/null +++ b/{{cookiecutter.paper_repo_name}}/.gitignore @@ -0,0 +1,157 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# pycharm configs +.idea + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +#Intellij +vcs.xml + +# data generated by parser +/data + +# autogenerated +/docs/source/reference/ + +# docs output +/docs/build/ + +# Caches +/.cache + +# Emacs +\#*\# +.\#* + +# JetBrains +.idea + +# Temporary +*~ + +*.aux +*.nav +*.toc +*.log +*.out +*.blg +*.bbl +*.synctex.gz +*.fdb_latexmk +*.fls +*.prv +*.lot +*.lof +/auto +{{cookiecutter.paper_id}}.pdf +{{cookiecutter.paper_id}}.zip +autozoil-log.txt +stats.txt +abstract.txt +supplement.zip +the-appendix.pdf +sentences.txt +arxiv-{{cookiecutter.paper_id}}.pdf +arxiv-{{cookiecutter.paper_id}}.tar.gz diff --git a/{{cookiecutter.paper_repo_name}}/.gitlab-ci.yml b/{{cookiecutter.paper_repo_name}}/.gitlab-ci.yml new file mode 100644 index 0000000..4bb5410 --- /dev/null +++ b/{{cookiecutter.paper_repo_name}}/.gitlab-ci.yml @@ -0,0 +1,10 @@ +variables: + PAPER_ID: "{{cookiecutter.paper_id}}" + +# In order to run via `gitlab-runner exec docker ...` locally, +# run `./run-gitlab-runner.sh docker ...`. +# THIS IS AN UGLY WORK-AROUND +include: + - project: 'research/paper-cutter' + ref: '4.0.0' + file: 'main.yml' diff --git a/{{cookiecutter.paper_repo_name}}/ACM-Reference-Format.bst b/{{cookiecutter.paper_repo_name}}/ACM-Reference-Format.bst new file mode 100644 index 0000000..896fad8 --- /dev/null +++ b/{{cookiecutter.paper_repo_name}}/ACM-Reference-Format.bst @@ -0,0 +1,2913 @@ +{% raw %} +%%% -*-BibTeX-*- +%%% ==================================================================== +%%% @BibTeX-style-file{ +%%% author = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray", +%%% version = "2.1", +%%% date = "14 June 2017", +%%% filename = "ACM-Reference-Format.bst", +%%% email = "borisv@lk.net, boris@varphi.com", +%%% codetable = "ISO/ASCII", +%%% keywords = "ACM Transactions bibliography style; BibTeX", +%%% license = "public domain", +%%% supported = "yes", +%%% abstract = "", +%%% } +%%% ==================================================================== + +%%% Revision history: see source in git + +ENTRY + { address + advisor + archiveprefix + author + booktitle + chapter + city + date + edition + editor + eprint + eprinttype + eprintclass + howpublished + institution + journal + key + location + month + note + number + organization + pages + primaryclass + publisher + school + series + title + type + volume + year + % New keys recognized + issue % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra + articleno + eid + day % UTAH: needed for newspapers, weeklies, bi-weeklies + doi % UTAH + url % UTAH + bookpages % UTAH + numpages + lastaccessed % UTAH: used only for @Misc{...} + coden % UTAH + isbn % UTAH + isbn-13 % UTAH + issn % UTAH + lccn % UTAH + } + {} + { label.year extra.label sort.year sort.label basic.label.year} + +INTEGERS { output.state before.all mid.sentence after.sentence after.block } + +INTEGERS { show-isbn-10-and-13 } % initialized below in begin.bib + +INTEGERS { nameptr namesleft numnames } + +INTEGERS { multiresult } + +INTEGERS { len } + +INTEGERS { last.extra.num } + +STRINGS { s t t.org u } + +STRINGS { last.label next.extra } + +STRINGS { p1 p2 p3 page.count } + + +FUNCTION { not } +{ + { #0 } + { #1 } + if$ +} + +FUNCTION { and } +{ + 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION { or } +{ + { pop$ #1 } + 'skip$ + if$ +} + + +FUNCTION { dump.stack.1 } +{ + duplicate$ "STACK[top] = [" swap$ * "]" * warning$ +} + +FUNCTION { dump.stack.2 } +{ + duplicate$ "STACK[top ] = [" swap$ * "]" * warning$ + swap$ + duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$ + swap$ +} + +FUNCTION { empty.or.unknown } +{ + %% Examine the top stack entry, and push 1 if it is empty, or + %% consists only of whitespace, or is a string beginning with two + %% queries (??), and otherwise, push 0. + %% + %% This function provides a replacement for empty$, with the + %% convenient feature that unknown values marked by two leading + %% queries are treated the same as missing values, and thus, do not + %% appear in the output .bbl file, and yet, their presence in .bib + %% file(s) serves to mark values which are temporarily missing, but + %% are expected to be filled in eventually once more data is + %% obtained. The TeX User Group and BibNet bibliography archives + %% make extensive use of this practice. + %% + %% An empty string cannot serve the same purpose, because just as in + %% statistics data processing, an unknown value is not the same as an + %% empty value. + %% + %% At entry: stack = ... top:[string] + %% At exit: stack = ... top:[0 or 1] + + duplicate$ empty$ + { pop$ #1 } + { #1 #2 substring$ "??" = } + if$ +} + +FUNCTION { writeln } +{ + %% In BibTeX style files, the sequences + %% + %% ... "one" "two" output + %% ... "one" "two" output.xxx + %% + %% ship "one" to the output file, possibly following by punctuation, + %% leaving the stack with + %% + %% ... "two" + %% + %% There is thus a one-string lag in output processing that must be + %% carefully handled to avoid duplicating a string in the output + %% file. Unless otherwise noted, all output.xxx functions leave + %% just one new string on the stack, and that model should be born + %% in mind when reading or writing function code. + %% + %% BibTeX's asynchronous buffering of output from strings from the + %% stack is confusing because newline$ bypasses the buffer. It + %% would have been so much easier for newline to be a character + %% rather than a state of the output-in-progress. + %% + %% The documentation in btxhak.dvi is WRONG: it says + %% + %% newline$ Writes onto the bbl file what's accumulated in the + %% output buffer. It writes a blank line if and only + %% if the output buffer is empty. Since write$ does + %% reasonable line breaking, you should use this + %% function only when you want a blank line or an + %% explicit line break. + %% + %% write$ Pops the top (string) literal and writes it on the + %% output buffer (which will result in stuff being + %% written onto the bbl file when the buffer fills + %% up). + %% + %% Examination of the BibTeX source code shows that write$ does + %% indeed behave as claimed, but newline$ sends a newline character + %% directly to the output file, leaving the stack unchanged. The + %% first line "Writes onto ... buffer." is therefore wrong. + %% + %% The original BibTeX style files almost always use "write$ newline$" + %% in that order, so it makes sense to hide that pair in a private + %% function like this one, named after a statement in Pascal, + %% the programming language embedded in the BibTeX Web program. + + write$ % output top-of-stack string + newline$ % immediate write of newline (not via stack) +} + +FUNCTION { init.state.consts } +{ + #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +FUNCTION { output.nonnull } +{ % Stack in: ... R S T Stack out: ... R T File out: S + 's := + output.state mid.sentence = + { + ", " * write$ + } + { + output.state after.block = + { + add.period$ writeln + "\newblock " write$ + } + { + output.state before.all = + { + write$ + } + { + add.period$ " " * write$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION { output.nonnull.dot.space } +{ % Stack in: ... R S T Stack out: ... R T File out: S + 's := + output.state mid.sentence = % { ". " * write$ } + { + ". " * write$ + } + { + output.state after.block = + { + add.period$ writeln "\newblock " write$ + } + { + output.state before.all = + { + write$ + } + { + add.period$ " " * write$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION { output.nonnull.remove } +{ % Stack in: ... R S T Stack out: ... R T File out: S + 's := + output.state mid.sentence = + { + " " * write$ + } + { + output.state after.block = + { + add.period$ writeln "\newblock " write$ + } + { + output.state before.all = + { + write$ + } + { + add.period$ " " * write$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION { output.nonnull.removenospace } +{ % Stack in: ... R S T Stack out: ... R T File out: S + 's := + output.state mid.sentence = + { + "" * write$ + } + { + output.state after.block = + { + add.period$ writeln "\newblock " write$ + } + { + output.state before.all = + { + write$ + } + { + add.period$ " " * write$ + } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + s +} + +FUNCTION { output } +{ % discard top token if empty, else like output.nonnull + duplicate$ empty.or.unknown + 'pop$ + 'output.nonnull + if$ +} + +FUNCTION { output.dot.space } +{ % discard top token if empty, else like output.nonnull.dot.space + duplicate$ empty.or.unknown + 'pop$ + 'output.nonnull.dot.space + if$ +} + +FUNCTION { output.removenospace } +{ % discard top token if empty, else like output.nonnull.removenospace + duplicate$ empty.or.unknown + 'pop$ + 'output.nonnull.removenospace + if$ +} + +FUNCTION { output.check } +{ % like output, but warn if key name on top-of-stack is not set + 't := + duplicate$ empty.or.unknown + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull + if$ +} + +FUNCTION { bibinfo.output.check } +{ % like output.check, adding bibinfo field + 't := + duplicate$ empty.or.unknown + { pop$ "empty " t * " in " * cite$ * warning$ } + { "\bibinfo{" t "}{" * * swap$ * "}" * + output.nonnull } + if$ +} + +FUNCTION { output.check.dot.space } +{ % like output.dot.space, but warn if key name on top-of-stack is not set + 't := + duplicate$ empty.or.unknown + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.dot.space + if$ +} + +FUNCTION { fin.block } +{ % functionally, but not logically, identical to fin.entry + add.period$ + writeln +} + +FUNCTION { fin.entry } +{ + add.period$ + writeln +} + +FUNCTION { new.sentence } +{ % update sentence state, with neither output nor stack change + output.state after.block = + 'skip$ + { + output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION { fin.sentence } +{ + add.period$ + write$ + new.sentence + "" +} + +FUNCTION { new.block } +{ + output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION { output.coden } % UTAH +{ % output non-empty CODEN as one-line sentence (stack untouched) + coden empty.or.unknown + { } + { "\showCODEN{" coden * "}" * writeln } + if$ +} + +FUNCTION { format.articleno } +{ + articleno empty.or.unknown not eid empty.or.unknown not and + { "Both articleno and eid are defined for " cite$ * warning$ } + 'skip$ + if$ + articleno empty.or.unknown eid empty.or.unknown and + { "" } + { + numpages empty.or.unknown + { "articleno or eid field, but no numpages field, in " + cite$ * warning$ } + { } + if$ + eid empty.or.unknown + { "Article \bibinfo{articleno}{" articleno * "}" * } + { "Article \bibinfo{articleno}{" eid * "}" * } + if$ + } + if$ +} + +FUNCTION { format.year } +{ % push year string or "[n.\,d.]" onto output stack + %% Because year is a mandatory field, we always force SOMETHING + %% to be output + "\bibinfo{year}{" + year empty.or.unknown + { "[n.\,d.]" } + { year } + if$ + * "}" * +} + +FUNCTION { format.day.month } +{ % push "day month " or "month " or "" onto output stack + day empty.or.unknown + { + month empty.or.unknown + { "" } + { "\bibinfo{date}{" month * "} " *} + if$ + } + { + month empty.or.unknown + { "" } + { "\bibinfo{date}{" day * " " * month * "} " *} + if$ + } + if$ +} + +FUNCTION { format.day.month.year } % UTAH +{ % if month is empty, push "" else push "(MON.)" or "(DD MON.)" + % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.) + % acm-*.bst addition: prefix parenthesized date string with + % ", Article nnn " + articleno empty.or.unknown eid empty.or.unknown and + { "" } + { output.state after.block = + {", " format.articleno * } + { format.articleno } + if$ + } + if$ + " (" * format.day.month * format.year * ")" * +} + +FUNCTION { output.day.month.year } % UTAH +{ % if month is empty value, do nothing; else output stack top and + % leave with new top string "(MON.)" or "(DD MON.)" + % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.) + format.day.month.year + output.nonnull.remove +} + +FUNCTION { strip.doi } % UTAH +{ % Strip any Web address prefix to recover the bare DOI, leaving the + % result on the output stack, as recommended by CrossRef DOI + % documentation. + % For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to + % "10.1145/1534530.1534545". A suitable URL is later typeset and + % displayed as the LAST item in the reference list entry. Publisher Web + % sites wrap this with a suitable link to a real URL to resolve the DOI, + % and the master https://doi.org/ address is preferred, since publisher- + % specific URLs can disappear in response to economic events. All + % journals are encouraged by the DOI authorities to use that typeset + % format and link procedures for uniformity across all publications that + % include DOIs in reference lists. + % The numeric prefix is guaranteed to start with "10.", so we use + % that as a test. + % 2017-02-04 Added stripping of https:// (Boris) + doi #1 #3 substring$ "10." = + { doi } + { + doi 't := % get modifiable copy of DOI + + % Change https:// to http:// to strip both prefixes (BV) + + t #1 #8 substring$ "https://" = + { "http://" t #9 t text.length$ #8 - substring$ * 't := } + { } + if$ + + t #1 #7 substring$ "http://" = + { + t #8 t text.length$ #7 - substring$ 't := + + "INTERNAL STYLE-FILE ERROR" 's := + + % search for next "/" and assign its suffix to s + + { t text.length$ } + { + t #1 #1 substring$ "/" = + { + % save rest of string as true DOI (should be 10.xxxx/yyyy) + t #2 t text.length$ #1 - substring$ 's := + "" 't := % empty string t terminates the loop + } + { + % discard first character and continue loop: t <= substring(t,2,last) + t #2 t text.length$ #1 - substring$ 't := + } + if$ + } + while$ + + % check for valid DOI (should be 10.xxxx/yyyy) + s #1 #3 substring$ "10." = + { } + { "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ } + if$ + + s % push the stripped DOI on the output stack + + } + { + "unrecognized DOI value [" doi * "]" * warning$ + doi % push the unrecognized original DOI on the output stack + } + if$ + } + if$ +} + +% +% Change by BV: added standard prefix to URL +% +FUNCTION { output.doi } % UTAH +{ % output non-empty DOI as one-line sentence (stack untouched) + doi empty.or.unknown + { } + { + %% Use \urldef here for the same reason it is used in output.url, + %% see output.url for further discussion. + "\urldef\tempurl%" writeln + "\url{https://doi.org/" strip.doi * "}" * writeln + "\showDOI{\tempurl}" writeln + } + if$ +} + +FUNCTION { output.isbn } % UTAH +{ % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched) + show-isbn-10-and-13 + { + %% show both 10- and 13-digit ISBNs + isbn empty.or.unknown + { } + { + "\showISBNx{" isbn * "}" * writeln + } + if$ + isbn-13 empty.or.unknown + { } + { + "\showISBNxiii{" isbn-13 * "}" * writeln + } + if$ + } + { + %% show 10-digit ISBNs only if 13-digit ISBNs not available + isbn-13 empty.or.unknown + { + isbn empty.or.unknown + { } + { + "\showISBNx{" isbn * "}" * writeln + } + if$ + } + { + "\showISBNxiii{" isbn-13 * "}" * writeln + } + if$ + } + if$ +} + +FUNCTION { output.issn } % UTAH +{ % output non-empty ISSN as one-line sentence (stack untouched) + issn empty.or.unknown + { } + { "\showISSN{" issn * "}" * writeln } + if$ +} + +FUNCTION { output.issue } +{ % output non-empty issue number as a one-line sentence (stack untouched) + issue empty.or.unknown + { } + { "Issue " issue * "." * writeln } + if$ +} + +FUNCTION { output.lccn } % UTAH +{ % return with stack untouched + lccn empty.or.unknown + { } + { "\showLCCN{" lccn * "}" * writeln } + if$ +} + +FUNCTION { output.note } % UTAH +{ % return with stack empty + note empty.or.unknown + { } + { "\shownote{" note add.period$ * "}" * writeln } + if$ +} + +FUNCTION { output.note.check } % UTAH +{ % return with stack empty + note empty.or.unknown + { "empty note in " cite$ * warning$ } + { "\shownote{" note add.period$ * "}" * writeln } + if$ +} + +FUNCTION { output.eprint } % +{ % return with stack empty + eprint empty.or.unknown + { } + { "\showeprint" + archiveprefix empty.or.unknown + { eprinttype empty.or.unknown + { } + { "[" eprinttype "]" * * * } + if$ + } + { "[" archiveprefix "l" change.case$ "]" * * * } + if$ + "{" * + primaryclass empty.or.unknown + { eprintclass empty.or.unknown + { } + { eprintclass "/" * * } + if$ + } + { primaryclass "/" * * } + if$ + eprint "}" * * + writeln + } + if$ +} + + +% +% Changes by BV 2011/04/15. Do not output +% url if doi is defined +% +FUNCTION { output.url } % UTAH +{ % return with stack untouched + % output URL and associated lastaccessed fields + doi empty.or.unknown + { + url empty.or.unknown + { } + { + %% Use \urldef, outside \showURL, so that %nn, #, etc in URLs work + %% correctly. Put the actual URL on its own line to reduce the + %% likelihood of BibTeX's nasty line wrapping after column 79. + %% \url{} can undo this, but if that doesn't work for some reason + %% the .bbl file would have to be repaired manually. + "\urldef\tempurl%" writeln + "\url{" url * "}" * writeln + + "\showURL{%" writeln + lastaccessed empty.or.unknown + { "" } + { "Retrieved " lastaccessed * " from " * } + if$ + "\tempurl}" * writeln + } + if$ + } + { } + if$ +} + +FUNCTION { output.year.check } +{ % warn if year empty, output top string and leave " YEAR