Updated the authors format in readings.
This commit is contained in:
parent
012317b5c8
commit
f18479d6af
11 changed files with 352 additions and 339 deletions
|
|
@ -17,9 +17,20 @@ function plugins (helpers) {
|
|||
40: 'Théâtre'
|
||||
})
|
||||
|
||||
function normalizeAuthorName (author) {
|
||||
if (author.length > 1) {
|
||||
return author[1] + ' ' + author[0]
|
||||
} else {
|
||||
return author[0]
|
||||
}
|
||||
}
|
||||
|
||||
function getBibAuthors (book) {
|
||||
// TODO: books should have list of authors
|
||||
const authors = book.a
|
||||
let authors = ''
|
||||
book.a.forEach((a, i) => {
|
||||
if (i > 0) { authors += ', ' }
|
||||
authors += normalizeAuthorName(a)
|
||||
})
|
||||
|
||||
return authors
|
||||
}
|
||||
|
|
@ -145,10 +156,13 @@ function plugins (helpers) {
|
|||
let body = '# Auteurs\n'
|
||||
|
||||
metalsmith.metadata().books.forEach(book => {
|
||||
if (authors[book.a] == null) {
|
||||
authors[book.a] = []
|
||||
}
|
||||
authors[book.a].push(book)
|
||||
book.a.forEach((a) => {
|
||||
const name = normalizeAuthorName(a)
|
||||
if (authors[name] == null) {
|
||||
authors[name] = []
|
||||
}
|
||||
authors[name].push(book)
|
||||
})
|
||||
})
|
||||
|
||||
Object.keys(authors).sort().forEach(author => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue