@baiyibai-antora/extensions 1.18.4 → 1.19.0

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.
@@ -2,11 +2,23 @@
2
2
  * @baiyibai-antora/extensions - cite-it
3
3
  *
4
4
  * Resolves `cite:[key]` citations against BibTeX/BibLaTeX `.bib` files and
5
- * generates a categorized bibliography partial. Numbering is a PDF/Antora
6
- * Assembler-flattened-output concept only; ordinary, non-assembled HTML
7
- * citations render a templated author/year fragment instead, carrying no
8
- * number. See macro.ts and assembly-numbering.ts for the two rendering
9
- * paths this splits into.
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`, `style`,
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
- * # Only 'ieee-bracket' is bundled and supported in this version.
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiLG;AAuCH,UAAU,iBAAiB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAaD,UAAU,YAAY;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK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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. Numbering is a PDF/Antora
7
- * Assembler-flattened-output concept only; ordinary, non-assembled HTML
8
- * citations render a templated author/year fragment instead, carrying no
9
- * number. See macro.ts and assembly-numbering.ts for the two rendering
10
- * paths this splits into.
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`, `style`,
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
- * # Only 'ieee-bracket' is bundled and supported in this version.
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-
@@ -188,6 +208,7 @@ const registry_1 = require("./registry");
188
208
  const csl_1 = require("./csl");
189
209
  const macro_1 = require("./macro");
190
210
  const assembly_numbering_1 = require("./assembly-numbering");
211
+ const asciidoc_replacements_1 = require("../../lib/asciidoc-replacements");
191
212
  // ---------------------------------------------------------------------------
192
213
  // Logging helpers (mirrors trademark-it/autoterm style)
193
214
  // ---------------------------------------------------------------------------
@@ -465,16 +486,6 @@ function register(context) {
465
486
  // by the time it is actually CALLED, which is guaranteed to be later.
466
487
  const citationNumbers = new Map();
467
488
  const keyScopesByComp = new Map();
468
- // Bibliography partials rewritePartialForAssembly has mutated to
469
- // assembled/PDF `[N]` labels, not yet restored to their ordinary
470
- // cite:[key] source. Antora's own event lifecycle guarantees every
471
- // navigationBuilt handler (which drives @antora/assembler, hence this
472
- // mutation) completes before beforePublish (Confluence export, or any
473
- // future exporter reading the same shared catalog after assembly)
474
- // begins, so the very next ordinary, non-assembled loadAsciiDoc call
475
- // is always the right, and only necessary, moment to sweep these back
476
- // to source, before whatever reads them next sees stale PDF numbers.
477
- const pendingAssemblyPartialRestores = [];
478
489
  // component@version -> citation key -> the docname of the page hosting
479
490
  // that key's own category bibliography, for ORDINARY (non-assembled)
480
491
  // HTML output. Computed lazily, once per component-version, the same
@@ -540,7 +551,22 @@ function register(context) {
540
551
  loadAsciiDocWrapper = (...args) => {
541
552
  const [origFile, catalog, asciidocConfig] = args;
542
553
  let file = origFile;
543
- const isAssembled = !!(asciidocConfig?.attributes && 'loader-assembler' in asciidocConfig.attributes);
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);
544
570
  let restoreForeignPages;
545
571
  if (isAssembled && file?.contents && file.src?.component && file.src?.version) {
546
572
  const compKey = `${file.src.component}@${file.src.version}`;
@@ -556,11 +582,18 @@ function register(context) {
556
582
  // checking the unnamed default profile slot.
557
583
  const profileName = asciidocConfig?.attributes?.['assembler-profile'];
558
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.
559
592
  const numbers = citationNumbers.get(compKey);
560
593
  if (numbers && numbers.size > 0) {
561
594
  const keyScopes = keyScopesByComp.get(compKey) ?? null;
562
595
  const before = file.contents.toString('utf8');
563
- const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, (0, assembly_numbering_1.numberLabels)(numbers), true, keyScopes);
596
+ const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, labelForCompKey(compKey), true, keyScopes);
564
597
  if (after !== before) {
565
598
  file = Object.assign(Object.create(Object.getPrototypeOf(file)), file, { contents: Buffer.from(after, 'utf8') });
566
599
  }
@@ -568,54 +601,79 @@ function register(context) {
568
601
  restoreForeignPages = rewriteForeignCitedPages(file.src, profileName);
569
602
  }
570
603
  else if (!isAssembled && file?.contents && file.src?.component && file.src?.version && file.src?.family === 'page') {
571
- // Ordinary (non-assembled) HTML output: the same rewrite-before-
572
- // parse trick as the PDF/assembled branch above, minus any
573
- // assembler-profile involvement, so cite:[key] renders as a real
574
- // link to its bibliography entry instead of always-plain fallback
575
- // text, whenever that entry's category is hosted somewhere findable
576
- // in this component-version's own real navigation. The family
577
- // guard matches rewriteForeignCitedPages's own filter: a category's
578
- // generated bibliography partial is never independently reachable
579
- // through loadAsciiDoc (Antora's include processor reads it
580
- // straight from the catalog, see rewritePartialForAssembly's own
581
- // docblock), so this branch never fires for it and its own
582
- // cite:[key] row labels convert through the including page's
583
- // normal, unmodified Asciidoctor parse, via registerCiteMacro,
584
- // exactly as before this feature existed.
585
- //
586
- // Any bibliography partial rewritePartialForAssembly mutated to
587
- // assembled/PDF `[N]` labels during an earlier navigationBuilt
588
- // pass (PDF assembly) is undone here, before this or any later
589
- // ordinary-mode consumer (Confluence export among them) reads
590
- // it: Antora's own event lifecycle guarantees navigationBuilt
591
- // fully completes before any of these ordinary loadAsciiDoc
592
- // calls happen, so the first one is always the right moment.
593
- if (pendingAssemblyPartialRestores.length > 0) {
594
- for (const restore of pendingAssemblyPartialRestores.splice(0))
595
- restore();
596
- }
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).
597
626
  const compKey = `${file.src.component}@${file.src.version}`;
598
- const data = macro_1.citeCache.get(compKey);
599
627
  const before = file.contents.toString('utf8');
600
628
  let rewritten;
601
- if (data && data.entriesByKey.size > 0) {
602
- const scopes = ensureHtmlScopesComputed(compKey);
603
- if (scopes.size > 0)
604
- rewritten = (0, assembly_numbering_1.rewriteCiteMarkers)(before, formatHtmlLabels(data), true, scopes);
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
+ }
605
648
  }
606
- else if (keyOwner.size > 0 && before.includes('cite:[')) {
607
- // This component-version never configured cite-it at all
608
- // (checkOrphanedCiteUsage's own case): still worth checking
609
- // whether individual cite:[key] occurrences resolve elsewhere,
610
- // see resolveForeignCiteLinks's own docblock.
611
- const foreign = resolveForeignCiteLinks(before);
612
- if (foreign)
613
- rewritten = (0, assembly_numbering_1.rewriteCiteMarkers)(before, (key) => foreign.labels.get(key), true, foreign.scopes);
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
+ }
614
670
  }
615
671
  if (rewritten !== undefined && rewritten !== before) {
616
672
  file = Object.assign(Object.create(Object.getPrototypeOf(file)), file, { contents: Buffer.from(rewritten, 'utf8') });
617
673
  }
618
- restoreForeignPages = rewriteForeignCitedPagesHtml(file.src);
674
+ restoreForeignPages = (0, csl_1.citationFormatFor)(cfg.style) === 'numeric'
675
+ ? rewriteForeignCitedPages(file.src)
676
+ : rewriteForeignCitedPagesHtml(file.src);
619
677
  }
620
678
  // realLoadAsciiDoc is always assigned by this point: this closure is
621
679
  // only ever reachable after the synchronous assignment a few lines
@@ -711,7 +769,23 @@ function register(context) {
711
769
  continue;
712
770
  }
713
771
  let files = contentCatalog.getFiles().filter((f) => f.src.component === component && f.src.version === version);
714
- const compStyle = typeof compExt['style'] === 'string' ? compExt['style'] : cfg.style;
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
+ }
715
789
  const compOutPartial = typeof compExt['output_partial'] === 'string' ? compExt['output_partial'] : cfg.output_partial;
716
790
  const compWriteToDisk = toBool(compExt['write_to_disk'] ?? compExt['writeToDisk'], cfg.write_to_disk);
717
791
  const compBlanketPubstate = toBool(compExt['blanket_pubstate'] ?? compExt['blanketPubstate'], cfg.blanket_pubstate);
@@ -920,13 +994,31 @@ function register(context) {
920
994
  // actually used (cited, or ref_force), same set the
921
995
  // generated partial lists.
922
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
+ };
923
1015
  const refForceKeys = new Set(categories.flatMap((cat) => cat.ref_force));
924
1016
  const usedKeysByCategory = new Map();
925
1017
  const allUsedKeys = [];
926
1018
  for (const cat of categories) {
927
1019
  const keys = [...(categoryKeys.get(cat.ref_category) ?? new Set())]
928
1020
  .filter((k) => citedKeys.has(k) || refForceKeys.has(k))
929
- .sort((a, b) => a.localeCompare(b));
1021
+ .sort((a, b) => isNumericStyle ? a.localeCompare(b) : authorSortKey(a).localeCompare(authorSortKey(b)));
930
1022
  usedKeysByCategory.set(cat.ref_category, keys);
931
1023
  allUsedKeys.push(...keys);
932
1024
  }
@@ -945,7 +1037,7 @@ function register(context) {
945
1037
  }
946
1038
  }
947
1039
  }
948
- const formattedByKey = (0, csl_1.formatBibliographyEntries)(compStyle, combinedEntries, allUsedKeys, compBlanketPubstate, compSuperscriptSymbols, compDateFormat);
1040
+ const formattedByKey = (0, csl_1.formatBibliographyEntries)(cfg.style, combinedEntries, allUsedKeys, compBlanketPubstate, compSuperscriptSymbols, compDateFormat);
949
1041
  const cacheData = { entriesByKey: combinedEntries, formattedByKey, blanketPubstate: compBlanketPubstate };
950
1042
  macro_1.citeCache.set(compKey, cacheData);
951
1043
  assemblyScanContexts.set(compKey, {
@@ -990,6 +1082,19 @@ function register(context) {
990
1082
  // PDF/assembled numbering. See assembly-numbering.ts's own module
991
1083
  // docblock for the full reasoning behind the numbering mechanism itself.
992
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
+ //
993
1098
  // Computed LAZILY, memoized per component-version, on the first assembled
994
1099
  // loadAsciiDoc call the wrapper above sees for that component-version,
995
1100
  // rather than eagerly in a navigationBuilt listener as an earlier version
@@ -1231,18 +1336,51 @@ function register(context) {
1231
1336
  }
1232
1337
  keyScopesByComp.set(compKey, keyScopes);
1233
1338
  for (const cat of missingScopeCategories) {
1234
- logger.warn(`cite-it: ${compKey} - could not find the page that includes category "${cat}"'s generated partial; its citation links will render as plain numbers, not clickable links`);
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`);
1235
1340
  }
1236
- // The generated bibliography partial's own cite:[key] row labels
1237
- // need rewriting too, and specifically now, before any assembly-time
1238
- // loadAsciiDoc call resolves an include:: of it: Antora's include
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
1239
1344
  // processor reads an included partial's content directly from the
1240
1345
  // catalog, never back through loadAsciiDoc, so the wrapper above never
1241
1346
  // gets a chance to touch it otherwise (see rewritePartialForAssembly's
1242
1347
  // own docblock for the full story). Safe to do here, synchronously,
1243
1348
  // before returning: this function itself is always called from inside
1244
1349
  // the wrapper, before that same invocation's real loadAsciiDoc call.
1245
- pendingAssemblyPartialRestores.push(...(0, assembly_numbering_1.rewritePartialForAssembly)(scanCtx, numbers));
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;
1246
1384
  }
1247
1385
  /**
1248
1386
  * The ordinary-HTML counterpart to ensureAssemblyDataComputed above:
@@ -1320,11 +1458,26 @@ function register(context) {
1320
1458
  * fallback text registerCiteMacro's own process() callback already
1321
1459
  * renders inline, via the very same renderHtmlFallback function, so a
1322
1460
  * key that gets a real link renders identical text to one that
1323
- * doesn't, only whether it is wrapped in a link differs. */
1461
+ * doesn't, only whether it is wrapped in a link differs.
1462
+ *
1463
+ * escapeAsciidocReplacements wraps the result here, but NOT inside
1464
+ * renderHtmlFallback itself (macro.ts): registerCiteMacro's own,
1465
+ * unrelated call to that same function feeds its result straight to
1466
+ * createInline, already-final Inline-node text no further Asciidoctor
1467
+ * substitution ever touches, where an inserted backslash would show up
1468
+ * as a literal, visible character. rewriteCiteMarkers' label, by
1469
+ * contrast, is spliced into raw AsciiDoc SOURCE (the citing page's own
1470
+ * text) that a real Asciidoctor conversion re-parses from scratch right
1471
+ * after this rewrite, the same "generated text embedded as literal
1472
+ * source" hazard generateCategoryPartial's own bibliography text has
1473
+ * (see htmlEntryToAsciiDoc's docblock, csl.ts): an author name like
1474
+ * "O'Brien" reaching that parse unescaped would have its apostrophe
1475
+ * silently turned into a typographic right single quote by Asciidoctor's
1476
+ * own REPLACEMENTS substitution. */
1324
1477
  function formatHtmlLabels(data) {
1325
1478
  return (key) => {
1326
1479
  const entry = data.entriesByKey.get(key);
1327
- return entry ? (0, macro_1.renderHtmlFallback)(key, entry, data.blanketPubstate) : undefined;
1480
+ return entry ? (0, asciidoc_replacements_1.escapeAsciidocReplacements)((0, macro_1.renderHtmlFallback)(key, entry, data.blanketPubstate)) : undefined;
1328
1481
  };
1329
1482
  }
1330
1483
  /**
@@ -1367,7 +1520,11 @@ function register(context) {
1367
1520
  const hostDocname = ensureHtmlScopesComputed(owner).get(key);
1368
1521
  if (!hostDocname)
1369
1522
  continue;
1370
- labels.set(key, (0, macro_1.renderHtmlFallback)(key, entry, ownerData.blanketPubstate));
1523
+ // Escaped for the same reason as formatHtmlLabels' own call, above:
1524
+ // this label is spliced into raw AsciiDoc source re-parsed by a
1525
+ // real Asciidoctor conversion right after this rewrite, not passed
1526
+ // to createInline.
1527
+ labels.set(key, (0, asciidoc_replacements_1.escapeAsciidocReplacements)((0, macro_1.renderHtmlFallback)(key, entry, ownerData.blanketPubstate)));
1371
1528
  // A fully-qualified resource ID prefix (component:module:docname),
1372
1529
  // unlike the same-component branches above which store a bare
1373
1530
  // docname: this key's own bibliography genuinely lives in a
@@ -1468,7 +1625,7 @@ function register(context) {
1468
1625
  }
1469
1626
  }
1470
1627
  }
1471
- const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, (0, assembly_numbering_1.numberLabels)(numbers), true, scopes);
1628
+ const after = (0, assembly_numbering_1.rewriteCiteMarkers)(before, labelForCompKey(compKey), true, scopes);
1472
1629
  if (after === before)
1473
1630
  continue;
1474
1631
  holder.contents = Buffer.from(after, 'utf8');