Skip to content

Commit

Permalink
remove page range from authority
Browse files Browse the repository at this point in the history
  • Loading branch information
nleanba committed Mar 18, 2024
1 parent d45c0f9 commit 5533edf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gg2rdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,15 @@ export function gg2rdf(
function normalizeAuthority(a: string): string {
if (!a) return "";
let result = normalizeSpace(a).replace(
/\s*,?\s*(\(?[0-9]{4}\)?)\s*[a-z]*\s*:\s*[0-9]*\s*[a-z]*\s*(\)?)\s*$/,
/\s*,?\s*(\(?[0-9]{4}\)?)\s*[a-z]*\s*:?(?:\s*[0-9]*\s*[a-z-]*\s*,?)*(\)?)\s*$/,
", $1$2",
).replace(/\)\)$/, ")").replace(/^\s*[,:;]+\s*/, "");
).replace(
/\)\)$/,
")",
).replace(
/^\s*[,:;]+\s*/,
"",
);
if (result.lastIndexOf("(") > result.lastIndexOf(")")) {
result += ")"; // sometimes closing brace is missing
}
Expand Down

0 comments on commit 5533edf

Please sign in to comment.