Skip to content

Commit

Permalink
Bibliography: Make citation keys case-insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Jun 10, 2023
1 parent 6a8d3cb commit a7a4105
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/common/reference_manager.F
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
MODULE reference_manager
USE kinds, ONLY: default_string_length
USE message_passing, ONLY: mp_para_env_type
USE string_utilities, ONLY: uppercase
USE util, ONLY: sort
#include "../base/base_uses.f90"

Expand Down Expand Up @@ -133,7 +134,7 @@ SUBROUTINE add_reference(key, ISI_record, DOI)
CHARACTER(LEN=*), INTENT(IN) :: DOI

CHARACTER :: tmp
CHARACTER(LEN=ISI_length) :: author, citation_key, year
CHARACTER(LEN=ISI_length) :: author, citation_key, key_a, key_b, year
INTEGER :: commaloc, i, ires, line, match, mylen, &
nlines

Expand Down Expand Up @@ -176,11 +177,15 @@ SUBROUTINE add_reference(key, ISI_record, DOI)
END DO
citation_key(ires + 1:) = ""

! avoid duplicates, search through the list for matches
! avoid duplicates, search through the list for matches (case-insensitive)
mylen = LEN_TRIM(citation_key)
key_a = citation_key(1:mylen)
CALL uppercase(key_a)
match = 0
DO I = 1, nbib - 1
IF (thebib(I)%ref%citation_key(1:mylen) == citation_key(1:mylen)) match = match + 1
key_b = thebib(I)%ref%citation_key(1:mylen)
CALL uppercase(key_b)
IF (key_a == key_b) match = match + 1
END DO
IF (match > 0) citation_key = citation_key(1:mylen)//CHAR(ICHAR('a') + match)

Expand Down

0 comments on commit a7a4105

Please sign in to comment.