Skip to content

Commit 448e41a

Browse files
committed
Properly deal with the fact that parsed names might be nil
1 parent a692569 commit 448e41a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/resources/filters/common/authors.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,18 @@ function normalizeName(name)
528528
if name[kLiteralName] then
529529
local parsedName = bibtexParseName(name)
530530
if type(parsedName) == 'table' then
531-
name[kGivenName] = {pandoc.Str(parsedName.given)}
532-
name[kFamilyName] = {pandoc.Str(parsedName.family)}
533-
name[kDroppingParticle] = parsedName[kDroppingParticle]
534-
name[kNonDroppingParticle] = parsedName[kNonDroppingParticle]
531+
if parsedName.given ~= nil then
532+
name[kGivenName] = {pandoc.Str(parsedName.given)}
533+
end
534+
if parsedName.family ~= nil then
535+
name[kFamilyName] = {pandoc.Str(parsedName.family)}
536+
end
537+
if name[kDroppingParticle] ~= nil then
538+
name[kDroppingParticle] = parsedName[kDroppingParticle]
539+
end
540+
if name[kNonDroppingParticle] ~= nil then
541+
name[kNonDroppingParticle] = parsedName[kNonDroppingParticle]
542+
end
535543
else
536544
if #name[kLiteralName] > 1 then
537545
-- bibtex parsing failed, just split on space

0 commit comments

Comments
 (0)