@baiyibai-antora/extensions 1.13.0 → 1.14.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.
- package/CHANGELOG.adoc +18 -0
- package/README.adoc +17 -1
- package/dist/extensions/attribute-distiller/index.d.ts +6 -0
- package/dist/extensions/attribute-distiller/index.d.ts.map +1 -1
- package/dist/extensions/attribute-distiller/index.js +92 -16
- package/dist/extensions/attribute-distiller/index.js.map +1 -1
- package/dist/extensions/autoterm/index.d.ts +29 -18
- package/dist/extensions/autoterm/index.d.ts.map +1 -1
- package/dist/extensions/autoterm/index.js +37 -197
- package/dist/extensions/autoterm/index.js.map +1 -1
- package/dist/extensions/cite-it/asciidoc.d.ts +29 -0
- package/dist/extensions/cite-it/asciidoc.d.ts.map +1 -0
- package/dist/extensions/cite-it/asciidoc.js +32 -0
- package/dist/extensions/cite-it/asciidoc.js.map +1 -0
- package/dist/extensions/cite-it/assembly-numbering.d.ts +202 -0
- package/dist/extensions/cite-it/assembly-numbering.d.ts.map +1 -0
- package/dist/extensions/cite-it/assembly-numbering.js +385 -0
- package/dist/extensions/cite-it/assembly-numbering.js.map +1 -0
- package/dist/extensions/cite-it/csl.d.ts +45 -0
- package/dist/extensions/cite-it/csl.d.ts.map +1 -0
- package/dist/extensions/cite-it/csl.js +139 -0
- package/dist/extensions/cite-it/csl.js.map +1 -0
- package/dist/extensions/cite-it/index.d.ts +300 -0
- package/dist/extensions/cite-it/index.d.ts.map +1 -0
- package/dist/extensions/cite-it/index.js +1098 -0
- package/dist/extensions/cite-it/index.js.map +1 -0
- package/dist/extensions/cite-it/macro.d.ts +104 -0
- package/dist/extensions/cite-it/macro.d.ts.map +1 -0
- package/dist/extensions/cite-it/macro.js +245 -0
- package/dist/extensions/cite-it/macro.js.map +1 -0
- package/dist/extensions/cite-it/registry.d.ts +64 -0
- package/dist/extensions/cite-it/registry.d.ts.map +1 -0
- package/dist/extensions/cite-it/registry.js +157 -0
- package/dist/extensions/cite-it/registry.js.map +1 -0
- package/dist/extensions/trademark-it/index.d.ts +91 -22
- package/dist/extensions/trademark-it/index.d.ts.map +1 -1
- package/dist/extensions/trademark-it/index.js +239 -242
- package/dist/extensions/trademark-it/index.js.map +1 -1
- package/dist/lib/asciidoc-conditionals.d.ts +59 -0
- package/dist/lib/asciidoc-conditionals.d.ts.map +1 -0
- package/dist/lib/asciidoc-conditionals.js +0 -0
- package/dist/lib/asciidoc-conditionals.js.map +1 -0
- package/dist/lib/asciidoc-indexterms.d.ts +126 -0
- package/dist/lib/asciidoc-indexterms.d.ts.map +1 -0
- package/dist/lib/asciidoc-indexterms.js +261 -0
- package/dist/lib/asciidoc-indexterms.js.map +1 -0
- package/dist/lib/asciidoc-table.d.ts +32 -0
- package/dist/lib/asciidoc-table.d.ts.map +1 -0
- package/dist/lib/asciidoc-table.js +55 -0
- package/dist/lib/asciidoc-table.js.map +1 -0
- package/package.json +19 -4
- package/resources/cite-it/ieee-bracket.csl +519 -0
- package/resources/cite-it/locale-en-US.xml +864 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* cite-it: CSL bibliography-entry formatting.
|
|
4
|
+
*
|
|
5
|
+
* Wraps `citeproc` to format CSL-JSON items into bibliography-entry text
|
|
6
|
+
* for the generated partial. citeproc's own citation-cluster numbering is
|
|
7
|
+
* not used: `processCitationCluster` needs the full running cluster
|
|
8
|
+
* history passed back on every call to number correctly, making it the
|
|
9
|
+
* wrong tool for `citeit:[key]`'s per-Document counter, which already
|
|
10
|
+
* solves numbering by walking the document in natural order (see
|
|
11
|
+
* assembly-numbering.ts and macro.ts's own render-mode numbering).
|
|
12
|
+
* citeproc here formats bibliography-entry text only; the entry's
|
|
13
|
+
* number/label comes from `citeit:[key]` itself, reused as the generated
|
|
14
|
+
* partial's row label (macro.ts), so the two numbering sources agree by
|
|
15
|
+
* construction rather than by cross-checking two independent counters.
|
|
16
|
+
*
|
|
17
|
+
* `STYLES` currently bundles one entry, `ieee-bracket`. This is a scope
|
|
18
|
+
* limit, not an architectural one: `loadEngine` takes any CSL style/locale
|
|
19
|
+
* pair placed under `resources/cite-it/` and registered in `STYLES` below,
|
|
20
|
+
* so adding a style is a matter of shipping its `.csl`/`.xml` files and one
|
|
21
|
+
* new `STYLES` entry, not a design change. A `style` value not present in
|
|
22
|
+
* `STYLES` is rejected with a clear error rather than silently falling
|
|
23
|
+
* back, since a silently wrong citation style is a worse failure than a
|
|
24
|
+
* build error naming the actual gap.
|
|
25
|
+
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
+
}) : function(o, v) {
|
|
40
|
+
o["default"] = v;
|
|
41
|
+
});
|
|
42
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
43
|
+
var ownKeys = function(o) {
|
|
44
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
45
|
+
var ar = [];
|
|
46
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
47
|
+
return ar;
|
|
48
|
+
};
|
|
49
|
+
return ownKeys(o);
|
|
50
|
+
};
|
|
51
|
+
return function (mod) {
|
|
52
|
+
if (mod && mod.__esModule) return mod;
|
|
53
|
+
var result = {};
|
|
54
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
55
|
+
__setModuleDefault(result, mod);
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.htmlEntryToAsciiDoc = htmlEntryToAsciiDoc;
|
|
61
|
+
exports.formatBibliographyEntries = formatBibliographyEntries;
|
|
62
|
+
const fs = __importStar(require("node:fs"));
|
|
63
|
+
const path = __importStar(require("node:path"));
|
|
64
|
+
const citeproc_1 = require("citeproc");
|
|
65
|
+
const RESOURCES_DIR = path.join(__dirname, '..', '..', '..', 'resources', 'cite-it');
|
|
66
|
+
const STYLES = {
|
|
67
|
+
'ieee-bracket': { style: 'ieee-bracket.csl', locale: 'locale-en-US.xml' },
|
|
68
|
+
};
|
|
69
|
+
function loadEngine(styleName, items) {
|
|
70
|
+
const spec = STYLES[styleName];
|
|
71
|
+
if (!spec) {
|
|
72
|
+
throw new Error(`cite-it: unknown style "${styleName}"; supported styles: ${Object.keys(STYLES).join(', ')}`);
|
|
73
|
+
}
|
|
74
|
+
const styleXml = fs.readFileSync(path.join(RESOURCES_DIR, spec.style), 'utf8');
|
|
75
|
+
const localeXml = fs.readFileSync(path.join(RESOURCES_DIR, spec.locale), 'utf8');
|
|
76
|
+
const sys = {
|
|
77
|
+
retrieveLocale: () => localeXml,
|
|
78
|
+
retrieveItem: (id) => items.get(id),
|
|
79
|
+
};
|
|
80
|
+
return new citeproc_1.Engine(sys, styleXml);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Decode the small set of HTML entities citeproc's own output uses.
|
|
84
|
+
* citeproc escapes text it renders (author names, titles) as HTML, since
|
|
85
|
+
* its native output target is a browser DOM; the generated partial is
|
|
86
|
+
* AsciiDoc, not HTML, so entities are decoded back to literal characters
|
|
87
|
+
* rather than left for AsciiDoc to interpret as markup.
|
|
88
|
+
*/
|
|
89
|
+
function decodeEntities(s) {
|
|
90
|
+
return s
|
|
91
|
+
.replace(/&/g, '&')
|
|
92
|
+
.replace(/</g, '<')
|
|
93
|
+
.replace(/>/g, '>')
|
|
94
|
+
.replace(/"/g, '"')
|
|
95
|
+
.replace(/'/g, "'")
|
|
96
|
+
.replace(/ /g, ' ');
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Convert one citeproc bibliography entry's raw HTML fragment into AsciiDoc
|
|
100
|
+
* inline text. citeproc's output shape is two sibling <div>s per entry:
|
|
101
|
+
* `csl-left-margin` (the [N] bracket, citeproc's own numbering, discarded
|
|
102
|
+
* here since citeit:[key] supplies the real number) and `csl-right-inline`
|
|
103
|
+
* (the formatted entry text, kept). Only `csl-right-inline`'s content is
|
|
104
|
+
* used.
|
|
105
|
+
*/
|
|
106
|
+
function htmlEntryToAsciiDoc(entryHtml) {
|
|
107
|
+
const rightMatch = entryHtml.match(/csl-right-inline">([\s\S]*?)<\/div>\s*<\/div>\s*$/);
|
|
108
|
+
const inner = rightMatch ? rightMatch[1] : entryHtml;
|
|
109
|
+
const withAsciidocMarkup = inner
|
|
110
|
+
.replace(/<i>([\s\S]*?)<\/i>/g, '_$1_')
|
|
111
|
+
.replace(/<b>([\s\S]*?)<\/b>/g, '*$1*')
|
|
112
|
+
.replace(/<[^>]+>/g, '');
|
|
113
|
+
return decodeEntities(withAsciidocMarkup).replace(/\s+/g, ' ').trim();
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Format bibliography-entry text for a set of CSL-JSON items, keyed by
|
|
117
|
+
* citation key. `items` is the full merged registry (used for
|
|
118
|
+
* `retrieveItem` cross-references between entries, for example a
|
|
119
|
+
* `container-title` shared across a collection); `keys` selects and orders
|
|
120
|
+
* which items are actually formatted and returned: order does not need to
|
|
121
|
+
* match true citation order, since citeproc's own numbering is discarded
|
|
122
|
+
* (see the module docblock).
|
|
123
|
+
*/
|
|
124
|
+
function formatBibliographyEntries(styleName, items, keys) {
|
|
125
|
+
const result = new Map();
|
|
126
|
+
if (keys.length === 0)
|
|
127
|
+
return result;
|
|
128
|
+
const engine = loadEngine(styleName, items);
|
|
129
|
+
engine.updateItems(keys);
|
|
130
|
+
const [, entryHtmlList] = engine.makeBibliography();
|
|
131
|
+
keys.forEach((key, i) => {
|
|
132
|
+
const html = entryHtmlList[i];
|
|
133
|
+
if (html === undefined)
|
|
134
|
+
return;
|
|
135
|
+
result.set(key, htmlEntryToAsciiDoc(html));
|
|
136
|
+
});
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=csl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csl.js","sourceRoot":"","sources":["../../../src/extensions/cite-it/csl.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDH,kDAUC;AAWD,8DAmBC;AA/FD,4CAA8B;AAC9B,gDAAkC;AAClC,uCAAkC;AAGlC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AAErF,MAAM,MAAM,GAAsD;IAChE,cAAc,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE;CAC1E,CAAC;AAEF,SAAS,UAAU,CAAC,SAAiB,EAAE,KAA+B;IACpE,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC/B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,2BAA2B,SAAS,wBAAwB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC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kB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,yBAAyB,CACvC,SAAiB,EACjB,KAA+B,EAC/B,IAAc;IAEd,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAErC,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzB,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAEpD,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO;QAC/B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @baiyibai-antora/extensions - cite-it
|
|
3
|
+
*
|
|
4
|
+
* Resolves `citeit:[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.
|
|
10
|
+
*
|
|
11
|
+
* A category is defined entirely by which `.bib` file(s) an entry lives in,
|
|
12
|
+
* never by a data field inside the entry. Each category is an ordered list
|
|
13
|
+
* of source files: a shared collected file first, then zero or more
|
|
14
|
+
* component-local override files; later files' entries override earlier
|
|
15
|
+
* files' entries by citation key, the same override-by-key semantics
|
|
16
|
+
* autoterm's `mergeTerminology` already establishes.
|
|
17
|
+
*
|
|
18
|
+
* Each category generates its OWN partial (`categoryPartialName`,
|
|
19
|
+
* `<output_partial>-<ref_section>.adoc`). A component author routes a
|
|
20
|
+
* category to whichever page they choose, simply by including that
|
|
21
|
+
* category's own partial there; different categories may genuinely live
|
|
22
|
+
* on different pages, and citations correctly cross-link to whichever
|
|
23
|
+
* page actually hosts the cited entry (assembly-numbering.ts's
|
|
24
|
+
* `findBibliographyScopes`/`rewriteCiteMarkers`), not just a single
|
|
25
|
+
* hardcoded bibliography page.
|
|
26
|
+
*
|
|
27
|
+
* A component-version participates automatically, with no opt-in step at
|
|
28
|
+
* all: once the playbook-level `categories` scaffold (below) gives a
|
|
29
|
+
* component-version at least one category, it is scanned and gets its
|
|
30
|
+
* generated partial(s), whether or not its own antora.yml mentions
|
|
31
|
+
* 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`,
|
|
33
|
+
* `output_partial`, and `write_to_disk`: present only when a component
|
|
34
|
+
* needs to diverge from the playbook default, never required just to
|
|
35
|
+
* take part.
|
|
36
|
+
*
|
|
37
|
+
* EARLIER DESIGN, REPLACED: this extension originally required an
|
|
38
|
+
* explicit `ext.cite_it` block, even an empty one, mirroring
|
|
39
|
+
* trademark-it's own opt-in gate (heavy per-page scanning and
|
|
40
|
+
* generated-partial injection are real per-build cost, so a component
|
|
41
|
+
* shouldn't pay it just because a sibling component happens to use
|
|
42
|
+
* cite-it). In practice this produced a bad failure mode: a page citing
|
|
43
|
+
* a key with `citeit:[key]` in a component-version that forgot the
|
|
44
|
+
* `ext.cite_it` block either silently rendered an unrelated component's
|
|
45
|
+
* entry (if the key happened to collide) or a generic "unknown key"
|
|
46
|
+
* message that read like a typo rather than "this component-version
|
|
47
|
+
* never participated" - either way, with no diagnostic trail under the
|
|
48
|
+
* `quiet: true` every real registration uses. Removed rather than
|
|
49
|
+
* patched further: every component-version now participates by default,
|
|
50
|
+
* so there is no opt-in state left to forget. The performance tradeoff
|
|
51
|
+
* this accepts (every component-version with categories available now
|
|
52
|
+
* gets scanned, not just ones that explicitly asked to be) is a real
|
|
53
|
+
* cost, not a free lunch; it was decided against keeping the gate.
|
|
54
|
+
*
|
|
55
|
+
* `categories` in the PLAYBOOK-level `cite_it` config (below) is the
|
|
56
|
+
* real scaffold, mirroring how `trademark_file`/`terminology_file` work
|
|
57
|
+
* for trademark-it/autoterm: declared once, inherited by every
|
|
58
|
+
* component-version automatically. A component-version's own
|
|
59
|
+
* `ext.cite_it.categories`, if present at all, is entirely optional and
|
|
60
|
+
* purely additive to the scaffold, matched by `ref_section` (see
|
|
61
|
+
* mergeCategoriesConfig): naming a section already in the scaffold
|
|
62
|
+
* extends it (its `ref_files`/`ref_force` append to the scaffold's),
|
|
63
|
+
* and naming a new section adds a category local to that component
|
|
64
|
+
* alone. A component-version with
|
|
65
|
+
* genuinely no categories anywhere, no playbook scaffold and no local
|
|
66
|
+
* `ext.cite_it.categories`, is still skipped: there is nothing to scan
|
|
67
|
+
* for.
|
|
68
|
+
*
|
|
69
|
+
* Configuration in antora-playbook.yml:
|
|
70
|
+
*
|
|
71
|
+
* antora:
|
|
72
|
+
* extensions:
|
|
73
|
+
* - require: '@baiyibai-antora/extensions/cite-it'
|
|
74
|
+
* cite_it:
|
|
75
|
+
* enabled: true
|
|
76
|
+
* # Only 'ieee-bracket' is bundled and supported in this version.
|
|
77
|
+
* style: 'ieee-bracket'
|
|
78
|
+
* # Base filename for each category's own generated partial
|
|
79
|
+
* # (e.g. section "standards" -> generated-bibliography-
|
|
80
|
+
* # standards.adoc), one per category, injected into each
|
|
81
|
+
* # participating component-version.
|
|
82
|
+
* output_partial: 'generated-bibliography.adoc'
|
|
83
|
+
* # Write each generated partial to disk in the component's local
|
|
84
|
+
* # worktree too, alongside the source files, for IDE include
|
|
85
|
+
* # resolution. Skipped automatically for a component loaded from
|
|
86
|
+
* # a remote source (no local worktree to write into).
|
|
87
|
+
* write_to_disk: false
|
|
88
|
+
* # The global scaffold: every participating component-version
|
|
89
|
+
* # inherits these categories as-is unless it names the same
|
|
90
|
+
* # ref_section itself, in which case its own entry extends this
|
|
91
|
+
* # one rather than replacing it.
|
|
92
|
+
* categories:
|
|
93
|
+
* - ref_section: standards
|
|
94
|
+
* ref_files: ['cite-it-data:ROOT:partial$standards.bib']
|
|
95
|
+
* - ref_section: literature
|
|
96
|
+
* ref_files: ['cite-it-data:ROOT:partial$literature-shared.bib']
|
|
97
|
+
* ref_force: ['rfc2119']
|
|
98
|
+
*
|
|
99
|
+
* The generated partial itself carries no heading; a category's bibliography
|
|
100
|
+
* is a `[horizontal]` list only. The page including it supplies its own
|
|
101
|
+
* heading, ordinary authored AsciiDoc, immediately above the include line:
|
|
102
|
+
*
|
|
103
|
+
* == Standards References
|
|
104
|
+
*
|
|
105
|
+
* include::partial$generated-bibliography-standards.adoc[]
|
|
106
|
+
*
|
|
107
|
+
* Per-component configuration in antora.yml, under ext.cite_it, opts a
|
|
108
|
+
* component-version into cite-it and MAY extend the playbook-level
|
|
109
|
+
* scaffold. An empty block inherits the scaffold unchanged:
|
|
110
|
+
*
|
|
111
|
+
* ext:
|
|
112
|
+
* cite_it: {}
|
|
113
|
+
*
|
|
114
|
+
* A component needing a local-only addition to an existing section, or a
|
|
115
|
+
* wholly local category the scaffold does not define, adds only that:
|
|
116
|
+
*
|
|
117
|
+
* ext:
|
|
118
|
+
* cite_it:
|
|
119
|
+
* categories:
|
|
120
|
+
* # Extends the scaffold's own "literature" section (above) with one
|
|
121
|
+
* # more file, appended after the scaffold's own ref_files.
|
|
122
|
+
* - ref_section: literature
|
|
123
|
+
* ref_files: ['literature-local.bib']
|
|
124
|
+
* # A section the scaffold does not define at all: local to this
|
|
125
|
+
* # component only.
|
|
126
|
+
* - ref_section: internal-notes
|
|
127
|
+
* ref_files: ['internal-notes.bib']
|
|
128
|
+
*
|
|
129
|
+
* `.bib` files are resolved from the content catalog's `partial` family,
|
|
130
|
+
* the same family autoterm's terminology-table.adoc and trademark-it's
|
|
131
|
+
* trademark-table.adoc already use for shared, non-rendered reference data.
|
|
132
|
+
* Neither of those is independently published either: a `.bib` file's own
|
|
133
|
+
* confidentiality comes from which repository it lives in and who can read
|
|
134
|
+
* that repository, not from its Antora family. A category's `ref_files`
|
|
135
|
+
* list is the SAME shared-then-local-override pattern autoterm/trademark-it
|
|
136
|
+
* already establish:
|
|
137
|
+
*
|
|
138
|
+
* - A resource-ID reference (`component:module:partial$relative`, for
|
|
139
|
+
* example `cite-it-data:ROOT:partial$standards.bib` above) resolves
|
|
140
|
+
* against the full catalog, including a component the SAME playbook
|
|
141
|
+
* added as its own separate `content.sources` entry. This is the
|
|
142
|
+
* intended shape for a shared bibliography maintained in its own
|
|
143
|
+
* repository, the same pattern `baiyibai-autoterm-data` already
|
|
144
|
+
* establishes for autoterm's shared terminology table.
|
|
145
|
+
* - A bare filename (`literature-local.bib` above) resolves against the
|
|
146
|
+
* PARTICIPATING component-version's own `partial` family files only.
|
|
147
|
+
* This is the shape for a component-local override or addition, living
|
|
148
|
+
* alongside that component's own pages, never published on its own,
|
|
149
|
+
* reached only through this resolution (not through `include::`, since
|
|
150
|
+
* `.bib` files are read directly, not transcluded).
|
|
151
|
+
*
|
|
152
|
+
* `ref_force` names citation keys always listed in that category's
|
|
153
|
+
* bibliography even when no page cites them, for example a standard a
|
|
154
|
+
* component must disclose regardless of whether it is quoted inline. It is
|
|
155
|
+
* nested inside the category it targets, not a separate flat list with a
|
|
156
|
+
* back-reference: which heading a force-included citation renders under is
|
|
157
|
+
* simply which category's `ref_force` names it, independent of which
|
|
158
|
+
* category's `ref_files` actually defines the underlying entry. In the
|
|
159
|
+
* example above, `rfc2119` is force-included under the `literature` heading
|
|
160
|
+
* even if its own entry is defined inside the `standards` category's `.bib`
|
|
161
|
+
* file: a component author choosing where a force-included citation appears
|
|
162
|
+
* is a display decision, not a statement about which file happens to hold
|
|
163
|
+
* the data.
|
|
164
|
+
*
|
|
165
|
+
* A `.bib` entry's own `supersededby` field, a custom field naming the
|
|
166
|
+
* citation key of the newer entry replacing it, is not a real BibLaTeX
|
|
167
|
+
* field (see registry.ts) but is read directly from the raw parsed entry
|
|
168
|
+
* regardless. When a category's generated partial actually lists such a
|
|
169
|
+
* key (cited or `ref_force`d), cite-it warns once at generation time,
|
|
170
|
+
* naming the newer key, so an author sees a newer revision exists without
|
|
171
|
+
* reading the `.bib` file directly. Bibtex itself carries no native
|
|
172
|
+
* concept of an outdated reference; this is a cite-it-specific convention,
|
|
173
|
+
* not a standard `.bib` field any external tool is expected to recognize.
|
|
174
|
+
* Deliberately not raised again at each `citeit:[key]` use site in prose,
|
|
175
|
+
* one signal per generated partial is enough; managing `.bib` data itself,
|
|
176
|
+
* including deciding when an entry is superseded, stays outside cite-it's
|
|
177
|
+
* own scope (see the docs page's own "Scope" section).
|
|
178
|
+
*/
|
|
179
|
+
interface RawCategoryConfig {
|
|
180
|
+
ref_section: string;
|
|
181
|
+
ref_files: string[];
|
|
182
|
+
ref_force: string[];
|
|
183
|
+
}
|
|
184
|
+
interface CiteItConfig {
|
|
185
|
+
enabled: boolean;
|
|
186
|
+
quiet: boolean;
|
|
187
|
+
style: string;
|
|
188
|
+
output_partial: string;
|
|
189
|
+
suppress_events: boolean;
|
|
190
|
+
write_to_disk: boolean;
|
|
191
|
+
categories: RawCategoryConfig[];
|
|
192
|
+
}
|
|
193
|
+
interface AntoraLogger {
|
|
194
|
+
debug?: (msg: string) => void;
|
|
195
|
+
info?: (msg: string) => void;
|
|
196
|
+
warn?: (msg: string) => void;
|
|
197
|
+
error?: (msg: string) => void;
|
|
198
|
+
}
|
|
199
|
+
interface ExtensionEntry {
|
|
200
|
+
require?: string;
|
|
201
|
+
cite_it?: Partial<CiteItConfig>;
|
|
202
|
+
citeIt?: Partial<CiteItConfig>;
|
|
203
|
+
}
|
|
204
|
+
interface Playbook {
|
|
205
|
+
dir: string;
|
|
206
|
+
antora?: {
|
|
207
|
+
extensions?: ExtensionEntry[];
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
interface VirtualFileOrigin {
|
|
211
|
+
worktree?: string;
|
|
212
|
+
startPath?: string;
|
|
213
|
+
type?: string;
|
|
214
|
+
}
|
|
215
|
+
interface VirtualFileSrc {
|
|
216
|
+
path?: string;
|
|
217
|
+
family?: string;
|
|
218
|
+
component?: string;
|
|
219
|
+
version?: string;
|
|
220
|
+
module?: string;
|
|
221
|
+
relative?: string;
|
|
222
|
+
basename?: string;
|
|
223
|
+
stem?: string;
|
|
224
|
+
extname?: string;
|
|
225
|
+
origin?: VirtualFileOrigin;
|
|
226
|
+
mediaType?: string;
|
|
227
|
+
}
|
|
228
|
+
interface VirtualFile {
|
|
229
|
+
src: VirtualFileSrc;
|
|
230
|
+
contents: Buffer | Uint8Array;
|
|
231
|
+
pub?: unknown;
|
|
232
|
+
out?: unknown;
|
|
233
|
+
}
|
|
234
|
+
interface ComponentVersionEntry {
|
|
235
|
+
name?: string;
|
|
236
|
+
version?: string;
|
|
237
|
+
asciidoc?: {
|
|
238
|
+
attributes?: Record<string, unknown>;
|
|
239
|
+
};
|
|
240
|
+
navigation?: unknown[];
|
|
241
|
+
}
|
|
242
|
+
interface ComponentEntry {
|
|
243
|
+
name: string;
|
|
244
|
+
versions: ComponentVersionEntry[];
|
|
245
|
+
}
|
|
246
|
+
interface ResourceIdContext {
|
|
247
|
+
component?: string;
|
|
248
|
+
version?: string;
|
|
249
|
+
module?: string;
|
|
250
|
+
family?: string;
|
|
251
|
+
relative?: string;
|
|
252
|
+
}
|
|
253
|
+
interface ContentCatalog {
|
|
254
|
+
getFiles: () => VirtualFile[];
|
|
255
|
+
addFile: (file: VirtualFile) => void;
|
|
256
|
+
getComponents?: () => ComponentEntry[];
|
|
257
|
+
resolveResource?: (spec: string, context?: ResourceIdContext, defaultFamily?: string, permittedFamilies?: string[]) => VirtualFile | undefined;
|
|
258
|
+
getByPath?: (criteria: {
|
|
259
|
+
component?: string;
|
|
260
|
+
version?: string;
|
|
261
|
+
path: string;
|
|
262
|
+
}) => VirtualFile | undefined;
|
|
263
|
+
}
|
|
264
|
+
interface ContentAggregateItem {
|
|
265
|
+
name: string;
|
|
266
|
+
version: string;
|
|
267
|
+
ext?: Record<string, Record<string, unknown>>;
|
|
268
|
+
}
|
|
269
|
+
interface AssemblerProfileData {
|
|
270
|
+
navFiles?: VirtualFile[];
|
|
271
|
+
}
|
|
272
|
+
interface Registry {
|
|
273
|
+
getLogger?: (name: string) => AntoraLogger;
|
|
274
|
+
once(event: 'contentAggregated', callback: (context: {
|
|
275
|
+
contentAggregate: ContentAggregateItem[];
|
|
276
|
+
}) => void): void;
|
|
277
|
+
once(event: 'playbookBuilt', callback: (context: {
|
|
278
|
+
playbook: Playbook;
|
|
279
|
+
}) => Promise<void>): void;
|
|
280
|
+
once(event: 'contentClassified', callback: (context: {
|
|
281
|
+
playbook: Playbook;
|
|
282
|
+
contentCatalog?: ContentCatalog;
|
|
283
|
+
}) => Promise<void>): void;
|
|
284
|
+
once(event: 'navigationBuilt', callback: (context: {
|
|
285
|
+
contentCatalog?: ContentCatalog;
|
|
286
|
+
}) => void): void;
|
|
287
|
+
once(event: string, callback: (context: unknown) => void): void;
|
|
288
|
+
getVariables?: () => {
|
|
289
|
+
assemblerProfiles?: Map<string, Map<string | undefined, AssemblerProfileData>>;
|
|
290
|
+
navigationCatalog?: {
|
|
291
|
+
getNavigation: (component: string, version: string) => unknown[] | undefined;
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
getFunctions?: () => Record<string, (...args: unknown[]) => unknown>;
|
|
295
|
+
replaceFunctions?: (updates: Record<string, (...args: unknown[]) => unknown>) => void;
|
|
296
|
+
require?: (request: string) => unknown;
|
|
297
|
+
}
|
|
298
|
+
export declare function register(this: Registry, context?: Registry): void;
|
|
299
|
+
export {};
|
|
300
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/cite-it/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiLG;AAuCH,UAAU,iBAAiB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,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,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IAQvB,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AAED,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B;AASD,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;CAChC;AAED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