Skip to content

Commit b9f9cfa

Browse files
committed
move another sort key fun
1 parent a082fd9 commit b9f9cfa

File tree

2 files changed

+35
-18
lines changed

2 files changed

+35
-18
lines changed

R/05makeBibLatex.R

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,6 @@ MakeBibLaTeX <- function(docstyle = "text", authortitle = FALSE) {
7777
addPeriod(res)
7878
}
7979

80-
sortKeysV <- function(bib){
81-
result <- numeric(length(bib))
82-
for (i in seq_along(bib)){
83-
res <- bib[[i]]$volume
84-
if (!length(res)){
85-
res <- "0000"
86-
}else{
87-
tmp <- suppressWarnings(as.numeric(res))
88-
res <- if (!is.na(tmp))
89-
sprintf("%04d", tmp)
90-
else res
91-
}
92-
result[i] <- res
93-
}
94-
result
95-
}
96-
9780
#####################################################################################
9881
## FIELDS:
9982
#####################################################################################

R/CommonFormatFuns.R

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,23 @@ GetFormatFunctions <- function(docstyle = "text", DateFormatter){
494494
}
495495
result
496496
}
497+
498+
sortKeysV <- function(bib){
499+
result <- numeric(length(bib))
500+
for (i in seq_along(bib)){
501+
res <- bib[[i]]$volume
502+
if (!length(res)){
503+
res <- "0000"
504+
}else{
505+
tmp <- suppressWarnings(as.numeric(res))
506+
res <- if (!is.na(tmp))
507+
sprintf("%04d", tmp)
508+
else res
509+
}
510+
result[i] <- res
511+
}
512+
result
513+
}
497514

498515
sortKeysLA <- function(bib, yrs){
499516
result <- character(length(bib))
@@ -545,6 +562,23 @@ GetFormatFunctions <- function(docstyle = "text", DateFormatter){
545562
res
546563
}
547564
}
548-
565+
566+
GetLastNames <- function(bib){
567+
result <- character(length(bib))
568+
for (i in seq_along(bib)) {
569+
authors <- paste0(unlist(bib[[i]]$author$family), collapse = '')
570+
if (authors == "")
571+
authors <- paste0(unlist(bib[[i]]$editor$family), collapse = '')
572+
if (authors == "")
573+
authors <- paste0(unlist(bib[[i]]$translator$family), collapse = '')
574+
if (authors == "")
575+
authors <- cleanupLatex(bib[[i]]$title)
576+
if (!length(authors))
577+
authors <- ""
578+
result[i] <- authors
579+
}
580+
result
581+
}
582+
549583
environment()
550584
}

0 commit comments

Comments
 (0)