@baiyibai-antora/extensions 1.0.11 → 1.0.13
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/README.adoc
CHANGED
|
@@ -8,7 +8,7 @@ A consolidated package of Antora extensions for documentation workflows.
|
|
|
8
8
|
|
|
9
9
|
== Overview
|
|
10
10
|
|
|
11
|
-
This package provides
|
|
11
|
+
This package provides seven Antora extensions:
|
|
12
12
|
|
|
13
13
|
[cols="1,3"]
|
|
14
14
|
|===
|
|
@@ -31,6 +31,9 @@ This package provides six Antora extensions:
|
|
|
31
31
|
|
|
32
32
|
|<<asciidoctorconfig>>
|
|
33
33
|
|Copies `.asciidoctorconfig` files from content catalog to project root
|
|
34
|
+
|
|
35
|
+
|<<trademark-it>>
|
|
36
|
+
|Scans catalog source files for trademark terms and injects a filtered declaration table partial
|
|
34
37
|
|===
|
|
35
38
|
|
|
36
39
|
== Installation
|
|
@@ -570,6 +573,102 @@ Integrates Vale linting into the Antora build pipeline.
|
|
|
570
573
|
max_logs: 10
|
|
571
574
|
----
|
|
572
575
|
|
|
576
|
+
[[trademark-it]]
|
|
577
|
+
=== trademark-it
|
|
578
|
+
|
|
579
|
+
Scans the Antora content catalog for known trademark terms and injects a generated AsciiDoc partial (`generated-trademark-table.adoc`) into each component-version.
|
|
580
|
+
The partial contains only the trademarks that actually appear in the component's source files, with aliases grouped under their canonical brand entry and declarations pluralised correctly.
|
|
581
|
+
|
|
582
|
+
Trademark definitions are maintained in a central AsciiDoc table (see https://gitlab.com/baiyibai-antora/assets/trademark-it-data[trademark-it-data]).
|
|
583
|
+
No Ruby extension, Lunr search index, or post-PDF processing is required.
|
|
584
|
+
|
|
585
|
+
==== How it works
|
|
586
|
+
|
|
587
|
+
At `contentClassified` time, the extension:
|
|
588
|
+
|
|
589
|
+
. Reads the trademark definition table from the configured `trademark_file` catalog partial.
|
|
590
|
+
. Scans the raw AsciiDoc source of every page and partial in each component-version using word-boundary regex.
|
|
591
|
+
. Resolves aliases — e.g. iOS, iPhone, Safari, and Final Cut Pro are grouped under the Apple entry.
|
|
592
|
+
. Generates `modules/ROOT/partials/generated-trademark-table.adoc` and injects it into the catalog.
|
|
593
|
+
|
|
594
|
+
In the document, include the generated table with:
|
|
595
|
+
|
|
596
|
+
[source,asciidoc]
|
|
597
|
+
----
|
|
598
|
+
\include::partial$generated-trademark-table.adoc[]
|
|
599
|
+
----
|
|
600
|
+
|
|
601
|
+
==== Term matching notes
|
|
602
|
+
|
|
603
|
+
* Matching is case-insensitive and uses word boundaries.
|
|
604
|
+
* Multi-word terms (e.g. `Microsoft Teams`, `Final Cut Pro`) are matched correctly.
|
|
605
|
+
* Hyphen variants are normalised: regular hyphen (U+002D), non-breaking hyphen (U+2011), and the AsciiDoc `{nbhy}` attribute are treated as equivalent.
|
|
606
|
+
* Scanning operates on raw `.adoc` source — attribute substitutions have not run, so terms that arrive solely via `{attribute}` expansion will not be detected.
|
|
607
|
+
|
|
608
|
+
==== Trademark definition table format
|
|
609
|
+
|
|
610
|
+
The definition table (`trademark-table.adoc`) has five columns: Term, Statement, Date Checked, Verified By, URL.
|
|
611
|
+
|
|
612
|
+
When the Statement column contains the bare name of another term in the table, the row is an alias.
|
|
613
|
+
The extension merges all aliases into the canonical entry's declaration row.
|
|
614
|
+
|
|
615
|
+
==== Configuration
|
|
616
|
+
|
|
617
|
+
[cols="2,1,3,2"]
|
|
618
|
+
|===
|
|
619
|
+
|Key |Type |Description |Default
|
|
620
|
+
|
|
621
|
+
|`enabled`
|
|
622
|
+
|boolean
|
|
623
|
+
|Enable/disable the extension
|
|
624
|
+
|`true`
|
|
625
|
+
|
|
626
|
+
|`trademark_file`
|
|
627
|
+
|string
|
|
628
|
+
|Antora resource ID or filename of the trademark definition partial
|
|
629
|
+
|`'ROOT:partial$trademark-table.adoc'`
|
|
630
|
+
|
|
631
|
+
|`output_partial`
|
|
632
|
+
|string
|
|
633
|
+
|Filename of the generated partial injected into each component-version
|
|
634
|
+
|`'generated-trademark-table.adoc'`
|
|
635
|
+
|
|
636
|
+
|`cols`
|
|
637
|
+
|string
|
|
638
|
+
|AsciiDoc `cols` attribute for the generated table
|
|
639
|
+
|`'22,78'`
|
|
640
|
+
|
|
641
|
+
|`ignore`
|
|
642
|
+
|string / array
|
|
643
|
+
|Comma-separated list (or YAML array) of base terms to exclude
|
|
644
|
+
|`[]`
|
|
645
|
+
|===
|
|
646
|
+
|
|
647
|
+
==== Playbook Configuration
|
|
648
|
+
|
|
649
|
+
[source,yaml]
|
|
650
|
+
----
|
|
651
|
+
- require: '@baiyibai-antora/extensions/trademark-it'
|
|
652
|
+
trademark_it:
|
|
653
|
+
enabled: true
|
|
654
|
+
trademark_file: 'ROOT:partial$trademark-table.adoc'
|
|
655
|
+
output_partial: 'generated-trademark-table.adoc'
|
|
656
|
+
cols: '22,78'
|
|
657
|
+
ignore: []
|
|
658
|
+
----
|
|
659
|
+
|
|
660
|
+
==== Content source
|
|
661
|
+
|
|
662
|
+
Add the `trademark-it-data` repository as a content source so the definition table is available in the catalog:
|
|
663
|
+
|
|
664
|
+
[source,yaml]
|
|
665
|
+
----
|
|
666
|
+
content:
|
|
667
|
+
sources:
|
|
668
|
+
- url: https://gitlab.com/baiyibai-antora/assets/trademark-it-data.git
|
|
669
|
+
branches: HEAD
|
|
670
|
+
----
|
|
671
|
+
|
|
573
672
|
[[asciidoctorconfig]]
|
|
574
673
|
=== asciidoctorconfig
|
|
575
674
|
|
|
@@ -683,7 +782,8 @@ baiyibai-extensions/
|
|
|
683
782
|
│ ├── assembler-rename-pdf/
|
|
684
783
|
│ ├── external-asset-downloader/
|
|
685
784
|
│ ├── vale-integration/
|
|
686
|
-
│
|
|
785
|
+
│ ├── asciidoctorconfig/
|
|
786
|
+
│ └── trademark-it/
|
|
687
787
|
└── dist/ # Built output
|
|
688
788
|
----
|
|
689
789
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @baiyibai-antora/extensions - trademark-it
|
|
3
|
+
*
|
|
4
|
+
* Scans the Antora content catalog for known trademark terms and injects a
|
|
5
|
+
* generated AsciiDoc partial containing only the trademarks found in each
|
|
6
|
+
* component-version. The partial is injected as:
|
|
7
|
+
*
|
|
8
|
+
* modules/ROOT/partials/generated-trademark-table.adoc
|
|
9
|
+
*
|
|
10
|
+
* Documents replace the old [type="trademarks"] table block with:
|
|
11
|
+
*
|
|
12
|
+
* include::partial$generated-trademark-table.adoc[]
|
|
13
|
+
*
|
|
14
|
+
* Configuration in antora-playbook.yml:
|
|
15
|
+
*
|
|
16
|
+
* antora:
|
|
17
|
+
* extensions:
|
|
18
|
+
* - require: '@baiyibai-antora/extensions/trademark-it'
|
|
19
|
+
* trademark_it:
|
|
20
|
+
* enabled: true
|
|
21
|
+
* # Antora resource ID of the trademark definition partial.
|
|
22
|
+
* # Format: [version@]component:module:family$relative
|
|
23
|
+
* trademark_file: 'ROOT:partial$trademark-table.adoc'
|
|
24
|
+
* # Name of the generated partial injected into every component-version.
|
|
25
|
+
* output_partial: 'generated-trademark-table.adoc'
|
|
26
|
+
* # Terms to exclude from detection, comma-separated (or as a YAML list).
|
|
27
|
+
* ignore: []
|
|
28
|
+
* # Column widths for the generated table (AsciiDoc cols attribute).
|
|
29
|
+
* cols: '22,78'
|
|
30
|
+
*/
|
|
31
|
+
interface TrademarkItConfig {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
trademark_file: string;
|
|
34
|
+
output_partial: string;
|
|
35
|
+
ignore: string[];
|
|
36
|
+
cols: string;
|
|
37
|
+
}
|
|
38
|
+
interface TrademarkEntry {
|
|
39
|
+
/** Term as written in source, with symbol: e.g. "Apple®" */
|
|
40
|
+
primaryTerm: string;
|
|
41
|
+
/** Base term with symbol stripped: e.g. "Apple" */
|
|
42
|
+
baseTerm: string;
|
|
43
|
+
/** Full legal declaration sentence from the table */
|
|
44
|
+
declaration: string;
|
|
45
|
+
/** All base terms that resolve to this entry (includes baseTerm itself) */
|
|
46
|
+
combinedTerms: string[];
|
|
47
|
+
/** Human-readable list with Oxford comma */
|
|
48
|
+
combinedTermList: string;
|
|
49
|
+
/** Primary terms with symbols for display in left column */
|
|
50
|
+
combinedPrimaryTerms: string[];
|
|
51
|
+
}
|
|
52
|
+
interface AntoraLogger {
|
|
53
|
+
debug?: (msg: string) => void;
|
|
54
|
+
info?: (msg: string) => void;
|
|
55
|
+
warn?: (msg: string) => void;
|
|
56
|
+
error?: (msg: string) => void;
|
|
57
|
+
}
|
|
58
|
+
interface ExtensionEntry {
|
|
59
|
+
require?: string;
|
|
60
|
+
trademark_it?: Partial<TrademarkItConfig>;
|
|
61
|
+
trademarkIt?: Partial<TrademarkItConfig>;
|
|
62
|
+
trademarkit?: Partial<TrademarkItConfig>;
|
|
63
|
+
}
|
|
64
|
+
interface Playbook {
|
|
65
|
+
dir: string;
|
|
66
|
+
antora?: {
|
|
67
|
+
extensions?: ExtensionEntry[];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
interface VirtualFileSrc {
|
|
71
|
+
path?: string;
|
|
72
|
+
family?: string;
|
|
73
|
+
component?: string;
|
|
74
|
+
version?: string;
|
|
75
|
+
module?: string;
|
|
76
|
+
relative?: string;
|
|
77
|
+
basename?: string;
|
|
78
|
+
stem?: string;
|
|
79
|
+
extname?: string;
|
|
80
|
+
editUrl?: string;
|
|
81
|
+
origin?: unknown;
|
|
82
|
+
mediaType?: string;
|
|
83
|
+
}
|
|
84
|
+
interface VirtualFile {
|
|
85
|
+
src: VirtualFileSrc;
|
|
86
|
+
contents: Buffer | Uint8Array;
|
|
87
|
+
pub?: unknown;
|
|
88
|
+
out?: unknown;
|
|
89
|
+
}
|
|
90
|
+
interface ContentCatalog {
|
|
91
|
+
getFiles: () => VirtualFile[];
|
|
92
|
+
addFile: (file: VirtualFile) => void;
|
|
93
|
+
}
|
|
94
|
+
interface Registry {
|
|
95
|
+
getLogger?: (name: string) => AntoraLogger;
|
|
96
|
+
once: (event: string, callback: (context: {
|
|
97
|
+
playbook: Playbook;
|
|
98
|
+
contentCatalog?: ContentCatalog;
|
|
99
|
+
}) => Promise<void>) => void;
|
|
100
|
+
}
|
|
101
|
+
export declare function formatList(terms: string[]): string;
|
|
102
|
+
/**
|
|
103
|
+
* Parse the trademark definition AsciiDoc file and return a map of
|
|
104
|
+
* baseTerm → TrademarkEntry. The ignore list (bare terms, no symbols)
|
|
105
|
+
* is applied here.
|
|
106
|
+
*
|
|
107
|
+
* Port of trademark-it.rb parse_trademarks + alias resolution.
|
|
108
|
+
*/
|
|
109
|
+
export declare function parseTrademarks(asciidocText: string, ignore?: string[]): Map<string, TrademarkEntry>;
|
|
110
|
+
/**
|
|
111
|
+
* Scan source text for trademark terms. Returns the set of matched base
|
|
112
|
+
* terms (keys in the trademarks map).
|
|
113
|
+
*/
|
|
114
|
+
export declare function findTrademarks(sourceText: string, trademarks: Map<string, TrademarkEntry>): Set<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Generate the content of the injected partial.
|
|
117
|
+
*
|
|
118
|
+
* Entries are sorted alphabetically by base term (case-insensitive),
|
|
119
|
+
* matching the Ruby sorted_data behaviour.
|
|
120
|
+
*/
|
|
121
|
+
export declare function generateTrademarkPartial(foundBaseTerms: Set<string>, trademarks: Map<string, TrademarkEntry>, cols?: string): string;
|
|
122
|
+
export declare function register(this: Registry, context?: Registry): void;
|
|
123
|
+
export {};
|
|
124
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/trademark-it/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAQH,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,U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U,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACvC,IAAI,SAAU,GACb,MAAM,CA2BR;AAMD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,IAAI,CAiIjE"}
|
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @baiyibai-antora/extensions - trademark-it
|
|
4
|
+
*
|
|
5
|
+
* Scans the Antora content catalog for known trademark terms and injects a
|
|
6
|
+
* generated AsciiDoc partial containing only the trademarks found in each
|
|
7
|
+
* component-version. The partial is injected as:
|
|
8
|
+
*
|
|
9
|
+
* modules/ROOT/partials/generated-trademark-table.adoc
|
|
10
|
+
*
|
|
11
|
+
* Documents replace the old [type="trademarks"] table block with:
|
|
12
|
+
*
|
|
13
|
+
* include::partial$generated-trademark-table.adoc[]
|
|
14
|
+
*
|
|
15
|
+
* Configuration in antora-playbook.yml:
|
|
16
|
+
*
|
|
17
|
+
* antora:
|
|
18
|
+
* extensions:
|
|
19
|
+
* - require: '@baiyibai-antora/extensions/trademark-it'
|
|
20
|
+
* trademark_it:
|
|
21
|
+
* enabled: true
|
|
22
|
+
* # Antora resource ID of the trademark definition partial.
|
|
23
|
+
* # Format: [version@]component:module:family$relative
|
|
24
|
+
* trademark_file: 'ROOT:partial$trademark-table.adoc'
|
|
25
|
+
* # Name of the generated partial injected into every component-version.
|
|
26
|
+
* output_partial: 'generated-trademark-table.adoc'
|
|
27
|
+
* # Terms to exclude from detection, comma-separated (or as a YAML list).
|
|
28
|
+
* ignore: []
|
|
29
|
+
* # Column widths for the generated table (AsciiDoc cols attribute).
|
|
30
|
+
* cols: '22,78'
|
|
31
|
+
*/
|
|
32
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
33
|
+
if (k2 === undefined) k2 = k;
|
|
34
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
35
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
36
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
37
|
+
}
|
|
38
|
+
Object.defineProperty(o, k2, desc);
|
|
39
|
+
}) : (function(o, m, k, k2) {
|
|
40
|
+
if (k2 === undefined) k2 = k;
|
|
41
|
+
o[k2] = m[k];
|
|
42
|
+
}));
|
|
43
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
44
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
45
|
+
}) : function(o, v) {
|
|
46
|
+
o["default"] = v;
|
|
47
|
+
});
|
|
48
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
49
|
+
var ownKeys = function(o) {
|
|
50
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
51
|
+
var ar = [];
|
|
52
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
53
|
+
return ar;
|
|
54
|
+
};
|
|
55
|
+
return ownKeys(o);
|
|
56
|
+
};
|
|
57
|
+
return function (mod) {
|
|
58
|
+
if (mod && mod.__esModule) return mod;
|
|
59
|
+
var result = {};
|
|
60
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
61
|
+
__setModuleDefault(result, mod);
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
})();
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.formatList = formatList;
|
|
67
|
+
exports.parseTrademarks = parseTrademarks;
|
|
68
|
+
exports.findTrademarks = findTrademarks;
|
|
69
|
+
exports.generateTrademarkPartial = generateTrademarkPartial;
|
|
70
|
+
exports.register = register;
|
|
71
|
+
const fs = __importStar(require("node:fs"));
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
// Logging helpers (mirrors vale-integration style)
|
|
74
|
+
// ---------------------------------------------------------------------------
|
|
75
|
+
function nowISO() {
|
|
76
|
+
return new Date().toISOString().split('T')[1].replace('Z', '');
|
|
77
|
+
}
|
|
78
|
+
function makeLogger(hostLogger) {
|
|
79
|
+
return {
|
|
80
|
+
debug: (m) => { if (hostLogger?.debug)
|
|
81
|
+
hostLogger.debug(m);
|
|
82
|
+
else
|
|
83
|
+
console.debug(m); },
|
|
84
|
+
info: (m) => { if (hostLogger?.info)
|
|
85
|
+
hostLogger.info(m);
|
|
86
|
+
else
|
|
87
|
+
console.log(m); },
|
|
88
|
+
warn: (m) => { if (hostLogger?.warn)
|
|
89
|
+
hostLogger.warn(m);
|
|
90
|
+
else
|
|
91
|
+
console.warn(m); },
|
|
92
|
+
error: (m) => { if (hostLogger?.error)
|
|
93
|
+
hostLogger.error(m);
|
|
94
|
+
else
|
|
95
|
+
console.error(m); },
|
|
96
|
+
event: (m) => console.log(`[${nowISO()}] \x1b[94mEVENT\x1b[0m (trademark-it): \x1b[94m${m}\x1b[0m`),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Config helpers (mirrors vale-integration style)
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
function toBool(v, def) {
|
|
103
|
+
if (v === true)
|
|
104
|
+
return true;
|
|
105
|
+
if (v === false)
|
|
106
|
+
return false;
|
|
107
|
+
if (typeof v === 'string') {
|
|
108
|
+
const s = v.trim().toLowerCase();
|
|
109
|
+
if (['true', '1', 'yes', 'on'].includes(s))
|
|
110
|
+
return true;
|
|
111
|
+
if (['false', '0', 'no', 'off'].includes(s))
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
return def;
|
|
115
|
+
}
|
|
116
|
+
function pick(obj, keys, def) {
|
|
117
|
+
for (const k of keys) {
|
|
118
|
+
if (obj && obj[k] !== undefined)
|
|
119
|
+
return obj[k];
|
|
120
|
+
}
|
|
121
|
+
return def;
|
|
122
|
+
}
|
|
123
|
+
function ensureStringArray(v) {
|
|
124
|
+
if (Array.isArray(v))
|
|
125
|
+
return v.map(String);
|
|
126
|
+
if (typeof v === 'string' && v.trim())
|
|
127
|
+
return v.split(',').map((s) => s.trim()).filter(Boolean);
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// Oxford-comma list formatter (port of format_combined_term_list in Ruby)
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
function formatList(terms) {
|
|
134
|
+
if (terms.length === 0)
|
|
135
|
+
return '';
|
|
136
|
+
if (terms.length === 1)
|
|
137
|
+
return terms[0];
|
|
138
|
+
if (terms.length === 2)
|
|
139
|
+
return `${terms[0]} and ${terms[1]}`;
|
|
140
|
+
return `${terms.slice(0, -1).join(', ')}, and ${terms[terms.length - 1]}`;
|
|
141
|
+
}
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
// AsciiDoc table parser (port of parse_trademarks in Ruby)
|
|
144
|
+
//
|
|
145
|
+
// Parses the 5-column trademark table:
|
|
146
|
+
// |Term |Trademark Statement |Date |Verified By |URL
|
|
147
|
+
//
|
|
148
|
+
// Alias detection: if the Statement column matches the bare text of another
|
|
149
|
+
// term key, the row is treated as a redirect (alias → canonical entry).
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
/**
|
|
152
|
+
* Strip ™ and ® symbols from a string.
|
|
153
|
+
*/
|
|
154
|
+
function stripSymbols(s) {
|
|
155
|
+
return s.replace(/[™®]/g, '').trim();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Parse an AsciiDoc table into an array of string-cell rows.
|
|
159
|
+
* Handles the `|cell` style used in the trademark table.
|
|
160
|
+
*
|
|
161
|
+
* The table format is:
|
|
162
|
+
* |===
|
|
163
|
+
* |col0
|
|
164
|
+
* |col1
|
|
165
|
+
* ...
|
|
166
|
+
* |===
|
|
167
|
+
*
|
|
168
|
+
* Rows are separated by blank lines between cell groups, OR by having
|
|
169
|
+
* each cell on its own line (the style used in trademark-table.adoc).
|
|
170
|
+
* We collect all `|…` tokens after the header row and group them by
|
|
171
|
+
* the column count declared in the [cols=…] attribute.
|
|
172
|
+
*/
|
|
173
|
+
function parseTrademarkTable(asciidocText) {
|
|
174
|
+
const rows = [];
|
|
175
|
+
// Find the table body between |=== delimiters.
|
|
176
|
+
const tableMatch = asciidocText.match(/\|={3,}([\s\S]*?)\|={3,}/);
|
|
177
|
+
if (!tableMatch)
|
|
178
|
+
return rows;
|
|
179
|
+
const tableBody = tableMatch[1];
|
|
180
|
+
// Determine column count from [cols="…"] attribute if present.
|
|
181
|
+
// Default to 5 (matching the trademark-table.adoc format).
|
|
182
|
+
let colCount = 5;
|
|
183
|
+
const colsMatch = asciidocText.match(/\[cols\s*=\s*["']([^"']+)["']/);
|
|
184
|
+
if (colsMatch) {
|
|
185
|
+
// Count comma-separated entries; handle repeat syntax like "3*1"
|
|
186
|
+
colCount = colsMatch[1].split(',').length;
|
|
187
|
+
}
|
|
188
|
+
// Extract all cell values. The trademark table uses two styles:
|
|
189
|
+
// • Header row — all cells inline on one line, each prefixed with |:
|
|
190
|
+
// |Term |Statement |Date |Verified By |URL
|
|
191
|
+
// • Data rows — one cell per line, each on its own line:
|
|
192
|
+
// |Apple®
|
|
193
|
+
// |Apple is a registered trademark…
|
|
194
|
+
//
|
|
195
|
+
// We detect inline multi-cell lines by splitting on | and checking whether
|
|
196
|
+
// more than one non-empty segment results.
|
|
197
|
+
const cells = [];
|
|
198
|
+
for (const raw of tableBody.split('\n')) {
|
|
199
|
+
const line = raw.trim();
|
|
200
|
+
if (!line || line === '|===')
|
|
201
|
+
continue;
|
|
202
|
+
if (!line.startsWith('|'))
|
|
203
|
+
continue;
|
|
204
|
+
// Split on | — the first segment before the leading | will be empty.
|
|
205
|
+
const parts = line.split('|').map((p) => p.trim()).filter((p) => p !== '');
|
|
206
|
+
if (parts.length > 1) {
|
|
207
|
+
// Inline multi-cell row (e.g. the header).
|
|
208
|
+
cells.push(...parts);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
// Single-cell-per-line row (all data rows).
|
|
212
|
+
cells.push(line.slice(1).trim());
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Group cells into rows of colCount.
|
|
216
|
+
for (let i = 0; i + colCount - 1 < cells.length; i += colCount) {
|
|
217
|
+
rows.push(cells.slice(i, i + colCount));
|
|
218
|
+
}
|
|
219
|
+
return rows;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Parse the trademark definition AsciiDoc file and return a map of
|
|
223
|
+
* baseTerm → TrademarkEntry. The ignore list (bare terms, no symbols)
|
|
224
|
+
* is applied here.
|
|
225
|
+
*
|
|
226
|
+
* Port of trademark-it.rb parse_trademarks + alias resolution.
|
|
227
|
+
*/
|
|
228
|
+
function parseTrademarks(asciidocText, ignore = []) {
|
|
229
|
+
const trademarks = new Map();
|
|
230
|
+
// redirects[canonicalBase] = [aliasBase, ...]
|
|
231
|
+
const redirects = new Map();
|
|
232
|
+
const rows = parseTrademarkTable(asciidocText);
|
|
233
|
+
if (rows.length === 0)
|
|
234
|
+
return trademarks;
|
|
235
|
+
// Skip header row (options="header" means row[0] is the header).
|
|
236
|
+
const dataRows = rows.slice(1);
|
|
237
|
+
// Build the set of all base terms for redirect detection.
|
|
238
|
+
const allBaseTerms = new Set(dataRows.map((r) => stripSymbols(r[0])));
|
|
239
|
+
for (const row of dataRows) {
|
|
240
|
+
const term = row[0].trim(); // e.g. "Apple®"
|
|
241
|
+
const statement = row[1].trim(); // declaration or redirect target
|
|
242
|
+
const baseTerm = stripSymbols(term); // e.g. "Apple"
|
|
243
|
+
if (ignore.includes(baseTerm))
|
|
244
|
+
continue;
|
|
245
|
+
const statementBase = stripSymbols(statement); // strip symbols from statement for redirect test
|
|
246
|
+
if (allBaseTerms.has(statementBase) && statementBase !== baseTerm) {
|
|
247
|
+
// This row is an alias: statement column names another term key.
|
|
248
|
+
// e.g. |iOS® | Apple | → redirects["Apple"] += "iOS"
|
|
249
|
+
const existing = redirects.get(statementBase) ?? [];
|
|
250
|
+
existing.push(baseTerm);
|
|
251
|
+
redirects.set(statementBase, existing);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
trademarks.set(baseTerm, {
|
|
255
|
+
primaryTerm: term,
|
|
256
|
+
baseTerm,
|
|
257
|
+
declaration: statement,
|
|
258
|
+
combinedTerms: [baseTerm],
|
|
259
|
+
combinedTermList: baseTerm,
|
|
260
|
+
combinedPrimaryTerms: [term],
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// Resolve redirects: merge aliases into their canonical entry.
|
|
265
|
+
for (const [canonical, aliases] of redirects) {
|
|
266
|
+
const entry = trademarks.get(canonical);
|
|
267
|
+
if (!entry)
|
|
268
|
+
continue;
|
|
269
|
+
// Combined terms: aliases first, then the canonical base term.
|
|
270
|
+
const combinedBases = [...aliases, canonical];
|
|
271
|
+
// Build combined primary terms (with symbols) by looking up each base.
|
|
272
|
+
// Aliases only exist as redirects — we need to find their original term
|
|
273
|
+
// strings. Re-scan rows to recover the symbol form.
|
|
274
|
+
const aliasTermMap = new Map();
|
|
275
|
+
for (const row of dataRows) {
|
|
276
|
+
const b = stripSymbols(row[0]);
|
|
277
|
+
if (aliases.includes(b))
|
|
278
|
+
aliasTermMap.set(b, row[0].trim());
|
|
279
|
+
}
|
|
280
|
+
const combinedPrimary = [...aliases.map((a) => aliasTermMap.get(a) ?? a), entry.primaryTerm];
|
|
281
|
+
entry.combinedTerms = combinedBases;
|
|
282
|
+
entry.combinedTermList = formatList(combinedBases);
|
|
283
|
+
entry.combinedPrimaryTerms = combinedPrimary;
|
|
284
|
+
}
|
|
285
|
+
// Ensure every entry has combinedTermList set (entries with no aliases).
|
|
286
|
+
for (const entry of trademarks.values()) {
|
|
287
|
+
if (entry.combinedTermList === entry.baseTerm) {
|
|
288
|
+
entry.combinedTermList = formatList(entry.combinedTerms);
|
|
289
|
+
entry.combinedPrimaryTerms = entry.combinedPrimaryTerms.length
|
|
290
|
+
? entry.combinedPrimaryTerms
|
|
291
|
+
: [entry.primaryTerm];
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return trademarks;
|
|
295
|
+
}
|
|
296
|
+
// ---------------------------------------------------------------------------
|
|
297
|
+
// Text scanner
|
|
298
|
+
//
|
|
299
|
+
// Scans raw AsciiDoc source text for trademark base terms using whole-word
|
|
300
|
+
// regex. Multi-word terms (e.g. "Final Cut Pro") are handled correctly.
|
|
301
|
+
// Returns the set of base terms found.
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
function escapeRegex(s) {
|
|
304
|
+
// Escape regex metacharacters first, then normalize all hyphen variants
|
|
305
|
+
// (regular U+002D, non-breaking U+2011, AsciiDoc {nbhy} attribute) into a
|
|
306
|
+
// three-way alternation so terms are matched regardless of which form the
|
|
307
|
+
// author used in their .adoc source.
|
|
308
|
+
return s
|
|
309
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
310
|
+
.replace(/[-\u2011]|\\\{nbhy\}/g, '(?:-|\u2011|\\{nbhy\\})');
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Scan source text for trademark terms. Returns the set of matched base
|
|
314
|
+
* terms (keys in the trademarks map).
|
|
315
|
+
*/
|
|
316
|
+
function findTrademarks(sourceText, trademarks) {
|
|
317
|
+
const found = new Set();
|
|
318
|
+
for (const entry of trademarks.values()) {
|
|
319
|
+
// Check the canonical base term and every alias.
|
|
320
|
+
const termsToCheck = entry.combinedTerms;
|
|
321
|
+
for (const term of termsToCheck) {
|
|
322
|
+
const pattern = new RegExp(`\\b${escapeRegex(term)}\\b`, 'i');
|
|
323
|
+
if (pattern.test(sourceText)) {
|
|
324
|
+
found.add(entry.baseTerm);
|
|
325
|
+
break; // one match is enough for this canonical entry
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return found;
|
|
330
|
+
}
|
|
331
|
+
// ---------------------------------------------------------------------------
|
|
332
|
+
// Declaration generator
|
|
333
|
+
//
|
|
334
|
+
// Port of the declaration-building logic in trademark_it() in Ruby.
|
|
335
|
+
// Builds the right-column text: combined term list + verb + declaration phrase.
|
|
336
|
+
// ---------------------------------------------------------------------------
|
|
337
|
+
/**
|
|
338
|
+
* Build the declaration text for the right column of the output table.
|
|
339
|
+
*
|
|
340
|
+
* Ruby original:
|
|
341
|
+
* declaration_phrase = data[:declaration].sub(/^.*?(?: is | are )/, '')
|
|
342
|
+
* if terms_count > 1
|
|
343
|
+
* declaration_phrase.gsub!(/\ba registered trademark\b/i, 'registered trademarks')
|
|
344
|
+
* declaration_phrase.gsub!(/\ba trademark\b/i, 'trademarks')
|
|
345
|
+
* end
|
|
346
|
+
* right_text = "#{combined_term_str} #{verb_phrase} #{declaration_phrase}".strip
|
|
347
|
+
*/
|
|
348
|
+
function buildDeclaration(entry) {
|
|
349
|
+
const terms = entry.combinedTerms;
|
|
350
|
+
const count = terms.length;
|
|
351
|
+
const verb = count > 1 ? 'are' : 'is';
|
|
352
|
+
const termList = formatList(terms);
|
|
353
|
+
// Strip the original subject from the declaration sentence.
|
|
354
|
+
// e.g. "Apple is a registered trademark of Apple Inc."
|
|
355
|
+
// → "a registered trademark of Apple Inc."
|
|
356
|
+
let phrase = entry.declaration.replace(/^.*?(?= is | are )/, '').replace(/^ (is|are) /, '');
|
|
357
|
+
if (count > 1) {
|
|
358
|
+
phrase = phrase
|
|
359
|
+
.replace(/\ba registered trademark\b/gi, 'registered trademarks')
|
|
360
|
+
.replace(/\ba trademark\b/gi, 'trademarks');
|
|
361
|
+
}
|
|
362
|
+
return `${termList} ${verb} ${phrase}`.trim();
|
|
363
|
+
}
|
|
364
|
+
// ---------------------------------------------------------------------------
|
|
365
|
+
// AsciiDoc partial generator
|
|
366
|
+
// ---------------------------------------------------------------------------
|
|
367
|
+
/**
|
|
368
|
+
* Generate the content of the injected partial.
|
|
369
|
+
*
|
|
370
|
+
* Entries are sorted alphabetically by base term (case-insensitive),
|
|
371
|
+
* matching the Ruby sorted_data behaviour.
|
|
372
|
+
*/
|
|
373
|
+
function generateTrademarkPartial(foundBaseTerms, trademarks, cols = '22,78') {
|
|
374
|
+
const matched = [...trademarks.values()]
|
|
375
|
+
.filter((e) => foundBaseTerms.has(e.baseTerm))
|
|
376
|
+
.sort((a, b) => a.baseTerm.toLowerCase().localeCompare(b.baseTerm.toLowerCase()));
|
|
377
|
+
if (matched.length === 0) {
|
|
378
|
+
return '// No trademark terms detected in this component.\n';
|
|
379
|
+
}
|
|
380
|
+
const lines = [
|
|
381
|
+
'// Auto-generated by antora-trademark-it. Do not edit.',
|
|
382
|
+
`[cols="${cols}", frame=none, grid=none]`,
|
|
383
|
+
'|===',
|
|
384
|
+
];
|
|
385
|
+
for (const entry of matched) {
|
|
386
|
+
const leftCol = formatList(entry.combinedPrimaryTerms);
|
|
387
|
+
const rightCol = buildDeclaration(entry);
|
|
388
|
+
lines.push(`|${leftCol}`);
|
|
389
|
+
lines.push(`|${rightCol}`);
|
|
390
|
+
lines.push('');
|
|
391
|
+
}
|
|
392
|
+
lines.push('|===');
|
|
393
|
+
lines.push('');
|
|
394
|
+
return lines.join('\n');
|
|
395
|
+
}
|
|
396
|
+
// ---------------------------------------------------------------------------
|
|
397
|
+
// Antora extension entry point
|
|
398
|
+
// ---------------------------------------------------------------------------
|
|
399
|
+
function register(context) {
|
|
400
|
+
// Support both `this`-style and argument-style registration.
|
|
401
|
+
const ctx = context ?? this;
|
|
402
|
+
const logger = makeLogger(ctx.getLogger ? ctx.getLogger('trademark-it') : undefined);
|
|
403
|
+
let cfg = {
|
|
404
|
+
enabled: true,
|
|
405
|
+
trademark_file: 'ROOT:partial$trademark-table.adoc',
|
|
406
|
+
output_partial: 'generated-trademark-table.adoc',
|
|
407
|
+
ignore: [],
|
|
408
|
+
cols: '22,78',
|
|
409
|
+
};
|
|
410
|
+
ctx.once('playbookBuilt', async ({ playbook }) => {
|
|
411
|
+
const extEntry = (playbook?.antora?.extensions ?? []).find((ext) => {
|
|
412
|
+
const req = String(ext.require ?? '');
|
|
413
|
+
return req.includes('trademark-it') || req.includes('trademark_it');
|
|
414
|
+
}) ?? {};
|
|
415
|
+
const raw = extEntry.trademark_it ??
|
|
416
|
+
extEntry.trademarkIt ??
|
|
417
|
+
extEntry.trademarkit ??
|
|
418
|
+
{};
|
|
419
|
+
const rawRec = raw;
|
|
420
|
+
cfg = {
|
|
421
|
+
enabled: toBool(pick(rawRec, ['enabled'], cfg.enabled), cfg.enabled),
|
|
422
|
+
trademark_file: String(pick(rawRec, ['trademark_file', 'trademarkFile', 'trademarkfile'], cfg.trademark_file)),
|
|
423
|
+
output_partial: String(pick(rawRec, ['output_partial', 'outputPartial', 'outputpartial'], cfg.output_partial)),
|
|
424
|
+
ignore: ensureStringArray(pick(rawRec, ['ignore'], cfg.ignore)),
|
|
425
|
+
cols: String(pick(rawRec, ['cols'], cfg.cols)),
|
|
426
|
+
};
|
|
427
|
+
logger.debug(`trademark-it config: ${JSON.stringify(cfg)}`);
|
|
428
|
+
});
|
|
429
|
+
ctx.once('contentClassified', async ({ playbook, contentCatalog }) => {
|
|
430
|
+
if (!cfg.enabled) {
|
|
431
|
+
logger.debug('trademark-it disabled (skipped)');
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if (!contentCatalog) {
|
|
435
|
+
logger.error('contentCatalog is missing');
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
logger.event('trademark-it starting');
|
|
439
|
+
// -----------------------------------------------------------------------
|
|
440
|
+
// 1. Locate and parse the trademark definition file.
|
|
441
|
+
// -----------------------------------------------------------------------
|
|
442
|
+
const trademarkFileContent = resolveTrademarkFile(cfg.trademark_file, contentCatalog, playbook, logger);
|
|
443
|
+
if (!trademarkFileContent) {
|
|
444
|
+
logger.error(`trademark-it: could not locate trademark file "${cfg.trademark_file}". Skipping.`);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const trademarks = parseTrademarks(trademarkFileContent, cfg.ignore);
|
|
448
|
+
logger.debug(`trademark-it: parsed ${trademarks.size} canonical trademark entries`);
|
|
449
|
+
// -----------------------------------------------------------------------
|
|
450
|
+
// 2. Build list of component-versions present in the catalog.
|
|
451
|
+
// -----------------------------------------------------------------------
|
|
452
|
+
const componentVersions = getComponentVersions(contentCatalog);
|
|
453
|
+
logger.debug(`trademark-it: processing ${componentVersions.size} component-version(s)`);
|
|
454
|
+
// -----------------------------------------------------------------------
|
|
455
|
+
// 3. For each component-version: scan pages + partials, generate partial.
|
|
456
|
+
// -----------------------------------------------------------------------
|
|
457
|
+
for (const [component, versions] of componentVersions) {
|
|
458
|
+
for (const version of versions) {
|
|
459
|
+
const scanFiles = contentCatalog.getFiles().filter((f) => f.src.component === component &&
|
|
460
|
+
f.src.version === version &&
|
|
461
|
+
(f.src.family === 'page' || f.src.family === 'partial'));
|
|
462
|
+
if (scanFiles.length === 0)
|
|
463
|
+
continue;
|
|
464
|
+
// Concatenate all source text for this component-version.
|
|
465
|
+
const combinedText = scanFiles
|
|
466
|
+
.map((f) => f.contents.toString('utf8'))
|
|
467
|
+
.join('\n');
|
|
468
|
+
const found = findTrademarks(combinedText, trademarks);
|
|
469
|
+
logger.debug(`trademark-it: ${component}@${version} — scanned ${scanFiles.length} files, found ${found.size} trademark(s)`);
|
|
470
|
+
const partialContent = generateTrademarkPartial(found, trademarks, cfg.cols);
|
|
471
|
+
// -----------------------------------------------------------------------
|
|
472
|
+
// 4. Inject generated partial into catalog.
|
|
473
|
+
// -----------------------------------------------------------------------
|
|
474
|
+
const relative = cfg.output_partial;
|
|
475
|
+
const basename = relative.split('/').pop() ?? relative;
|
|
476
|
+
const stem = basename.replace(/\.[^.]+$/, '');
|
|
477
|
+
const extname = basename.includes('.') ? `.${basename.split('.').pop()}` : '';
|
|
478
|
+
contentCatalog.addFile({
|
|
479
|
+
contents: Buffer.from(partialContent, 'utf8'),
|
|
480
|
+
src: {
|
|
481
|
+
component,
|
|
482
|
+
version,
|
|
483
|
+
module: 'ROOT',
|
|
484
|
+
family: 'partial',
|
|
485
|
+
relative,
|
|
486
|
+
path: `modules/ROOT/partials/${relative}`,
|
|
487
|
+
basename,
|
|
488
|
+
stem,
|
|
489
|
+
extname,
|
|
490
|
+
mediaType: 'text/asciidoc',
|
|
491
|
+
origin: undefined,
|
|
492
|
+
},
|
|
493
|
+
});
|
|
494
|
+
logger.debug(`trademark-it: injected partial$${relative} into ${component}@${version}`);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
logger.event('trademark-it finished');
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
// ---------------------------------------------------------------------------
|
|
501
|
+
// Helpers
|
|
502
|
+
// ---------------------------------------------------------------------------
|
|
503
|
+
/**
|
|
504
|
+
* Locate the trademark definition file.
|
|
505
|
+
*
|
|
506
|
+
* Tries three strategies in order:
|
|
507
|
+
* 1. Antora resource ID lookup via getFiles() filter.
|
|
508
|
+
* 2. Filesystem path (absolute or playbook-relative).
|
|
509
|
+
* 3. Filename-only match across all catalog partials.
|
|
510
|
+
*/
|
|
511
|
+
function resolveTrademarkFile(trademarkFileRef, contentCatalog, playbook, logger) {
|
|
512
|
+
// Strategy 1: catalog lookup by partial path / resource ID components.
|
|
513
|
+
// Accept formats like: "ROOT:partial$trademark-table.adoc"
|
|
514
|
+
// or "1.0@trademarks:ROOT:partial$trademark-table.adoc"
|
|
515
|
+
const catalogFile = contentCatalog.getFiles().find((f) => {
|
|
516
|
+
if (f.src.family !== 'partial')
|
|
517
|
+
return false;
|
|
518
|
+
const rel = f.src.relative ?? '';
|
|
519
|
+
const resourceId = `${f.src.module ?? 'ROOT'}:partial$${rel}`;
|
|
520
|
+
// Match against the end of the provided ref so short refs work.
|
|
521
|
+
return (resourceId === trademarkFileRef ||
|
|
522
|
+
resourceId.endsWith(trademarkFileRef) ||
|
|
523
|
+
rel === trademarkFileRef ||
|
|
524
|
+
rel.endsWith(trademarkFileRef));
|
|
525
|
+
});
|
|
526
|
+
if (catalogFile) {
|
|
527
|
+
logger.debug(`trademark-it: trademark file resolved from catalog (${catalogFile.src.path})`);
|
|
528
|
+
return catalogFile.contents.toString('utf8');
|
|
529
|
+
}
|
|
530
|
+
// Strategy 2: filesystem path.
|
|
531
|
+
const fsPath = trademarkFileRef.startsWith('/')
|
|
532
|
+
? trademarkFileRef
|
|
533
|
+
: `${playbook.dir}/${trademarkFileRef}`;
|
|
534
|
+
if (fs.existsSync(fsPath)) {
|
|
535
|
+
logger.debug(`trademark-it: trademark file resolved from filesystem (${fsPath})`);
|
|
536
|
+
return fs.readFileSync(fsPath, 'utf8');
|
|
537
|
+
}
|
|
538
|
+
// Strategy 3: basename-only match against all catalog partials.
|
|
539
|
+
const basename = trademarkFileRef.split(/[\\/]/).pop() ?? trademarkFileRef;
|
|
540
|
+
const fallback = contentCatalog.getFiles().find((f) => f.src.family === 'partial' && f.src.basename === basename);
|
|
541
|
+
if (fallback) {
|
|
542
|
+
logger.debug(`trademark-it: trademark file resolved by basename fallback (${fallback.src.path})`);
|
|
543
|
+
return fallback.contents.toString('utf8');
|
|
544
|
+
}
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* Derive the set of unique component-version pairs from the catalog.
|
|
549
|
+
* Returns a Map<component, Set<version>>.
|
|
550
|
+
*/
|
|
551
|
+
function getComponentVersions(contentCatalog) {
|
|
552
|
+
const result = new Map();
|
|
553
|
+
for (const f of contentCatalog.getFiles()) {
|
|
554
|
+
const c = f.src.component;
|
|
555
|
+
const v = f.src.version;
|
|
556
|
+
if (!c || !v)
|
|
557
|
+
continue;
|
|
558
|
+
const versions = result.get(c) ?? new Set();
|
|
559
|
+
versions.add(v);
|
|
560
|
+
result.set(c, versions);
|
|
561
|
+
}
|
|
562
|
+
return result;
|
|
563
|
+
}
|
|
564
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AAC,EAAE,QAAQ,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baiyibai-antora/extensions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Antora extensions and AsciiDoc macros for Baiyibai documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antora",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
|
-
"url": "https://gitlab.com/baiyibai-antora/baiyibai-extensions"
|
|
19
|
+
"url": "git+https://gitlab.com/baiyibai-antora/baiyibai-extensions.git"
|
|
20
20
|
},
|
|
21
21
|
"type": "commonjs",
|
|
22
22
|
"engines": {
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
"./list-of-site": {
|
|
51
51
|
"require": "./dist/extensions/list-of-site/index.js",
|
|
52
52
|
"types": "./dist/extensions/list-of-site/index.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"./trademark-it": {
|
|
55
|
+
"require": "./dist/extensions/trademark-it/index.js",
|
|
56
|
+
"types": "./dist/extensions/trademark-it/index.d.ts"
|
|
53
57
|
}
|
|
54
58
|
},
|
|
55
59
|
"files": [
|