Skip to content

Commit

Permalink
infer authority year from docDate for defining treatments
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Sep 27, 2024
1 parent 73df640 commit 2971dcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/gg2rdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ export function gg2rdf(
return { ok: true, uri, tnuri };
}

/** gets the human-readable authroty string for the cTaxon */
/** gets the human-readable authority string for the cTaxon */
function getFullAuthority(
cTaxon: Element,
allow_defining = true,
Expand Down Expand Up @@ -642,6 +642,10 @@ export function gg2rdf(

if (cTaxon.hasAttribute("authorityYear")) {
authority += ", " + cTaxon.getAttribute("authorityYear");
} else if (allow_defining && !/[0-9]/.test(authority)) {
// if this treatment defines this taxon and the authority given contains no year / numbers, infer from docDate
warnings.push(`Using document metadata for authority year`);
authority += ", " + doc.getAttribute("docDate");
}

authority = normalizeAuthority(authority);
Expand Down

0 comments on commit 2971dcc

Please sign in to comment.