commit cb1342b72d84d63c673ac6cd79436064d7a8ce33 parent 30104363dc89091177601d11eef0fd5baced83fe Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Wed, 9 Sep 2020 07:37:54 +0200 Detect The Cryosphere (Discussion) from DOI links Diffstat:
M | .local/bin/plumb | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/.local/bin/plumb b/.local/bin/plumb @@ -166,6 +166,14 @@ handle_url() { *scholar.google.*) t="$(printf '%s' "$t" | \ sed 's/.*scholar_url?url\=//;s/&hl\=.*//')";; + https://doi.org/10.5194/tc-*) + nf="$(printf %s "$t" | awk -F- '{print NF}')" + h="https://tc.copernicus.org" + if [ "$nf" -eq 4 ]; then + t="$(printf '%s' "$t" | awk -F- -v h="$h" '{print h"/articles/"$2"/"$3"/"$4"/tc-"$2"-"$3"-"$4".pdf"}')" + elif [ "$nf" -eq 3 ]; then + t="$(printf '%s' "$t" | awk -F- -v h="$h" '{print h"/preprints/tc-"$2"-"$3"/tc-"$2"-"$3".pdf"}')" + fi;; *the-cryosphere-discuss.net/tc-*/) a="$(printf '%s' "$t" | \ sed 's/.*\(tc-[0-9]*-[0-9]*\).*/\1/')"