site/node_modules/rehype-citation/dist/browser/generator.mjs.map

1 line
50 KiB
Plaintext
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
{"version":3,"file":"generator.mjs","sources":["../../src/regex.js","../../src/parse-citation.js","../../src/utils.js","../../src/html-transform-browser.js","../../src/generator.js","../../src/gen-citation.js","../../src/gen-biblio.js","../../src/gen-footnote.js"],"sourcesContent":["// Regex adapted from https://github.com/Zettlr/Zettlr/blob/develop/source/common/util/extract-citations.ts\n\n/**\n * Citation detection: The first alternative matches \"full\" citations surrounded\n * by square brackets, whereas the second one matches in-text citations,\n * optionally with suffixes.\n *\n * * Group 1 matches regular \"full\" citations\n * * Group 2 matches in-text citations (not surrounded by brackets)\n * * Group 3 matches optional square-brackets suffixes to group 2 matches\n *\n * For more information, see https://pandoc.org/MANUAL.html#extension-citations\n *\n * @var {RegExp}\n */\nexport const citationRE =\n /(?:\\[([^[\\]]*@[^[\\]]+)\\])|(?<=\\s|^|(-))(?:@([\\p{L}\\d_][^\\s]*[\\p{L}\\d_]|\\{.+\\})(?:\\s+\\[(.*?)\\])?)/u\n\n/**\n * I hate everything at this. This can match every single possible variation on\n * whatever the f*** you can possibly do within square brackets according to the\n * documentation. I opted for named groups for these because otherwise I have no\n * idea what I have been doing here.\n *\n * * Group prefix: Contains the prefix, ends with a dash if we should suppress the author\n * * Group citekey: Contains the actual citekey, can be surrounded in curly brackets\n * * Group explicitLocator: Contains an explicit locator statement. If given, we MUST ignore any form of locator in the suffix\n * * Group explicitLocatorInSuffix: Same as above, but not concatenated to the citekey\n * * Group suffix: Contains the suffix, but may start with a locator (if explicitLocator and explicitLocatorInSuffix are not given)\n *\n * @var {RegExp}\n */\nexport const fullCitationRE =\n /(?<prefix>.+)?(?:@(?<citekey>[\\p{L}\\d_][^\\s{]*[\\p{L}\\d_]|\\{.+\\}))(?:\\{(?<explicitLocator>.*)\\})?(?:,\\s+(?:\\{(?<explicitLocatorInSuffix>.*)\\})?(?<suffix>.*))?/u\n\n/**\n * This regular expression matches locator ranges, like the following:\n *\n * * 23-45, and further (here it matches up to, not including the comma)\n * * 45\n * * 15423\n * * 14235-12532\n * * 12-34, 23, 56\n * * 12, 23-14, 23\n * * 12, 54, 12-23\n * * 1, 1-4\n * * 3\n * * NEW NEW NEW: Now also matches Roman numerals as sometimes used in forewords!\n *\n * @var {RegExp}\n */\nexport const locatorRE = /^(?:[\\d, -]*\\d|[ivxlcdm, -]*[ivxlcdm])/i\n","/**\n * @typedef {import('./types').CiteItem} CiteItem\n * @typedef {import('./types').CiteItemSuffix} CiteItemSuffix\n */\n\nimport { fullCitationRE, locatorRE } from './regex.js'\n\n/**\n * The locatorLabels have been sourced from the Citr library. Basically it's just\n * a map with valid CSL locator labels and an array of possible natural labels\n * which a user might want to write (instead of the standardized labels).\n *\n * @var {{ [key: string]: string[] }}}\n */\nconst locatorLabels = {\n book: ['Buch', 'Bücher', 'B.', 'book', 'books', 'bk.', 'bks.', 'livre', 'livres', 'liv.'],\n chapter: ['Kapitel', 'Kap.', 'chapter', 'chapters', 'chap.', 'chaps', 'chapitre', 'chapitres'],\n column: ['Spalte', 'Spalten', 'Sp.', 'column', 'columns', 'col.', 'cols', 'colonne', 'colonnes'],\n figure: ['Abbildung', 'Abbildungen', 'Abb.', 'figure', 'figures', 'fig.', 'figs'],\n folio: ['Blatt', 'Blätter', 'Fol.', 'folio', 'folios', 'fol.', 'fols', 'fᵒ', 'fᵒˢ'],\n issue: [\n 'Nummer',\n 'Nummern',\n 'Nr.',\n 'number',\n 'numbers',\n 'no.',\n 'nos.',\n 'numéro',\n 'numéros',\n 'nᵒ',\n 'nᵒˢ',\n ],\n line: ['Zeile', 'Zeilen', 'Z', 'line', 'lines', 'l.', 'll.', 'ligne', 'lignes'],\n note: ['Note', 'Noten', 'N.', 'note', 'notes', 'n.', 'nn.'],\n opus: ['Opus', 'Opera', 'op.', 'opus', 'opera', 'opp.'],\n page: ['Seite', 'Seiten', 'S.', 'page', 'pages', 'p.', 'pp.'],\n paragraph: [\n 'Absatz',\n 'Absätze',\n 'Abs.',\n '¶',\n '¶¶',\n 'paragraph',\n 'par