Commit 2f8a4803 authored by User expired's avatar User expired
Browse files

Never keep dashes in the 4 journal letters

parent b841d81b
Pipeline #28117 passed with stage
in 1 minute and 39 seconds
......@@ -210,9 +210,9 @@ function updatekeys() { # updatekeys bibfile skipj bibfile [letter]
gsub("[^" ALLOWED_CHARS "]", "", journal)
gsub("[^" ALLOWED_CHARS "]", "", year)
# Merge dashes.
# Merge or remove dashes.
gsub("---*", "-", fauthor)
gsub("---*", "-", journal)
gsub("-", "", journal)
# Create citation key (journal: maximum four lower case letters).
citekey = fauthor year letter ":" tolower(substr(journal,1,4))
......
......@@ -118,9 +118,9 @@ do
letter="${letter#:}" # Remove preceding colon.
fi
# Only keep allowed characters and merge dashes.
# Only keep allowed characters and merge or remove dashes.
fauthor=$(sed "s/[^$ALLOWED_CHARS]//g;s/---*/-/g" <<< "$fauthor")
journal=$(sed "s/[^$ALLOWED_CHARS]//g;s/---*/-/g" <<< "$journal")
journal=$(sed "s/[^$ALLOWED_CHARS]//g;s/-//g" <<< "$journal")
# Keep only the first four letters for the journal.
journal=$(echo "$journal" | sed 's/^\(....\).*/\1/')
......
......@@ -121,15 +121,15 @@ testJournalUmlaute() {
testJournalDashes() {
echo -e '@Article{,\nJournal = {Unknown-Journal},' > $fileOne
assertEquals ':u-j' "$(bib-keyinsert $fileOne | getkey)"
assertEquals ':uj' "$(bib-keyinsert $fileOne | getkey)"
echo -e '@Article{,\nJournal = {Unknown -- Journal},' > $fileOne
assertEquals ':u-j' "$(bib-keyinsert $fileOne | getkey)"
assertEquals ':uj' "$(bib-keyinsert $fileOne | getkey)"
echo -e '@Articl{,\nJournal = {Unknown – Journal},' > $fileOne
assertEquals ':u-j' "$(bib-keyinsert $fileOne | getkey)"
assertEquals ':uj' "$(bib-keyinsert $fileOne | getkey)"
echo -e '@Article{,\nJournal = {Unknown — Journal},' > $fileOne
assertEquals ':u-j' "$(bib-keyinsert $fileOne | getkey)"
assertEquals ':uj' "$(bib-keyinsert $fileOne | getkey)"
echo -e '@Article{,\nJournal = {Unknown---Journal},' > $fileOne
assertEquals ':u-j' "$(bib-keyinsert $fileOne | getkey)"
assertEquals ':uj' "$(bib-keyinsert $fileOne | getkey)"
}
testFirstAuthorName() {
......
......@@ -94,15 +94,15 @@ testJournalUmlaute() {
testJournalDashes() {
echo -e '@Article{,\nJournal = {Unknown-Journal},' > $fileOne
assertEquals '__U-J' "$(bib-name -n $fileOne | getname)"
assertEquals '__UJ' "$(bib-name -n $fileOne | getname)"
echo -e '@Article{,\nJournal = {Unknown -- Journal},' > $fileOne
assertEquals '__U-J' "$(bib-name -n $fileOne | getname)"
assertEquals '__UJ' "$(bib-name -n $fileOne | getname)"
echo -e '@Articl{,\nJournal = {Unknown – Journal},' > $fileOne
assertEquals '__U-J' "$(bib-name -n $fileOne | getname)"
assertEquals '__UJ' "$(bib-name -n $fileOne | getname)"
echo -e '@Article{,\nJournal = {Unknown — Journal},' > $fileOne
assertEquals '__U-J' "$(bib-name -n $fileOne | getname)"
assertEquals '__UJ' "$(bib-name -n $fileOne | getname)"
echo -e '@Article{,\nJournal = {Unknown---Journal},' > $fileOne
assertEquals '__U-J' "$(bib-name -n $fileOne | getname)"
assertEquals '__UJ' "$(bib-name -n $fileOne | getname)"
}
testFirstAuthorName() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment