@baiyibai-antora/extensions 1.18.5 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.adoc +25 -0
- package/dist/extensions/cite-it/assembly-numbering.d.ts +42 -25
- package/dist/extensions/cite-it/assembly-numbering.d.ts.map +1 -1
- package/dist/extensions/cite-it/assembly-numbering.js +44 -32
- package/dist/extensions/cite-it/assembly-numbering.js.map +1 -1
- package/dist/extensions/cite-it/csl.d.ts +36 -8
- package/dist/extensions/cite-it/csl.d.ts.map +1 -1
- package/dist/extensions/cite-it/csl.js +138 -33
- package/dist/extensions/cite-it/csl.js.map +1 -1
- package/dist/extensions/cite-it/index.d.ts +28 -8
- package/dist/extensions/cite-it/index.d.ts.map +1 -1
- package/dist/extensions/cite-it/index.js +206 -69
- package/dist/extensions/cite-it/index.js.map +1 -1
- package/dist/extensions/cite-it/macro.d.ts +11 -0
- package/dist/extensions/cite-it/macro.d.ts.map +1 -1
- package/dist/extensions/cite-it/macro.js +1 -0
- package/dist/extensions/cite-it/macro.js.map +1 -1
- package/package.json +1 -1
- package/resources/cite-it/author-date.csl +2273 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csl.js","sourceRoot":"","sources":["../../../src/extensions/cite-it/csl.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"csl.js","sourceRoot":"","sources":["../../../src/extensions/cite-it/csl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCH,8CAQC;AAmHD,kDAiCC;AA6HD,8DAkDC;AAhXD,4CAA8B;AAC9B,gDAAkC;AAClC,uCAAkC;AAClC,uCAAgD;AAEhD,2EAA6E;AAE7E,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,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ibTeX/BibLaTeX `.bib` files and
|
|
5
|
-
* generates a categorized bibliography partial.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* generates a categorized bibliography partial. The playbook-wide `style`
|
|
6
|
+
* (below) picks one of two citation-formats, applied identically across
|
|
7
|
+
* ordinary HTML, PDF/Antora Assembler-flattened output, and Confluence/ADF
|
|
8
|
+
* export: `ieee-bracket` (numeric, the default) renders a true
|
|
9
|
+
* first-appearance `[N]` marker, linked to the bibliography row it
|
|
10
|
+
* numbers, everywhere citation numbering historically was a PDF-only
|
|
11
|
+
* concept, since Ruby's own `asciidoctor-pdf` subprocess never loads this
|
|
12
|
+
* package's live macro (see assembly-numbering.ts's own module docblock),
|
|
13
|
+
* so every marker, in every mode, needs the same pre-rewrite-before-parse
|
|
14
|
+
* treatment; `author-date` renders a templated author/year fragment
|
|
15
|
+
* instead (`renderHtmlFallback`, macro.ts), matching how ordinary HTML
|
|
16
|
+
* rendered by default before this design existed. The inline marker and
|
|
17
|
+
* the bibliography entry it points at always share the SAME
|
|
18
|
+
* citation-format: a reader has no way to look an entry up otherwise (a
|
|
19
|
+
* numeric marker needs a numerically ordered list; an author-date marker
|
|
20
|
+
* needs an author-ordered one), which is also why `style` is playbook-wide
|
|
21
|
+
* only, not overridable per component-version.
|
|
10
22
|
*
|
|
11
23
|
* A category is defined entirely by which `.bib` file(s) an entry lives in,
|
|
12
24
|
* never by a data field inside the entry. Each category is an ordered list
|
|
@@ -29,10 +41,16 @@
|
|
|
29
41
|
* component-version at least one category, it is scanned and gets its
|
|
30
42
|
* generated partial(s), whether or not its own antora.yml mentions
|
|
31
43
|
* cite-it at all. `ext.cite_it` in a component-version's antora.yml is
|
|
32
|
-
* purely an OPTIONAL override, the same standing as `enabled`,
|
|
44
|
+
* purely an OPTIONAL override, the same standing as `enabled`,
|
|
33
45
|
* `output_partial`, and `write_to_disk`: present only when a component
|
|
34
46
|
* needs to diverge from the playbook default, never required just to
|
|
35
|
-
* take part.
|
|
47
|
+
* take part. `style` is the one exception: playbook-wide only, never a
|
|
48
|
+
* per-component-version override (a component-version still setting
|
|
49
|
+
* `ext.cite_it.style` warns once, naming the ignored value, rather than
|
|
50
|
+
* silently doing nothing). See the module docblock above for why: the
|
|
51
|
+
* inline marker and the bibliography entry it points at must share one
|
|
52
|
+
* citation-format convention for a reader to look an entry up at all, a
|
|
53
|
+
* constraint that does not hold per-component-version, only site-wide.
|
|
36
54
|
*
|
|
37
55
|
* EARLIER DESIGN, REPLACED: this extension originally required an
|
|
38
56
|
* explicit `ext.cite_it` block, even an empty one, mirroring
|
|
@@ -73,7 +91,9 @@
|
|
|
73
91
|
* - require: '@baiyibai-antora/extensions/cite-it'
|
|
74
92
|
* cite_it:
|
|
75
93
|
* enabled: true
|
|
76
|
-
* #
|
|
94
|
+
* # Playbook-wide only, applied identically to every participating
|
|
95
|
+
* # component-version's HTML, PDF, and Confluence/ADF output alike:
|
|
96
|
+
* # 'ieee-bracket' (numeric, the default) or 'author-date'.
|
|
77
97
|
* style: 'ieee-bracket'
|
|
78
98
|
* # Base filename for each category's own generated partial
|
|
79
99
|
* # (e.g. category "standards" -> generated-bibliography-
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/cite-it/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/cite-it/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqMG;AAwCH,UAAU,iBAAiB;IACzB,YAAY,EAAE,MAA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K,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE;QAAE,cAAc,CAAC,EAAE,cAAc,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IACvG,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IAKhE,YAAY,CAAC,EAAE,MAAM;QACnB,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAC/E,iBAAiB,CAAC,EAAE;YAAE,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,EAAE,GAAG,SAAS,CAAA;SAAE,CAAC;KACtG,CAAC;IACF,YAAY,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;IACrE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC;IACtF,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAoQD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAs0CjE"}
|
|
@@ -3,11 +3,23 @@
|
|
|
3
3
|
* @baiyibai-antora/extensions - cite-it
|
|
4
4
|
*
|
|
5
5
|
* Resolves `cite:[key]` citations against BibTeX/BibLaTeX `.bib` files and
|
|
6
|
-
* generates a categorized bibliography partial.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* generates a categorized bibliography partial. The playbook-wide `style`
|
|
7
|
+
* (below) picks one of two citation-formats, applied identically across
|
|
8
|
+
* ordinary HTML, PDF/Antora Assembler-flattened output, and Confluence/ADF
|
|
9
|
+
* export: `ieee-bracket` (numeric, the default) renders a true
|
|
10
|
+
* first-appearance `[N]` marker, linked to the bibliography row it
|
|
11
|
+
* numbers, everywhere citation numbering historically was a PDF-only
|
|
12
|
+
* concept, since Ruby's own `asciidoctor-pdf` subprocess never loads this
|
|
13
|
+
* package's live macro (see assembly-numbering.ts's own module docblock),
|
|
14
|
+
* so every marker, in every mode, needs the same pre-rewrite-before-parse
|
|
15
|
+
* treatment; `author-date` renders a templated author/year fragment
|
|
16
|
+
* instead (`renderHtmlFallback`, macro.ts), matching how ordinary HTML
|
|
17
|
+
* rendered by default before this design existed. The inline marker and
|
|
18
|
+
* the bibliography entry it points at always share the SAME
|
|
19
|
+
* citation-format: a reader has no way to look an entry up otherwise (a
|
|
20
|
+
* numeric marker needs a numerically ordered list; an author-date marker
|
|
21
|
+
* needs an author-ordered one), which is also why `style` is playbook-wide
|
|
22
|
+
* only, not overridable per component-version.
|
|
11
23
|
*
|
|
12
24
|
* A category is defined entirely by which `.bib` file(s) an entry lives in,
|
|
13
25
|
* never by a data field inside the entry. Each category is an ordered list
|
|
@@ -30,10 +42,16 @@
|
|
|
30
42
|
* component-version at least one category, it is scanned and gets its
|
|
31
43
|
* generated partial(s), whether or not its own antora.yml mentions
|
|
32
44
|
* cite-it at all. `ext.cite_it` in a component-version's antora.yml is
|
|
33
|
-
* purely an OPTIONAL override, the same standing as `enabled`,
|
|
45
|
+
* purely an OPTIONAL override, the same standing as `enabled`,
|
|
34
46
|
* `output_partial`, and `write_to_disk`: present only when a component
|
|
35
47
|
* needs to diverge from the playbook default, never required just to
|
|
36
|
-
* take part.
|
|
48
|
+
* take part. `style` is the one exception: playbook-wide only, never a
|
|
49
|
+
* per-component-version override (a component-version still setting
|
|
50
|
+
* `ext.cite_it.style` warns once, naming the ignored value, rather than
|
|
51
|
+
* silently doing nothing). See the module docblock above for why: the
|
|
52
|
+
* inline marker and the bibliography entry it points at must share one
|
|
53
|
+
* citation-format convention for a reader to look an entry up at all, a
|
|
54
|
+
* constraint that does not hold per-component-version, only site-wide.
|
|
37
55
|
*
|
|
38
56
|
* EARLIER DESIGN, REPLACED: this extension originally required an
|
|
39
57
|
* explicit `ext.cite_it` block, even an empty one, mirroring
|
|
@@ -74,7 +92,9 @@
|
|
|
74
92
|
* - require: '@baiyibai-antora/extensions/cite-it'
|
|
75
93
|
* cite_it:
|
|
76
94
|
* enabled: true
|
|
77
|
-
* #
|
|
95
|
+
* # Playbook-wide only, applied identically to every participating
|
|
96
|
+
* # component-version's HTML, PDF, and Confluence/ADF output alike:
|
|
97
|
+
* # 'ieee-bracket' (numeric, the default) or 'author-date'.
|
|
78
98
|
* style: 'ieee-bracket'
|
|
79
99
|
* # Base filename for each category's own generated partial
|
|
80
100
|
* # (e.g. category "standards" -> generated-bibliography-
|
|
@@ -466,16 +486,6 @@ function register(context) {
|
|
|
466
486
|
// by the time it is actually CALLED, which is guaranteed to be later.
|
|
467
487
|
const citationNumbers = new Map();
|
|
468
488
|
const keyScopesByComp = new Map();
|
|
469
|
-
// Bibliography partials rewritePartialForAssembly has mutated to
|
|
470
|
-
// assembled/PDF `[N]` labels, not yet restored to their ordinary
|
|
471
|
-
// cite:[key] source. Antora's own event lifecycle guarantees every
|
|
472
|
-
// navigationBuilt handler (which drives @antora/assembler, hence this
|
|
473
|
-
// mutation) completes before beforePublish (Confluence export, or any
|
|
474
|
-
// future exporter reading the same shared catalog after assembly)
|
|
475
|
-
// begins, so the very next ordinary, non-assembled loadAsciiDoc call
|
|
476
|
-
// is always the right, and only necessary, moment to sweep these back
|
|
477
|
-
// to source, before whatever reads them next sees stale PDF numbers.
|
|
478
|
-
const pendingAssemblyPartialRestores = [];
|
|
479
489
|
// component@version -> citation key -> the docname of the page hosting
|
|
480
490
|
// that key's own category bibliography, for ORDINARY (non-assembled)
|
|
481
491
|
// HTML output. Computed lazily, once per component-version, the same
|
|
@@ -541,7 +551,22 @@ function register(context) {
|
|
|
541
551
|
loadAsciiDocWrapper = (...args) => {
|
|
542
552
|
const [origFile, catalog, asciidocConfig] = args;
|
|
543
553
|
let file = origFile;
|
|
544
|
-
|
|
554
|
+
// A real assembler build bakes 'loader-assembler' into every
|
|
555
|
+
// assembled document's intrinsic attributes (assemble-content.js);
|
|
556
|
+
// a plain `in` check alone is wrong, though, since AsciiDoc's own
|
|
557
|
+
// convention for "this attribute is unset" is an explicit `false`
|
|
558
|
+
// value, not the key's absence, matching what
|
|
559
|
+
// Document#hasAttribute (macro.ts's own, correct check for the same
|
|
560
|
+
// discriminant) already treats as unset. A toolchain that declares
|
|
561
|
+
// 'loader-assembler' as a default asciidoc.attributes entry, even
|
|
562
|
+
// set to false as a documented placeholder for ifdef::[] elsewhere,
|
|
563
|
+
// satisfied the bare `in` check on every single page load, assembled
|
|
564
|
+
// or not, independent of whether Antora Assembler ever ran at all;
|
|
565
|
+
// confirmed live, reported directly. Checking the actual value keeps
|
|
566
|
+
// this in sync with hasAttribute's real semantics.
|
|
567
|
+
const isAssembled = !!(asciidocConfig?.attributes &&
|
|
568
|
+
'loader-assembler' in asciidocConfig.attributes &&
|
|
569
|
+
asciidocConfig.attributes['loader-assembler'] !== false);
|
|
545
570
|
let restoreForeignPages;
|
|
546
571
|
if (isAssembled && file?.contents && file.src?.component && file.src?.version) {
|
|
547
572
|
const compKey = `${file.src.component}@${file.src.version}`;
|
|
@@ -557,11 +582,18 @@ function register(context) {
|
|
|
557
582
|
// checking the unnamed default profile slot.
|
|
558
583
|
const profileName = asciidocConfig?.attributes?.['assembler-profile'];
|
|
559
584
|
ensureAssemblyDataComputed(compKey, profileName);
|
|
585
|
+
// labelForCompKey resolves to `[N]` (numeric) or the same
|
|
586
|
+
// author/year fallback text ordinary HTML uses (author-date):
|
|
587
|
+
// whichever the active `style` implies, applied here identically
|
|
588
|
+
// to whichever citation-format the ordinary-HTML branch below
|
|
589
|
+
// would have produced for the same key, since PDF has no live JS
|
|
590
|
+
// macro of its own to fall back on (Ruby never loads it, see the
|
|
591
|
+
// module docblock) and needs every marker pre-rewritten either way.
|
|
560
592
|
const numbers = citationNumbers.get(compKey);
|
|
561
593
|
if (numbers && numbers.size > 0) {
|
|
562
594
|
const keyScopes = keyScopesByComp.get(compKey) ?? null;
|
|
563
595
|
const before = file.contents.toString('utf8');
|
|
564
|
-
const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, (
|
|
596
|
+
const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, labelForCompKey(compKey), true, keyScopes);
|
|
565
597
|
if (after !== before) {
|
|
566
598
|
file = Object.assign(Object.create(Object.getPrototypeOf(file)), file, { contents: Buffer.from(after, 'utf8') });
|
|
567
599
|
}
|
|
@@ -569,54 +601,79 @@ function register(context) {
|
|
|
569
601
|
restoreForeignPages = rewriteForeignCitedPages(file.src, profileName);
|
|
570
602
|
}
|
|
571
603
|
else if (!isAssembled && file?.contents && file.src?.component && file.src?.version && file.src?.family === 'page') {
|
|
572
|
-
// Ordinary (non-assembled)
|
|
573
|
-
//
|
|
574
|
-
//
|
|
575
|
-
//
|
|
576
|
-
//
|
|
577
|
-
//
|
|
578
|
-
//
|
|
579
|
-
//
|
|
580
|
-
//
|
|
581
|
-
//
|
|
582
|
-
//
|
|
583
|
-
//
|
|
584
|
-
//
|
|
585
|
-
//
|
|
586
|
-
//
|
|
587
|
-
//
|
|
588
|
-
//
|
|
589
|
-
//
|
|
590
|
-
//
|
|
591
|
-
//
|
|
592
|
-
//
|
|
593
|
-
//
|
|
594
|
-
if (pendingAssemblyPartialRestores.length > 0) {
|
|
595
|
-
for (const restore of pendingAssemblyPartialRestores.splice(0))
|
|
596
|
-
restore();
|
|
597
|
-
}
|
|
604
|
+
// Ordinary (non-assembled) output: HTML, and Confluence/ADF export
|
|
605
|
+
// (beforePublish reads through this same, patched loadAsciiDoc,
|
|
606
|
+
// confirmed in the confluora fix this shares a release history
|
|
607
|
+
// with). The same rewrite-before-parse trick as the PDF/assembled
|
|
608
|
+
// branch above, minus any assembler-profile involvement, so
|
|
609
|
+
// cite:[key] renders as a real link to its bibliography entry
|
|
610
|
+
// instead of always-plain fallback text, whenever that entry's
|
|
611
|
+
// category is hosted somewhere findable in this component-
|
|
612
|
+
// version's own real navigation. The family guard matches
|
|
613
|
+
// rewriteForeignCitedPages's own filter: a category's generated
|
|
614
|
+
// bibliography partial is never independently reachable through
|
|
615
|
+
// loadAsciiDoc (Antora's include processor reads it straight from
|
|
616
|
+
// the catalog, see rewritePartialForAssembly's own docblock), so
|
|
617
|
+
// this branch never fires for it and its own cite:[key] row label
|
|
618
|
+
// converts through the including page's normal, unmodified
|
|
619
|
+
// Asciidoctor parse instead: via registerCiteMacro for
|
|
620
|
+
// author-date (unchanged since before this feature existed), or
|
|
621
|
+
// already rewritten to its final `[N]` text by
|
|
622
|
+
// ensureAssemblyDataComputed/rewritePartialForAssembly for
|
|
623
|
+
// numeric, the same permanent rewrite PDF output already reads
|
|
624
|
+
// (style is playbook-wide, so both consumers want the identical
|
|
625
|
+
// partial content; no restore is needed or possible any more).
|
|
598
626
|
const compKey = `${file.src.component}@${file.src.version}`;
|
|
599
|
-
const data = macro_1.citeCache.get(compKey);
|
|
600
627
|
const before = file.contents.toString('utf8');
|
|
601
628
|
let rewritten;
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
629
|
+
if ((0, csl_1.citationFormatFor)(cfg.style) === 'numeric') {
|
|
630
|
+
// Reuses ensureAssemblyDataComputed/citationNumbers/
|
|
631
|
+
// keyScopesByComp directly, the exact same computation the
|
|
632
|
+
// assembled/PDF branch above uses: real first-appearance
|
|
633
|
+
// numbering shared across HTML and PDF alike is the whole
|
|
634
|
+
// point (a key cited from page to page must carry the same
|
|
635
|
+
// number wherever it is cited, not a fresh per-page count),
|
|
636
|
+
// and this component-version's real navigation is the same
|
|
637
|
+
// navigation source PDF assembly resolves to whenever no
|
|
638
|
+
// custom assembler profile overrides it (the ordinary,
|
|
639
|
+
// overwhelmingly common case; see this function's own
|
|
640
|
+
// docblock for the documented default-profile-only scope
|
|
641
|
+
// limit a custom profile override still carries).
|
|
642
|
+
ensureAssemblyDataComputed(compKey);
|
|
643
|
+
const numbers = citationNumbers.get(compKey);
|
|
644
|
+
if (numbers && numbers.size > 0) {
|
|
645
|
+
const keyScopes = keyScopesByComp.get(compKey) ?? null;
|
|
646
|
+
rewritten = (0, assembly_numbering_1.rewriteCiteMarkers)(before, labelForCompKey(compKey), true, keyScopes);
|
|
647
|
+
}
|
|
606
648
|
}
|
|
607
|
-
else
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
649
|
+
else {
|
|
650
|
+
const data = macro_1.citeCache.get(compKey);
|
|
651
|
+
if (data && data.entriesByKey.size > 0) {
|
|
652
|
+
const scopes = ensureHtmlScopesComputed(compKey);
|
|
653
|
+
if (scopes.size > 0)
|
|
654
|
+
rewritten = (0, assembly_numbering_1.rewriteCiteMarkers)(before, formatHtmlLabels(data), true, scopes);
|
|
655
|
+
}
|
|
656
|
+
else if (keyOwner.size > 0 && before.includes('cite:[')) {
|
|
657
|
+
// This component-version never configured cite-it at all
|
|
658
|
+
// (checkOrphanedCiteUsage's own case): still worth checking
|
|
659
|
+
// whether individual cite:[key] occurrences resolve
|
|
660
|
+
// elsewhere, see resolveForeignCiteLinks's own docblock.
|
|
661
|
+
// Numeric has no equivalent path yet: a foreign, unconfigured
|
|
662
|
+
// page citing a numerically-styled site would need its own
|
|
663
|
+
// number computed from the OWNING component-version's real
|
|
664
|
+
// sequence, not this citing page's, a real gap left for a
|
|
665
|
+
// later change rather than guessed at here.
|
|
666
|
+
const foreign = resolveForeignCiteLinks(before);
|
|
667
|
+
if (foreign)
|
|
668
|
+
rewritten = (0, assembly_numbering_1.rewriteCiteMarkers)(before, (key) => foreign.labels.get(key), true, foreign.scopes);
|
|
669
|
+
}
|
|
615
670
|
}
|
|
616
671
|
if (rewritten !== undefined && rewritten !== before) {
|
|
617
672
|
file = Object.assign(Object.create(Object.getPrototypeOf(file)), file, { contents: Buffer.from(rewritten, 'utf8') });
|
|
618
673
|
}
|
|
619
|
-
restoreForeignPages =
|
|
674
|
+
restoreForeignPages = (0, csl_1.citationFormatFor)(cfg.style) === 'numeric'
|
|
675
|
+
? rewriteForeignCitedPages(file.src)
|
|
676
|
+
: rewriteForeignCitedPagesHtml(file.src);
|
|
620
677
|
}
|
|
621
678
|
// realLoadAsciiDoc is always assigned by this point: this closure is
|
|
622
679
|
// only ever reachable after the synchronous assignment a few lines
|
|
@@ -712,7 +769,23 @@ function register(context) {
|
|
|
712
769
|
continue;
|
|
713
770
|
}
|
|
714
771
|
let files = contentCatalog.getFiles().filter((f) => f.src.component === component && f.src.version === version);
|
|
715
|
-
|
|
772
|
+
// style is a playbook-wide, global setting only, deliberately not
|
|
773
|
+
// per-component-version like every other option here: the inline
|
|
774
|
+
// cite:[key] marker and the bibliography entry it points at must
|
|
775
|
+
// share one citation-format convention (numeric markers need a
|
|
776
|
+
// numerically ordered list to look up; author-date markers need an
|
|
777
|
+
// author-ordered one) for a reader to be able to look an entry up
|
|
778
|
+
// at all, and a component-version citing a foreign page's
|
|
779
|
+
// bibliography (resolveForeignCiteLinks, rewriteForeignCitedPages)
|
|
780
|
+
// has no reliable way to render two different conventions on one
|
|
781
|
+
// page anyway. A component-version still setting ext.cite_it.style
|
|
782
|
+
// (or citeIt.style) locally warns once, naming the ignored value,
|
|
783
|
+
// rather than silently doing nothing: the same "misconfiguration
|
|
784
|
+
// must be visible" standard checkOrphanedCiteUsage already holds
|
|
785
|
+
// this codebase to.
|
|
786
|
+
if (typeof compExt['style'] === 'string') {
|
|
787
|
+
logger.warn(`cite-it: ${compKey} - ext.cite_it.style ("${compExt['style']}") is ignored; style is playbook-wide only as of this version (cite_it.style: "${cfg.style}")`);
|
|
788
|
+
}
|
|
716
789
|
const compOutPartial = typeof compExt['output_partial'] === 'string' ? compExt['output_partial'] : cfg.output_partial;
|
|
717
790
|
const compWriteToDisk = toBool(compExt['write_to_disk'] ?? compExt['writeToDisk'], cfg.write_to_disk);
|
|
718
791
|
const compBlanketPubstate = toBool(compExt['blanket_pubstate'] ?? compExt['blanketPubstate'], cfg.blanket_pubstate);
|
|
@@ -921,13 +994,31 @@ function register(context) {
|
|
|
921
994
|
// actually used (cited, or ref_force), same set the
|
|
922
995
|
// generated partial lists.
|
|
923
996
|
// ---------------------------------------------------------------
|
|
997
|
+
// Row ordering matches the reading convention each citation-format
|
|
998
|
+
// actually implies: a numeric list is looked up by number, an
|
|
999
|
+
// author-date list by author name (see the style docblock above).
|
|
1000
|
+
// The numeric chain's rows are sorted here by citation key only as
|
|
1001
|
+
// a stable, deterministic placeholder: true citation-number order
|
|
1002
|
+
// is not knowable yet (numbers depend on real navigation, resolved
|
|
1003
|
+
// later, see ensureAssemblyDataComputed), and reorderBibliographyRows
|
|
1004
|
+
// re-sorts every row into real number order before anything reads
|
|
1005
|
+
// this partial for real, regardless of this initial order. The
|
|
1006
|
+
// author-date chain has no such second pass, so it is sorted for
|
|
1007
|
+
// real, here, by first-author family/literal name, falling back to
|
|
1008
|
+
// the citation key for an entry with no usable author data (kept
|
|
1009
|
+
// deterministic, not left to depend on Map/Set iteration order).
|
|
1010
|
+
const isNumericStyle = (0, csl_1.citationFormatFor)(cfg.style) === 'numeric';
|
|
1011
|
+
const authorSortKey = (key) => {
|
|
1012
|
+
const names = (0, macro_1.authorDisplayNames)(combinedEntries.get(key) ?? { id: key });
|
|
1013
|
+
return (names[0] ?? key).toLocaleLowerCase();
|
|
1014
|
+
};
|
|
924
1015
|
const refForceKeys = new Set(categories.flatMap((cat) => cat.ref_force));
|
|
925
1016
|
const usedKeysByCategory = new Map();
|
|
926
1017
|
const allUsedKeys = [];
|
|
927
1018
|
for (const cat of categories) {
|
|
928
1019
|
const keys = [...(categoryKeys.get(cat.ref_category) ?? new Set())]
|
|
929
1020
|
.filter((k) => citedKeys.has(k) || refForceKeys.has(k))
|
|
930
|
-
.sort((a, b) => a.localeCompare(b));
|
|
1021
|
+
.sort((a, b) => isNumericStyle ? a.localeCompare(b) : authorSortKey(a).localeCompare(authorSortKey(b)));
|
|
931
1022
|
usedKeysByCategory.set(cat.ref_category, keys);
|
|
932
1023
|
allUsedKeys.push(...keys);
|
|
933
1024
|
}
|
|
@@ -946,7 +1037,7 @@ function register(context) {
|
|
|
946
1037
|
}
|
|
947
1038
|
}
|
|
948
1039
|
}
|
|
949
|
-
const formattedByKey = (0, csl_1.formatBibliographyEntries)(
|
|
1040
|
+
const formattedByKey = (0, csl_1.formatBibliographyEntries)(cfg.style, combinedEntries, allUsedKeys, compBlanketPubstate, compSuperscriptSymbols, compDateFormat);
|
|
950
1041
|
const cacheData = { entriesByKey: combinedEntries, formattedByKey, blanketPubstate: compBlanketPubstate };
|
|
951
1042
|
macro_1.citeCache.set(compKey, cacheData);
|
|
952
1043
|
assemblyScanContexts.set(compKey, {
|
|
@@ -991,6 +1082,19 @@ function register(context) {
|
|
|
991
1082
|
// PDF/assembled numbering. See assembly-numbering.ts's own module
|
|
992
1083
|
// docblock for the full reasoning behind the numbering mechanism itself.
|
|
993
1084
|
//
|
|
1085
|
+
// Despite the name, this is no longer PDF-exclusive: the ordinary-HTML
|
|
1086
|
+
// branch of the wrapper below also calls this (with no profileName,
|
|
1087
|
+
// since an ordinary page load has no assembler profile of its own) for
|
|
1088
|
+
// the `numeric` citation-format, reusing the exact same real
|
|
1089
|
+
// first-appearance numbering and scope resolution, deliberately, so a
|
|
1090
|
+
// key cited from page to page carries the SAME number wherever it
|
|
1091
|
+
// appears (style is playbook-wide, see this function's own callers).
|
|
1092
|
+
// Kept under its original name rather than renamed, to keep this change
|
|
1093
|
+
// reviewable against the function's own long history below; every
|
|
1094
|
+
// comment in this function that says "assembled"/"PDF" describes real,
|
|
1095
|
+
// assembled-specific mechanics (profile-aware navFiles resolution) that
|
|
1096
|
+
// still only ever apply when a profileName is actually passed.
|
|
1097
|
+
//
|
|
994
1098
|
// Computed LAZILY, memoized per component-version, on the first assembled
|
|
995
1099
|
// loadAsciiDoc call the wrapper above sees for that component-version,
|
|
996
1100
|
// rather than eagerly in a navigationBuilt listener as an earlier version
|
|
@@ -1232,18 +1336,51 @@ function register(context) {
|
|
|
1232
1336
|
}
|
|
1233
1337
|
keyScopesByComp.set(compKey, keyScopes);
|
|
1234
1338
|
for (const cat of missingScopeCategories) {
|
|
1235
|
-
logger.warn(`cite-it: ${compKey} - could not find the page that includes category "${cat}"'s generated partial; its
|
|
1339
|
+
logger.warn(`cite-it: ${compKey} - could not find the page that includes category "${cat}"'s generated partial; its citations will render as plain, unlinked text`);
|
|
1236
1340
|
}
|
|
1237
|
-
// The generated bibliography partial's own cite:[key] row labels
|
|
1238
|
-
//
|
|
1239
|
-
//
|
|
1341
|
+
// The generated bibliography partial's own cite:[key] row labels need
|
|
1342
|
+
// rewriting too, and specifically now, before any loadAsciiDoc call
|
|
1343
|
+
// that needs `numbers` resolves an include:: of it: Antora's include
|
|
1240
1344
|
// processor reads an included partial's content directly from the
|
|
1241
1345
|
// catalog, never back through loadAsciiDoc, so the wrapper above never
|
|
1242
1346
|
// gets a chance to touch it otherwise (see rewritePartialForAssembly's
|
|
1243
1347
|
// own docblock for the full story). Safe to do here, synchronously,
|
|
1244
1348
|
// before returning: this function itself is always called from inside
|
|
1245
1349
|
// the wrapper, before that same invocation's real loadAsciiDoc call.
|
|
1246
|
-
|
|
1350
|
+
// Only the `numeric` citation-format needs its rows reordered by real
|
|
1351
|
+
// number (rewritePartialForAssembly's own second parameter): an
|
|
1352
|
+
// author-date partial's rows are already in their final, correct
|
|
1353
|
+
// author-alphabetical order from generation time (index.ts's own
|
|
1354
|
+
// usedKeysByCategory sort), a real ordering unlike citation number,
|
|
1355
|
+
// which is not knowable until this same function resolves it.
|
|
1356
|
+
const format = (0, csl_1.citationFormatFor)(cfg.style);
|
|
1357
|
+
(0, assembly_numbering_1.rewritePartialForAssembly)(scanCtx, numbers, format === 'numeric', labelForCompKey(compKey));
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* The label function `rewriteCiteMarkers` needs for a given
|
|
1361
|
+
* component-version's own data, in whichever shape the active `style`'s
|
|
1362
|
+
* citation-format implies: `numberLabels` (true first-appearance `[N]`,
|
|
1363
|
+
* from `ensureAssemblyDataComputed`'s own `citationNumbers`) for
|
|
1364
|
+
* `numeric`, or `formatHtmlLabels` (the same author/year fallback text
|
|
1365
|
+
* `registerCiteMacro`'s own live rendering already produces, escaped for
|
|
1366
|
+
* embedding as raw source) for `author-date`. One shared function for
|
|
1367
|
+
* every rewrite site, so a citing page's marker and the bibliography
|
|
1368
|
+
* partial's own row label, whichever mode either happens to render
|
|
1369
|
+
* through, always agree on which shape to produce.
|
|
1370
|
+
*
|
|
1371
|
+
* Returns a function that resolves every key to `undefined` (leaving
|
|
1372
|
+
* matched `cite:[key]` occurrences untouched, `rewriteCiteMarkers`'s own
|
|
1373
|
+
* defined behavior) when the needed per-compKey data is not there yet;
|
|
1374
|
+
* never throws, matching every other lookup this codebase treats as
|
|
1375
|
+
* "not resolvable yet", not an error.
|
|
1376
|
+
*/
|
|
1377
|
+
function labelForCompKey(compKey) {
|
|
1378
|
+
if ((0, csl_1.citationFormatFor)(cfg.style) === 'numeric') {
|
|
1379
|
+
const numbers = citationNumbers.get(compKey);
|
|
1380
|
+
return numbers ? (0, assembly_numbering_1.numberLabels)(numbers) : () => undefined;
|
|
1381
|
+
}
|
|
1382
|
+
const data = macro_1.citeCache.get(compKey);
|
|
1383
|
+
return data ? formatHtmlLabels(data) : () => undefined;
|
|
1247
1384
|
}
|
|
1248
1385
|
/**
|
|
1249
1386
|
* The ordinary-HTML counterpart to ensureAssemblyDataComputed above:
|
|
@@ -1488,7 +1625,7 @@ function register(context) {
|
|
|
1488
1625
|
}
|
|
1489
1626
|
}
|
|
1490
1627
|
}
|
|
1491
|
-
const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, (
|
|
1628
|
+
const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, labelForCompKey(compKey), true, scopes);
|
|
1492
1629
|
if (after === before)
|
|
1493
1630
|
continue;
|
|
1494
1631
|
holder.contents = Buffer.from(after, 'utf8');
|