Skip to content

Commit

Permalink
Fix missing citation format
Browse files Browse the repository at this point in the history
  • Loading branch information
zepinglee committed Nov 23, 2024
1 parent 3d93eda commit 9455ebf
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/utils/citeproc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,22 @@ export function getRefTemplate(cslXml: CslXml) {
}

export function getField(cslXml: CslXml) {
return cslXml
.getNodesByName(cslXml.dataObj, "category")
.filter((node) => "field" in node.attrs)[0]?.attrs["field"];
return (
cslXml
.getNodesByName(cslXml.dataObj, "category")
.filter((node) => "field" in node.attrs)[0]?.attrs["field"] ??
"generic-base"
);
}

export function getCitationFormat(cslXml: CslXml) {
return cslXml
.getNodesByName(cslXml.dataObj, "category")
.filter((node) => "citation-format" in node.attrs)[0]?.attrs[
"citation-format"
];
return (
cslXml
.getNodesByName(cslXml.dataObj, "category")
.filter((node) => "citation-format" in node.attrs)[0]?.attrs[
"citation-format"
] ?? "numeric"
);
}

export function getSummary(cslXml: CslXml): string {
Expand Down

0 comments on commit 9455ebf

Please sign in to comment.