-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8f702e
commit 6c7c285
Showing
3 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Help text | ||
|
||
description="A bash script for compiling JOSS and JOSE papers locally"; | ||
|
||
doc="compile [-j <journal>] [-d <doi>] [-v <volume>] [-i <issue>] [-p <page>] | ||
[-s <submitted>] [-u <published>] [-r <review>] [-g <repository>] [-a <archive>] FILE | ||
Compile a markdown FILE to a JOSS or JOSE paper. | ||
Options: | ||
-j JOURNAL The journal the paper is being compiled for, either joss or jose, defaults to joss. | ||
-d DOI The DOI of the submitted paper, defaults to an empty string. | ||
-v VOLUME The journal volume the paper was published in, defaults to an empty string. | ||
-i ISSUE The journal issue the paper was published in, defaults to an empty string. | ||
-p PAGE The journal issue page the paper was published in, defaults to an empty string. | ||
-s SUBMITTED The date the paper was submitted, defaults to an empty string. | ||
-u PUBLISHED The date the paper was published, defaults to an empty string. | ||
-r REVIEW The review issue URL, defaults to an empty string. | ||
-g REPOSITORY The URL of the code repository, defaults to an empty string. | ||
-a ARCHIVE The DOI of the code archive, defaults to an empty string. | ||
-h Displays this help text and exit." | ||
|
||
# Default arguments | ||
|
||
journal="joss" | ||
doi="10.5281/zenodo.2587158" | ||
volume="" | ||
issue="" | ||
page="" | ||
submitted="" | ||
published="" | ||
review="" | ||
repository="https://github.com/GeoStat-Framework/pentapy" | ||
|
||
# Get command line arguments | ||
|
||
while getopts ":j:d:v:i:p:s:u:r:g:a:h" opt; do | ||
case $opt in | ||
j) | ||
journal=$OPTARG;; | ||
d) | ||
doi=$OPTARG;; | ||
v) | ||
volume=$OPTARG;; | ||
i) | ||
issue=$OPTARG;; | ||
p) | ||
page=$OPTARG;; | ||
s) | ||
submitted=$OPTARG;; | ||
u) | ||
published=$OPTARG;; | ||
r) | ||
review=$OPTARG;; | ||
g) | ||
repository=$OPTARG;; | ||
a) | ||
archive=$OPTARG;; | ||
h) | ||
echo $description; | ||
echo; | ||
echo "$doc"; | ||
exit 0;; | ||
\?) | ||
echo "Invalid option: -$OPTARG."; | ||
echo; | ||
echo "$doc"; | ||
exit 1;; | ||
:) | ||
echo "Option -$OPTARG requires an argument."; | ||
echo; | ||
echo "$doc"; | ||
exit 1;; | ||
esac; | ||
done; | ||
|
||
paper=${@:$OPTIND:1} | ||
|
||
if [ ! "$paper" ]; then | ||
echo "FILE not specified." | ||
echo; | ||
echo "$doc" | ||
exit 1; | ||
fi; | ||
|
||
# Check if pandoc and pandoc-citeproc are installed | ||
|
||
missing="" | ||
|
||
if [ ! "$(which pandoc)" ]; then | ||
missing="$missing pandoc"; | ||
fi; | ||
|
||
if [ ! "$(which pandoc-citeproc)" ]; then | ||
missing="$missing pandoc-citeproc"; | ||
fi; | ||
|
||
if [ ! "$(which xelatex)" ]; then | ||
missing="$missing xelatex"; | ||
fi; | ||
|
||
if [ "$missing" ]; then | ||
if [ $(echo "$missing" | wc -w) -eq 2 ]; then | ||
echo "Please install $(echo $missing | sed 's/ / and /')."; | ||
else | ||
echo "Please install $(echo $missing | sed 's/ /, /g' | sed 's/\(.*\) /\1 and /')."; | ||
fi; | ||
exit 1; | ||
fi; | ||
|
||
# Set journal specific variables | ||
|
||
outfile="${paper%.md}.pdf" | ||
logo="${journal}-logo.png" | ||
templateurl="https://raw.githubusercontent.com/openjournals/whedon/master/resources/latex.template" | ||
cslurl="https://raw.githubusercontent.com/openjournals/whedon/master/resources/apa.csl" | ||
logourl="https://github.com/openjournals/whedon/raw/master/resources/${journal}-logo.png" | ||
|
||
# Set journal full name | ||
|
||
if [ $journal == "joss" ]; then | ||
journalname="Journal of Open Source Software"; | ||
else | ||
journalname="Journal of Open Source Education"; | ||
fi; | ||
|
||
# Download logo and latex template files | ||
|
||
if [ ! -f latex.template ]; then | ||
wget "$templateurl"; | ||
fi; | ||
|
||
if [ ! -f apa.csl ]; then | ||
wget "$cslurl"; | ||
fi; | ||
|
||
if [ ! -f $logo ]; then | ||
wget "$logourl"; | ||
fi; | ||
|
||
# Collect necessary paper metadata | ||
|
||
year=$(grep "date: " $paper | cut -d " " -f 4 -) | ||
bib=$(grep "bibliography: " $paper | cut -d " " -f 2 -) | ||
|
||
title=$( \ | ||
grep "title: " $paper | \ | ||
cut -d " " -f 2- - | \ | ||
sed 's/^"\(.*\)"$/\1/' | \ | ||
sed "s/^'\(.*\)'$/\1/") | ||
|
||
name=$(grep -m 1 "name: " $paper | rev | cut -d " " -f 1 - | rev) | ||
|
||
# Compile the paper | ||
|
||
pandoc \ | ||
--filter pandoc-citeproc \ | ||
--bibliography=$bib \ | ||
--template=latex.template \ | ||
-V logo_path=$logo \ | ||
-V citation_author=$name \ | ||
-V year=$year \ | ||
-V footnote_paper_title="$title" \ | ||
-V journal_name="$journalname" \ | ||
-V formatted_doi="$doi" \ | ||
-V archive_doi="https://doi.org/$archive" \ | ||
-V review_issue_url=$review \ | ||
-V repository=$repository \ | ||
-V submitted=$submitted \ | ||
-V published=$published \ | ||
-V issue=$issue \ | ||
-V volume=$volume \ | ||
-V page=$page \ | ||
-V graphics=true \ | ||
--latex-engine=xelatex \ | ||
--from markdown+autolink_bare_uris \ | ||
--csl=apa.csl \ | ||
-s $paper \ | ||
-o $outfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@misc{zenodo, | ||
author = {Sebastian Müller}, | ||
title = {ogs5py}, | ||
month = aug, | ||
year = 2019, | ||
doi = {10.5281/zenodo.2546767}, | ||
url = {https://doi.org/10.5281/zenodo.2546767} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
title: 'ogs5py: A Python-API for the OpenGeoSys 5 scientific modeling package' | ||
tags: | ||
- Python | ||
- numerics | ||
- linear equation systems | ||
- pentadiagonal matrices | ||
- pentadiagonal systems | ||
authors: | ||
- name: Sebastian Müller | ||
orcid: 0000-0001-9060-4008 | ||
affiliation: "1, 2" | ||
- name: Falk Heße | ||
orcid: 0000-0002-2547-8102 | ||
affiliation: "1, 2" | ||
affiliations: | ||
- name: Department of Computational Hydrosystems, UFZ -- Helmholtz Centre for Environmental Research, Leipzig, Germany | ||
index: 1 | ||
- name: Institute of Earth and Environmental Sciences, University Potsdam, Potsdam, Germany | ||
index: 2 | ||
date: 28 June 2019 | ||
bibliography: paper.bib | ||
--- | ||
|
||
# Summary | ||
|
||
The source code for ``ogs5py`` has been archived to Zenodo with the linked DOI: [@zenodo] | ||
|
||
# Acknowledgements | ||
|
||
Sebastian Müller: | ||
I acknowledge the supervision by Prof. Sabine Attinger, Prof. Alraune Zech, | ||
Prof. Peter Dietrich and Dr. Falk Heße and herewith want to thank them for | ||
their trust and support. | ||
I also want to thank Dr. Lennart Schüler for his constant help and the | ||
pleasant partnership during the work on the GeoStat Framwork. | ||
This research was funded by the German Federal Environmental Foundation. | ||
|
||
Falk Heße: | ||
|
||
# References |