@asciidoctor/core 3.0.4 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -10
- package/build/browser/index.js +24154 -0
- package/build/node/index.cjs +24735 -0
- package/{dist/css/asciidoctor.css → data/asciidoctor-default.css} +54 -53
- package/package.json +53 -100
- package/src/abstract_block.js +849 -0
- package/src/abstract_node.js +954 -0
- package/src/attribute_entry.js +12 -0
- package/src/attribute_list.js +380 -0
- package/src/block.js +168 -0
- package/src/browser/asset.js +22 -0
- package/src/browser/reader.js +138 -0
- package/src/browser.js +121 -0
- package/src/callouts.js +85 -0
- package/src/compliance.js +54 -0
- package/src/constants.js +665 -0
- package/src/convert.js +370 -0
- package/src/converter/composite.js +83 -0
- package/src/converter/docbook5.js +1031 -0
- package/src/converter/html5.js +1899 -0
- package/src/converter/manpage.js +935 -0
- package/src/converter/template.js +459 -0
- package/src/converter.js +478 -0
- package/src/data/stylesheet-data.js +2 -0
- package/src/document.js +2134 -0
- package/src/extensions.js +1952 -0
- package/src/footnote.js +28 -0
- package/src/helpers.js +355 -0
- package/src/index.js +138 -0
- package/src/inline.js +158 -0
- package/src/list.js +240 -0
- package/src/load.js +276 -0
- package/src/logging.js +526 -0
- package/src/parser.js +3661 -0
- package/src/path_resolver.js +472 -0
- package/src/reader.js +1755 -0
- package/src/rx.js +829 -0
- package/src/section.js +354 -0
- package/src/stylesheets.js +30 -0
- package/src/substitutors.js +2241 -0
- package/src/syntaxHighlighter/highlightjs.js +90 -0
- package/src/syntaxHighlighter/html_pipeline.js +33 -0
- package/src/syntax_highlighter.js +304 -0
- package/src/table.js +952 -0
- package/src/timings.js +78 -0
- package/types/abstract_block.d.ts +343 -0
- package/types/abstract_node.d.ts +471 -0
- package/types/attribute_entry.d.ts +7 -0
- package/types/attribute_list.d.ts +52 -0
- package/types/block.d.ts +55 -0
- package/types/browser/asset.d.ts +7 -0
- package/types/browser/reader.d.ts +29 -0
- package/types/callouts.d.ts +36 -0
- package/types/compliance.d.ts +23 -0
- package/types/constants.d.ts +268 -0
- package/types/convert.d.ts +34 -0
- package/types/converter/composite.d.ts +20 -0
- package/types/converter/docbook5.d.ts +41 -0
- package/types/converter/html5.d.ts +51 -0
- package/types/converter/manpage.d.ts +59 -0
- package/types/converter/template.d.ts +83 -0
- package/types/converter.d.ts +150 -0
- package/types/data/stylesheet-data.d.ts +2 -0
- package/types/document.d.ts +495 -0
- package/types/extensions.d.ts +876 -0
- package/types/footnote.d.ts +18 -0
- package/types/helpers.d.ts +146 -0
- package/types/index.d.ts +73 -3731
- package/types/inline.d.ts +69 -0
- package/types/list.d.ts +114 -0
- package/types/load.d.ts +39 -0
- package/types/logging.d.ts +187 -0
- package/types/parser.d.ts +114 -0
- package/types/path_resolver.d.ts +103 -0
- package/types/reader.d.ts +184 -0
- package/types/rx.d.ts +513 -0
- package/types/section.d.ts +122 -0
- package/types/stylesheets.d.ts +10 -0
- package/types/substitutors.d.ts +208 -0
- package/types/syntaxHighlighter/highlightjs.d.ts +33 -0
- package/types/syntaxHighlighter/html_pipeline.d.ts +16 -0
- package/types/syntax_highlighter.d.ts +167 -0
- package/types/table.d.ts +231 -0
- package/types/timings.d.ts +25 -0
- package/types/tsconfig.json +9 -0
- package/LICENSE +0 -21
- package/dist/browser/asciidoctor.js +0 -47654
- package/dist/browser/asciidoctor.min.js +0 -1452
- package/dist/graalvm/asciidoctor.js +0 -47402
- package/dist/node/asciidoctor.cjs +0 -21567
- package/dist/node/asciidoctor.js +0 -23037
package/src/converter.js
ADDED
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
/** @import { AbstractNode } from './abstract_node.js' */
|
|
2
|
+
|
|
3
|
+
// ESM conversion of converter.rb
|
|
4
|
+
//
|
|
5
|
+
// Ruby-to-JavaScript notes:
|
|
6
|
+
// - Ruby module Converter → exported plain object + classes.
|
|
7
|
+
// - Ruby's `include Converter` mixin → JS class extends ConverterBase or implements the interface manually.
|
|
8
|
+
// - BackendTraits Ruby module → plain mixin object applied via applyBackendTraits().
|
|
9
|
+
// - DefaultFactory's thread-safe synchronization → not needed in single-threaded JS.
|
|
10
|
+
// - TemplateConverter / CompositeConverter autoloaded → imported lazily via dynamic import() stubs.
|
|
11
|
+
// - Converter.derive_backend_traits exposed as static function.
|
|
12
|
+
// - DEFAULT_EXTENSIONS / TrailingDigitsRx imported from constants/rx.
|
|
13
|
+
|
|
14
|
+
import { applyLogging } from './logging.js'
|
|
15
|
+
import { DEFAULT_EXTENSIONS } from './constants.js'
|
|
16
|
+
import { TrailingDigitsRx } from './rx.js'
|
|
17
|
+
|
|
18
|
+
// ── BackendTraits mixin ───────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Apply the BackendTraits mixin to a converter instance to give it
|
|
22
|
+
* basebackend/filetype/htmlsyntax/outfilesuffix helpers.
|
|
23
|
+
*
|
|
24
|
+
* @param {object} instance - the converter instance to augment
|
|
25
|
+
*/
|
|
26
|
+
export function applyBackendTraits(instance) {
|
|
27
|
+
instance._backendTraits = null
|
|
28
|
+
|
|
29
|
+
instance.basebackend = function (value = null) {
|
|
30
|
+
if (value) {
|
|
31
|
+
const traits = (this._backendTraits ??= {})
|
|
32
|
+
traits.basebackend = value
|
|
33
|
+
// Derive filetype/outfilesuffix/htmlsyntax from the new basebackend when not already set
|
|
34
|
+
// (mirrors Ruby's Converter::Base#derive_backend_traits behaviour)
|
|
35
|
+
const derived = deriveBackendTraits(value)
|
|
36
|
+
if (!traits.outfilesuffix) traits.outfilesuffix = derived.outfilesuffix
|
|
37
|
+
if (!traits.filetype) traits.filetype = derived.filetype
|
|
38
|
+
if (derived.htmlsyntax && !traits.htmlsyntax)
|
|
39
|
+
traits.htmlsyntax = derived.htmlsyntax
|
|
40
|
+
return value
|
|
41
|
+
}
|
|
42
|
+
return this._getBackendTraits().basebackend
|
|
43
|
+
}
|
|
44
|
+
instance.filetype = function (value = null) {
|
|
45
|
+
if (value) return (this._getBackendTraits().filetype = value)
|
|
46
|
+
return this._getBackendTraits().filetype
|
|
47
|
+
}
|
|
48
|
+
instance.htmlsyntax = function (value = null) {
|
|
49
|
+
if (value) return (this._getBackendTraits().htmlsyntax = value)
|
|
50
|
+
return this._getBackendTraits().htmlsyntax
|
|
51
|
+
}
|
|
52
|
+
instance.outfilesuffix = function (value = null) {
|
|
53
|
+
if (value) return (this._getBackendTraits().outfilesuffix = value)
|
|
54
|
+
return this._getBackendTraits().outfilesuffix
|
|
55
|
+
}
|
|
56
|
+
instance.supportsTemplates = function (value = true) {
|
|
57
|
+
this._getBackendTraits().supportsTemplates = value
|
|
58
|
+
}
|
|
59
|
+
instance.supportsTemplates.call = (value = true) =>
|
|
60
|
+
instance.supportsTemplates(value)
|
|
61
|
+
instance.hasSupportsTemplates = function () {
|
|
62
|
+
return !!this._getBackendTraits().supportsTemplates
|
|
63
|
+
}
|
|
64
|
+
instance.initBackendTraits = function (value = null) {
|
|
65
|
+
this._backendTraits = value ?? {}
|
|
66
|
+
}
|
|
67
|
+
instance._getBackendTraits = function (basebackend = null) {
|
|
68
|
+
return (this._backendTraits ??= deriveBackendTraits(
|
|
69
|
+
this.backend,
|
|
70
|
+
basebackend
|
|
71
|
+
))
|
|
72
|
+
}
|
|
73
|
+
instance.backendInfo = instance._getBackendTraits
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ── Converter.derive_backend_traits ──────────────────────────────────────────
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Derive the backend traits object from a backend name.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} backend - the backend name (e.g. 'html5', 'docbook5')
|
|
82
|
+
* @param {string|null} [basebackend=null] - optional explicit base backend
|
|
83
|
+
* @returns {{ basebackend: string, filetype: string, outfilesuffix: string, htmlsyntax?: string }}
|
|
84
|
+
*/
|
|
85
|
+
export function deriveBackendTraits(backend, basebackend = null) {
|
|
86
|
+
if (!backend) return {}
|
|
87
|
+
const base = basebackend ?? backend.replace(TrailingDigitsRx, '')
|
|
88
|
+
let outfilesuffix = DEFAULT_EXTENSIONS[base]
|
|
89
|
+
let filetype
|
|
90
|
+
if (outfilesuffix) {
|
|
91
|
+
filetype = outfilesuffix.slice(1)
|
|
92
|
+
} else {
|
|
93
|
+
filetype = base
|
|
94
|
+
outfilesuffix = `.${filetype}`
|
|
95
|
+
}
|
|
96
|
+
const traits = { basebackend: base, filetype, outfilesuffix }
|
|
97
|
+
if (filetype === 'html') traits.htmlsyntax = 'html'
|
|
98
|
+
return traits
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ── normalizeConverter ────────────────────────────────────────────────────────
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Bridge a user-registered converter instance into the interface expected by
|
|
105
|
+
* Document._updateBackendAttributes, which requires _getBackendTraits().
|
|
106
|
+
*
|
|
107
|
+
* Supports three conventions used by user converters:
|
|
108
|
+
* 1. `converter.backendTraits = { basebackend, outfilesuffix, filetype, htmlsyntax }`
|
|
109
|
+
* 2. Plain properties: `converter.basebackend`, `converter.outfilesuffix`, …
|
|
110
|
+
* 3. Already has `_getBackendTraits()` (e.g. extends ConverterBase) — returned as-is.
|
|
111
|
+
*
|
|
112
|
+
* @param {object} converter - the converter to normalise
|
|
113
|
+
* @param {string} backend - the backend name
|
|
114
|
+
* @returns {object} the normalised converter
|
|
115
|
+
*/
|
|
116
|
+
export function normalizeConverter(converter, backend) {
|
|
117
|
+
if (!converter || typeof converter._getBackendTraits === 'function')
|
|
118
|
+
return converter
|
|
119
|
+
|
|
120
|
+
let traits = null
|
|
121
|
+
if (converter.backendTraits && typeof converter.backendTraits === 'object') {
|
|
122
|
+
traits = { ...converter.backendTraits }
|
|
123
|
+
} else {
|
|
124
|
+
const hasPlain =
|
|
125
|
+
converter.basebackend ||
|
|
126
|
+
converter.outfilesuffix ||
|
|
127
|
+
converter.filetype ||
|
|
128
|
+
converter.htmlsyntax
|
|
129
|
+
if (hasPlain) {
|
|
130
|
+
traits = {}
|
|
131
|
+
if (converter.basebackend) traits.basebackend = converter.basebackend
|
|
132
|
+
if (converter.outfilesuffix)
|
|
133
|
+
traits.outfilesuffix = converter.outfilesuffix
|
|
134
|
+
if (converter.filetype) traits.filetype = converter.filetype
|
|
135
|
+
if (converter.htmlsyntax) traits.htmlsyntax = converter.htmlsyntax
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Apply the BackendTraits mixin so Document can call the standard accessor methods.
|
|
140
|
+
applyBackendTraits(converter)
|
|
141
|
+
if (traits) {
|
|
142
|
+
converter._backendTraits = traits
|
|
143
|
+
} else if (backend && !('backend' in converter)) {
|
|
144
|
+
// Converter has no explicit traits and no backend property: derive traits
|
|
145
|
+
// from the backend name so that filetype/outfilesuffix are not left empty.
|
|
146
|
+
converter._backendTraits = deriveBackendTraits(backend)
|
|
147
|
+
}
|
|
148
|
+
return converter
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ── CustomFactory ─────────────────────────────────────────────────────────────
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* A factory that maps backend names to converter classes or instances.
|
|
155
|
+
* Use the global {@link Converter} instance (DefaultFactory) for typical use.
|
|
156
|
+
*/
|
|
157
|
+
export class CustomFactory {
|
|
158
|
+
constructor(seedRegistry = null) {
|
|
159
|
+
this._registry = {}
|
|
160
|
+
this._catchAll = null
|
|
161
|
+
if (seedRegistry) {
|
|
162
|
+
const star = seedRegistry['*']
|
|
163
|
+
delete seedRegistry['*']
|
|
164
|
+
if (star) this._catchAll = star
|
|
165
|
+
Object.assign(this._registry, seedRegistry)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Register a converter class for one or more backend names.
|
|
171
|
+
* Backends may be passed as individual strings or as a single Array.
|
|
172
|
+
*
|
|
173
|
+
* @param {Function|object} converter - the converter class or instance
|
|
174
|
+
* @param {...string} backends - backend names; use `'*'` as a catch-all
|
|
175
|
+
*/
|
|
176
|
+
register(converter, ...backends) {
|
|
177
|
+
if (backends.length === 1 && Array.isArray(backends[0]))
|
|
178
|
+
backends = backends[0]
|
|
179
|
+
for (const backend of backends) {
|
|
180
|
+
if (backend === '*') this._catchAll = converter
|
|
181
|
+
else this._registry[backend] = converter
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Retrieve the converter class registered for the given backend.
|
|
187
|
+
* Returns `undefined` (not null) when no match is found, mirroring the core API.
|
|
188
|
+
*
|
|
189
|
+
* @param {string} backend - the backend name
|
|
190
|
+
* @returns {Function|object|undefined}
|
|
191
|
+
*/
|
|
192
|
+
for(backend) {
|
|
193
|
+
return this._registry[backend] ?? this._catchAll ?? undefined
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Create a new converter instance for the given backend (synchronous).
|
|
198
|
+
* Requires the converter class to already be registered; does not support template dirs.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} backend - the backend name
|
|
201
|
+
* @param {object} [opts={}] - options passed to the converter constructor
|
|
202
|
+
* @returns {object|null} the converter instance, or null if not registered
|
|
203
|
+
*/
|
|
204
|
+
createSync(backend, opts = {}) {
|
|
205
|
+
let converter = this.for(backend)
|
|
206
|
+
if (!converter) return null
|
|
207
|
+
if (typeof converter === 'function' && converter.prototype)
|
|
208
|
+
converter = new converter(backend, opts)
|
|
209
|
+
return normalizeConverter(converter, backend)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Create a new converter instance for the given backend.
|
|
214
|
+
*
|
|
215
|
+
* @param {string} backend - the backend name
|
|
216
|
+
* @param {object} [opts={}] - options passed to the converter constructor
|
|
217
|
+
* @returns {Promise<object|null>} the converter instance, or null if not registered
|
|
218
|
+
*/
|
|
219
|
+
async create(backend, opts = {}) {
|
|
220
|
+
let converter = this.for(backend)
|
|
221
|
+
if (converter) {
|
|
222
|
+
if (typeof converter === 'function' && converter.prototype) {
|
|
223
|
+
converter = new converter(backend, opts)
|
|
224
|
+
}
|
|
225
|
+
const templateDirs = opts.template_dirs
|
|
226
|
+
if (
|
|
227
|
+
templateDirs &&
|
|
228
|
+
typeof converter.hasSupportsTemplates === 'function' &&
|
|
229
|
+
converter.hasSupportsTemplates()
|
|
230
|
+
) {
|
|
231
|
+
const { CompositeConverter } = await import('./converter/composite.js')
|
|
232
|
+
const { TemplateConverter } = await import('./converter/template.js')
|
|
233
|
+
return new CompositeConverter(
|
|
234
|
+
backend,
|
|
235
|
+
await TemplateConverter.create(backend, templateDirs, opts),
|
|
236
|
+
converter,
|
|
237
|
+
{ backendTraitsSource: converter }
|
|
238
|
+
)
|
|
239
|
+
}
|
|
240
|
+
return converter
|
|
241
|
+
}
|
|
242
|
+
const templateDirs = opts.template_dirs
|
|
243
|
+
if (templateDirs) {
|
|
244
|
+
const delegateBackend = opts.delegate_backend
|
|
245
|
+
if (delegateBackend) {
|
|
246
|
+
let delegateConverter = this.for(delegateBackend)
|
|
247
|
+
if (delegateConverter) {
|
|
248
|
+
if (
|
|
249
|
+
typeof delegateConverter === 'function' &&
|
|
250
|
+
delegateConverter.prototype
|
|
251
|
+
) {
|
|
252
|
+
delegateConverter = new delegateConverter(delegateBackend, opts)
|
|
253
|
+
}
|
|
254
|
+
const { CompositeConverter } = await import(
|
|
255
|
+
'./converter/composite.js'
|
|
256
|
+
)
|
|
257
|
+
const { TemplateConverter } = await import('./converter/template.js')
|
|
258
|
+
return new CompositeConverter(
|
|
259
|
+
backend,
|
|
260
|
+
await TemplateConverter.create(backend, templateDirs, opts),
|
|
261
|
+
delegateConverter,
|
|
262
|
+
{ backendTraitsSource: delegateConverter }
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const { TemplateConverter } = await import('./converter/template.js')
|
|
267
|
+
return await TemplateConverter.create(backend, templateDirs, opts)
|
|
268
|
+
}
|
|
269
|
+
return null
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Get the registered converters map.
|
|
274
|
+
*
|
|
275
|
+
* @returns {object} a shallow copy of the registry
|
|
276
|
+
*/
|
|
277
|
+
converters() {
|
|
278
|
+
return { ...this._registry }
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Unregister all converters.
|
|
283
|
+
*/
|
|
284
|
+
unregisterAll() {
|
|
285
|
+
this._registry = {}
|
|
286
|
+
this._catchAll = null
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ── DefaultFactory ────────────────────────────────────────────────────────────
|
|
291
|
+
// Global registry of built-in + statically registered converters.
|
|
292
|
+
|
|
293
|
+
// Static per-backend imports allow bundlers (Rollup/Vite) to inline each module.
|
|
294
|
+
async function _importBuiltinConverter(backend) {
|
|
295
|
+
if (backend === 'html5') return import('./converter/html5.js')
|
|
296
|
+
if (backend === 'docbook5') return import('./converter/docbook5.js')
|
|
297
|
+
if (backend === 'manpage') return import('./converter/manpage.js')
|
|
298
|
+
return null
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export class DefaultFactory extends CustomFactory {
|
|
302
|
+
constructor() {
|
|
303
|
+
super()
|
|
304
|
+
this._defaultRegistry = {} // separate from CustomFactory._registry (for unregisterAll)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
register(converter, ...backends) {
|
|
308
|
+
// User registrations go into _registry (CustomFactory layer) so that unregisterAll()
|
|
309
|
+
// can remove them without touching the lazy-loaded built-in entries in _defaultRegistry.
|
|
310
|
+
// backends may be passed as individual strings or as a single Array.
|
|
311
|
+
if (backends.length === 1 && Array.isArray(backends[0]))
|
|
312
|
+
backends = backends[0]
|
|
313
|
+
for (const backend of backends) {
|
|
314
|
+
if (backend === '*') this._catchAll = converter
|
|
315
|
+
else this._registry[backend] = converter
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
for(backend) {
|
|
320
|
+
// User registrations first (_registry), then lazy-loaded built-ins (_defaultRegistry),
|
|
321
|
+
// then catch-all. Returns undefined when no match is found, mirroring the core API.
|
|
322
|
+
return (
|
|
323
|
+
this._registry[backend] ??
|
|
324
|
+
this._defaultRegistry[backend] ??
|
|
325
|
+
this._catchAll ??
|
|
326
|
+
undefined
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Return the combined registry (built-in + user-registered entries).
|
|
332
|
+
*
|
|
333
|
+
* @returns {object}
|
|
334
|
+
*/
|
|
335
|
+
getRegistry() {
|
|
336
|
+
return { ...this._defaultRegistry, ...this._registry }
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Return this factory (mirrors the core ConverterFactory.getDefault() API).
|
|
341
|
+
*
|
|
342
|
+
* @returns {DefaultFactory}
|
|
343
|
+
*/
|
|
344
|
+
getDefault() {
|
|
345
|
+
return this
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
createSync(backend, opts = {}) {
|
|
349
|
+
let converter =
|
|
350
|
+
this._registry[backend] ??
|
|
351
|
+
this._defaultRegistry[backend] ??
|
|
352
|
+
this._catchAll
|
|
353
|
+
if (!converter) return null
|
|
354
|
+
if (typeof converter === 'function' && converter.prototype)
|
|
355
|
+
converter = new converter(backend, opts)
|
|
356
|
+
return normalizeConverter(converter, backend)
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
async create(backend, opts = {}) {
|
|
360
|
+
let converter = this._registry[backend] ?? this._defaultRegistry[backend]
|
|
361
|
+
if (!converter) {
|
|
362
|
+
const mod = await _importBuiltinConverter(backend)
|
|
363
|
+
if (mod) {
|
|
364
|
+
converter = mod.default ?? Object.values(mod)[0]
|
|
365
|
+
if (converter) this._defaultRegistry[backend] = converter
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (!converter) converter = this._catchAll
|
|
369
|
+
if (!converter) {
|
|
370
|
+
const templateDirs = opts.template_dirs
|
|
371
|
+
if (templateDirs) {
|
|
372
|
+
const { TemplateConverter } = await import('./converter/template.js')
|
|
373
|
+
return await TemplateConverter.create(backend, templateDirs, opts)
|
|
374
|
+
}
|
|
375
|
+
return null
|
|
376
|
+
}
|
|
377
|
+
if (typeof converter === 'function' && converter.prototype) {
|
|
378
|
+
converter = new converter(backend, opts)
|
|
379
|
+
}
|
|
380
|
+
const templateDirs = opts.template_dirs
|
|
381
|
+
if (
|
|
382
|
+
templateDirs &&
|
|
383
|
+
typeof converter.hasSupportsTemplates === 'function' &&
|
|
384
|
+
converter.hasSupportsTemplates()
|
|
385
|
+
) {
|
|
386
|
+
const { CompositeConverter } = await import('./converter/composite.js')
|
|
387
|
+
const { TemplateConverter } = await import('./converter/template.js')
|
|
388
|
+
return new CompositeConverter(
|
|
389
|
+
backend,
|
|
390
|
+
await TemplateConverter.create(backend, templateDirs, opts),
|
|
391
|
+
converter,
|
|
392
|
+
{ backendTraitsSource: converter }
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
return converter
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
unregisterAll() {
|
|
399
|
+
// Keep built-in entries; clear only custom and catch-all
|
|
400
|
+
this._registry = {}
|
|
401
|
+
this._catchAll = null
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// ── The global Converter registry ─────────────────────────────────────────────
|
|
406
|
+
|
|
407
|
+
export const Converter = new DefaultFactory()
|
|
408
|
+
|
|
409
|
+
// Attach derive_backend_traits as a property for compatibility
|
|
410
|
+
Converter.deriveBackendTraits = deriveBackendTraits
|
|
411
|
+
|
|
412
|
+
// ── Converter.Base ────────────────────────────────────────────────────────────
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Base class for all Asciidoctor converters.
|
|
416
|
+
*
|
|
417
|
+
* Subclass ConverterBase and implement `convert_<nodeName>` methods to handle
|
|
418
|
+
* specific node types. Register the subclass with the global registry via
|
|
419
|
+
* {@link ConverterBase.registerFor}.
|
|
420
|
+
*/
|
|
421
|
+
export class ConverterBase {
|
|
422
|
+
constructor(backend, opts = {}) {
|
|
423
|
+
this.backend = backend
|
|
424
|
+
applyBackendTraits(this)
|
|
425
|
+
applyLogging(this)
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Convert a node by dispatching to a `convert_<transform>` method.
|
|
430
|
+
*
|
|
431
|
+
* @param {AbstractNode} node - the AbstractNode to convert
|
|
432
|
+
* @param {string|null=} transform - hint for which method to call (default: node.nodeName)
|
|
433
|
+
* @param {object|null=} opts - optional hints
|
|
434
|
+
* @returns {Promise<unknown>|unknown} the result of the `convert_<transform>` handler; the actual type depends on the implementation
|
|
435
|
+
*/
|
|
436
|
+
convert(node, transform = null, opts = null) {
|
|
437
|
+
const method = `convert_${transform ?? node.nodeName}`
|
|
438
|
+
if (typeof this[method] === 'function') {
|
|
439
|
+
return opts ? this[method](node, opts) : this[method](node)
|
|
440
|
+
}
|
|
441
|
+
this.logger.warn(
|
|
442
|
+
`missing convert handler for ${transform ?? node.nodeName} node in ${this.backend} backend (${this.constructor.name})`
|
|
443
|
+
)
|
|
444
|
+
return null
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Report whether this converter can handle the given transform.
|
|
449
|
+
*
|
|
450
|
+
* @param {string} transform - the transform name
|
|
451
|
+
* @returns {boolean}
|
|
452
|
+
*/
|
|
453
|
+
handles(transform) {
|
|
454
|
+
return typeof this[`convert_${transform}`] === 'function'
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Convert using only content (no wrapping).
|
|
459
|
+
*
|
|
460
|
+
* @param {object} node - the node whose content to return
|
|
461
|
+
* @returns {Promise<string>}
|
|
462
|
+
*/
|
|
463
|
+
async contentOnly(node) {
|
|
464
|
+
return node.content()
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** Skip conversion (no-op). */
|
|
468
|
+
skip(_node) {}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Register this converter class with the global registry.
|
|
472
|
+
*
|
|
473
|
+
* @param {...string} backends - backend names to register for
|
|
474
|
+
*/
|
|
475
|
+
static registerFor(...backends) {
|
|
476
|
+
Converter.register(this, ...backends.map(String))
|
|
477
|
+
}
|
|
478
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// Auto-generated from data/asciidoctor-default.css — run 'npm run build:data' to update
|
|
2
|
+
export default "/*! Asciidoctor default stylesheet | MIT License | https://asciidoctor.org */\n/* Uncomment the following line when using as a custom stylesheet */\n/* @import \"https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700\"; */\nhtml{font-family:sans-serif;-webkit-text-size-adjust:100%}\na{background:none}\na:focus{outline:thin dotted}\na:active,a:hover{outline:0}\nh1{font-size:2em;margin:.67em 0}\nb,strong{font-weight:bold}\nabbr{font-size:.9em}\nabbr[title]{cursor:help;border-bottom:1px dotted #dddddf;text-decoration:none}\ndfn{font-style:italic}\nhr{height:0}\nmark{background:#ff0;color:#000}\ncode,kbd,pre,samp{font-family:monospace;font-size:1em}\npre{white-space:pre-wrap}\nq{quotes:\"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\"}\nsmall{font-size:80%}\nsub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}\nsup{top:-.5em}\nsub{bottom:-.25em}\nimg{border:0}\nsvg:not(:root){overflow:hidden}\nfigure{margin:0}\naudio,video{display:inline-block}\naudio:not([controls]){display:none;height:0}\nfieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}\nlegend{border:0;padding:0}\nbutton,input,select,textarea{font-family:inherit;font-size:100%;margin:0}\nbutton,input{line-height:normal}\nbutton,select{text-transform:none}\nbutton,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}\nbutton[disabled],html input[disabled]{cursor:default}\ninput[type=checkbox],input[type=radio]{padding:0}\nbutton::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}\ntextarea{overflow:auto;vertical-align:top}\ntable{border-collapse:collapse;border-spacing:0}\n*,::before,::after{box-sizing:border-box}\nhtml,body{font-size:100%}\nbody{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:\"Noto Serif\",\"DejaVu Serif\",serif;line-height:1;position:relative;cursor:auto;-moz-tab-size:4;-o-tab-size:4;tab-size:4;word-wrap:anywhere;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}\na:hover{cursor:pointer}\nimg,object,embed{max-width:100%;height:auto}\nobject,embed{height:100%}\nimg{-ms-interpolation-mode:bicubic}\n.left{float:left!important}\n.right{float:right!important}\n.text-left{text-align:left!important}\n.text-right{text-align:right!important}\n.text-center{text-align:center!important}\n.text-justify{text-align:justify!important}\n.hide{display:none}\nimg,object,svg{display:inline-block;vertical-align:middle}\ntextarea{height:auto;min-height:50px}\nselect{width:100%}\n.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}\ndiv,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0}\na{color:#2156a5;text-decoration:underline;line-height:inherit}\na:hover,a:focus{color:#1d4b8f}\na img{border:0}\np{line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}\np aside{font-size:.875em;line-height:1.35;font-style:italic}\nh1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:\"Open Sans\",\"DejaVu Sans\",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}\nh1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}\nh1{font-size:2.125em}\nh2{font-size:1.6875em}\nh3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}\nh4,h5{font-size:1.125em}\nh6{font-size:1em}\nhr{border:solid #dddddf;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em}\nem,i{font-style:italic;line-height:inherit}\nstrong,b{font-weight:bold;line-height:inherit}\nsmall{font-size:60%;line-height:inherit}\ncode{font-family:\"Droid Sans Mono\",\"DejaVu Sans Mono\",monospace;font-weight:400;color:rgba(0,0,0,.9)}\nul,ol,dl{line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}\nul,ol{margin-left:1.5em}\nul li ul,ul li ol{margin-left:1.25em;margin-bottom:0}\nul.circle{list-style-type:circle}\nul.disc{list-style-type:disc}\nul.square{list-style-type:square}\nul.circle ul:not([class]),ul.disc ul:not([class]),ul.square ul:not([class]){list-style:inherit}\nol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}\ndl dt{margin-bottom:.3125em;font-weight:bold}\ndl dd{margin-bottom:1.25em}\nblockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}\nblockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}\n@media screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}\n h1{font-size:2.75em}\n h2{font-size:2.3125em}\n h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}\n h4{font-size:1.4375em}}\ntable{background:#fff;margin-bottom:1.25em;border:1px solid #dedede;word-wrap:normal}\ntable thead,table tfoot{background:#f7f8f7}\ntable thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}\ntable tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}\ntable tr.even,table tr.alt{background:#f8f8f7}\ntable thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{line-height:1.6}\nh1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}\nh1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}\n.center{margin-left:auto;margin-right:auto}\n.stretch{width:100%}\n.clearfix::before,.clearfix::after,.float-group::before,.float-group::after{content:\" \";display:table}\n.clearfix::after,.float-group::after{clear:both}\n:not(pre).nobreak{word-wrap:normal}\n:not(pre).nowrap{white-space:nowrap}\n:not(pre).pre-wrap{white-space:pre-wrap}\n:not(pre):not([class^=L])>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background:#f7f7f8;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}\npre{color:rgba(0,0,0,.9);font-family:\"Droid Sans Mono\",\"DejaVu Sans Mono\",monospace;line-height:1.45;text-rendering:optimizeSpeed}\npre code,pre pre{color:inherit;font-size:inherit;line-height:inherit}\npre.nowrap,pre.nowrap pre{white-space:pre;word-wrap:normal}\nem em{font-style:normal}\nstrong strong{font-weight:400}\n.keyseq{color:rgba(51,51,51,.8)}\nkbd{font-family:\"Droid Sans Mono\",\"DejaVu Sans Mono\",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background:#f7f7f7;border:1px solid #ccc;border-radius:3px;box-shadow:0 1px 0 rgba(0,0,0,.2),inset 0 0 0 .1em #fff;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}\n.keyseq kbd:first-child{margin-left:0}\n.keyseq kbd:last-child{margin-right:0}\n.menuseq,.menuref{color:#000}\n.menuseq b:not(.caret),.menuref{font-weight:inherit}\n.menuseq{word-spacing:-.02em}\n.menuseq b.caret{font-size:1.25em;line-height:.8}\n.menuseq i.caret{font-weight:bold;text-align:center;width:.45em}\nb.button::before,b.button::after{position:relative;top:-1px;font-weight:400}\nb.button::before{content:\"[\";padding:0 3px 0 2px}\nb.button::after{content:\"]\";padding:0 2px 0 3px}\np a>code:hover{color:rgba(0,0,0,.9)}\n#header,#content,#footnotes,#footer{width:100%;margin:0 auto;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}\n#header::before,#header::after,#content::before,#content::after,#footnotes::before,#footnotes::after,#footer::before,#footer::after{content:\" \";display:table}\n#header::after,#content::after,#footnotes::after,#footer::after{clear:both}\n#content{margin-top:1.25em}\n#content::before{content:none}\n#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}\n#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #dddddf}\n#header>h1:only-child{border-bottom:1px solid #dddddf;padding-bottom:8px}\n#header .details{border-bottom:1px solid #dddddf;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:flex;flex-flow:row wrap}\n#header .details span:first-child{margin-left:-.125em}\n#header .details span.email a{color:rgba(0,0,0,.85)}\n#header .details br{display:none}\n#header .details br+span::before{content:\"\\00a0\\2013\\00a0\"}\n#header .details br+span.author::before{content:\"\\00a0\\22c5\\00a0\";color:rgba(0,0,0,.85)}\n#header .details br+span#revremark::before{content:\"\\00a0|\\00a0\"}\n#header #revnumber{text-transform:capitalize}\n#header #revnumber::after{content:\"\\00a0\"}\n#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #dddddf;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}\n#toc{border-bottom:1px solid #e7e7e9;padding-bottom:.5em}\n#toc>ul{margin-left:.125em}\n#toc ul.sectlevel0>li>a{font-style:italic}\n#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}\n#toc ul{font-family:\"Open Sans\",\"DejaVu Sans\",sans-serif;list-style-type:none}\n#toc li{line-height:1.3334;margin-top:.3334em}\n#toc a{text-decoration:none}\n#toc a:active{text-decoration:underline}\n#toctitle{color:#7a2518;font-size:1.2em}\n@media screen and (min-width:768px){#toctitle{font-size:1.375em}\n body.toc2{padding-left:15em;padding-right:0}\n body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #dddddf;padding-bottom:8px}\n #toc.toc2{margin-top:0!important;background:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #e7e7e9;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}\n #toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}\n #toc.toc2>ul{font-size:.9em;margin-bottom:0}\n #toc.toc2 ul ul{margin-left:0;padding-left:1em}\n #toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}\n body.toc2.toc-right{padding-left:0;padding-right:15em}\n body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #e7e7e9;left:auto;right:0}}\n@media screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}\n #toc.toc2{width:20em}\n #toc.toc2 #toctitle{font-size:1.375em}\n #toc.toc2>ul{font-size:.95em}\n #toc.toc2 ul ul{padding-left:1.25em}\n body.toc2.toc-right{padding-left:0;padding-right:20em}}\n#content #toc{border:1px solid #e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;border-radius:4px}\n#content #toc>:first-child{margin-top:0}\n#content #toc>:last-child{margin-bottom:0}\n#footer{max-width:none;background:rgba(0,0,0,.8);padding:1.25em}\n#footer-text{color:hsla(0,0%,100%,.8);line-height:1.44}\n#content{margin-bottom:.625em}\n.sect1{padding-bottom:.625em}\n@media screen and (min-width:768px){#content{margin-bottom:1.25em}\n .sect1{padding-bottom:1.25em}}\n.sect1:last-child{padding-bottom:0}\n.sect1+.sect1{border-top:1px solid #e7e7e9}\n#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}\n#content h1>a.anchor::before,h2>a.anchor::before,h3>a.anchor::before,#toctitle>a.anchor::before,.sidebarblock>.content>.title>a.anchor::before,h4>a.anchor::before,h5>a.anchor::before,h6>a.anchor::before{content:\"\\00A7\";font-size:.85em;display:block;padding-top:.1em}\n#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}\n#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}\n#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}\ndetails,.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}\ndetails{margin-left:1.25rem}\ndetails>summary{cursor:pointer;display:block;position:relative;line-height:1.6;margin-bottom:.625rem;outline:none;-webkit-tap-highlight-color:transparent}\ndetails>summary::-webkit-details-marker{display:none}\ndetails>summary::before{content:\"\";border:solid transparent;border-left:solid;border-width:.3em 0 .3em .5em;position:absolute;top:.5em;left:-1.25rem;transform:translateX(15%)}\ndetails[open]>summary::before{border:solid transparent;border-top:solid;border-width:.5em .3em 0;transform:translateY(15%)}\ndetails>summary::after{content:\"\";width:1.25rem;height:1em;position:absolute;top:.3em;left:-1.25rem}\n.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:\"Noto Serif\",\"DejaVu Serif\",serif;font-size:1rem;font-style:italic}\ntable.tableblock.fit-content>caption.title{white-space:nowrap;width:0}\n.paragraph.lead>p,#preamble>.sectionbody>[class=paragraph]:first-of-type p{font-size:1.21875em;line-height:1.6;color:rgba(0,0,0,.85)}\n.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}\n.admonitionblock>table td.icon{text-align:center;width:80px}\n.admonitionblock>table td.icon img{max-width:none}\n.admonitionblock>table td.icon .title{font-weight:bold;font-family:\"Open Sans\",\"DejaVu Sans\",sans-serif;text-transform:uppercase}\n.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #dddddf;color:rgba(0,0,0,.6);word-wrap:anywhere}\n.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}\n.exampleblock>.content{border:1px solid #e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;border-radius:4px}\n.sidebarblock{border:1px solid #dbdbd6;margin-bottom:1.25em;padding:1.25em;background:#f3f3f2;border-radius:4px}\n.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}\n.exampleblock>.content>:first-child,.sidebarblock>.content>:first-child{margin-top:0}\n.exampleblock>.content>:last-child,.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}\n.literalblock pre,.listingblock>.content>pre{border-radius:4px;overflow-x:auto;padding:1em;font-size:.8125em}\n@media screen and (min-width:768px){.literalblock pre,.listingblock>.content>pre{font-size:.90625em}}\n@media screen and (min-width:1280px){.literalblock pre,.listingblock>.content>pre{font-size:1em}}\n.literalblock pre,.listingblock>.content>pre:not(.highlight),.listingblock>.content>pre[class=highlight],.listingblock>.content>pre[class^=\"highlight \"]{background:#f7f7f8}\n.literalblock.output pre{color:#f7f7f8;background:rgba(0,0,0,.9)}\n.listingblock>.content{position:relative}\n.listingblock pre>code{display:block}\n.listingblock code[data-lang]::before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:inherit;opacity:.5}\n.listingblock:hover code[data-lang]::before{display:block}\n.listingblock.terminal pre .command::before{content:attr(data-prompt);padding-right:.5em;color:inherit;opacity:.5}\n.listingblock.terminal pre .command:not([data-prompt])::before{content:\"$\"}\n.listingblock pre.highlightjs{padding:0}\n.listingblock pre.highlightjs>code{padding:1em;border-radius:4px}\n.listingblock pre.prettyprint{border-width:0}\n.prettyprint{background:#f7f7f8}\npre.prettyprint .linenums{line-height:1.45;margin-left:2em}\npre.prettyprint li{background:none;list-style-type:inherit;padding-left:0}\npre.prettyprint li code[data-lang]::before{opacity:1}\npre.prettyprint li:not(:first-child) code[data-lang]::before{display:none}\ntable.linenotable{border-collapse:separate;border:0;margin-bottom:0;background:none}\ntable.linenotable td[class]{color:inherit;vertical-align:top;padding:0;line-height:inherit;white-space:normal}\ntable.linenotable td.code{padding-left:.75em}\ntable.linenotable td.linenos,pre.pygments .linenos{border-right:1px solid;opacity:.35;padding-right:.5em;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}\npre.pygments span.linenos{display:inline-block;margin-right:.75em}\n.quoteblock{margin:0 1em 1.25em 1.5em;display:table}\n.quoteblock:not(.excerpt)>.title{margin-left:-1.5em;margin-bottom:.75em}\n.quoteblock blockquote,.quoteblock p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}\n.quoteblock blockquote{margin:0;padding:0;border:0}\n.quoteblock blockquote::before{content:\"\\201c\";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}\n.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}\n.quoteblock .attribution{margin-top:.75em;margin-right:.5ex;text-align:right}\n.verseblock{margin:0 1em 1.25em}\n.verseblock pre{font-family:\"Open Sans\",\"DejaVu Sans\",sans-serif;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}\n.verseblock pre strong{font-weight:400}\n.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}\n.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}\n.quoteblock .attribution br,.verseblock .attribution br{display:none}\n.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}\n.quoteblock.abstract blockquote::before,.quoteblock.excerpt blockquote::before,.quoteblock .quoteblock blockquote::before{display:none}\n.quoteblock.abstract blockquote,.quoteblock.abstract p,.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{line-height:1.6;word-spacing:0}\n.quoteblock.abstract{margin:0 1em 1.25em;display:block}\n.quoteblock.abstract>.title{margin:0 0 .375em;font-size:1.15em;text-align:center}\n.quoteblock.excerpt>blockquote,.quoteblock .quoteblock{padding:0 0 .25em 1em;border-left:.25em solid #dddddf}\n.quoteblock.excerpt,.quoteblock .quoteblock{margin-left:0}\n.quoteblock.excerpt blockquote,.quoteblock.excerpt p,.quoteblock .quoteblock blockquote,.quoteblock .quoteblock p{color:inherit;font-size:1.0625rem}\n.quoteblock.excerpt .attribution,.quoteblock .quoteblock .attribution{color:inherit;font-size:.85rem;text-align:left;margin-right:0}\np.tableblock:last-child{margin-bottom:0}\ntd.tableblock>.content{margin-bottom:1.25em;word-wrap:anywhere}\ntd.tableblock>.content>:last-child{margin-bottom:-1.25em}\ntable.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}\ntable.grid-all>*>tr>*{border-width:1px}\ntable.grid-cols>*>tr>*{border-width:0 1px}\ntable.grid-rows>*>tr>*{border-width:1px 0}\ntable.frame-all{border-width:1px}\ntable.frame-ends{border-width:1px 0}\ntable.frame-sides{border-width:0 1px}\ntable.frame-none>colgroup+*>:first-child>*,table.frame-sides>colgroup+*>:first-child>*{border-top-width:0}\ntable.frame-none>:last-child>:last-child>*,table.frame-sides>:last-child>:last-child>*{border-bottom-width:0}\ntable.frame-none>*>tr>:first-child,table.frame-ends>*>tr>:first-child{border-left-width:0}\ntable.frame-none>*>tr>:last-child,table.frame-ends>*>tr>:last-child{border-right-width:0}\ntable.stripes-all>*>tr,table.stripes-odd>*>tr:nth-of-type(odd),table.stripes-even>*>tr:nth-of-type(even),table.stripes-hover>*>tr:hover{background:#f8f8f7}\nth.halign-left,td.halign-left{text-align:left}\nth.halign-right,td.halign-right{text-align:right}\nth.halign-center,td.halign-center{text-align:center}\nth.valign-top,td.valign-top{vertical-align:top}\nth.valign-bottom,td.valign-bottom{vertical-align:bottom}\nth.valign-middle,td.valign-middle{vertical-align:middle}\ntable thead th,table tfoot th{font-weight:bold}\ntbody tr th{background:#f7f8f7}\ntbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}\np.tableblock>code:only-child{background:none;padding:0}\np.tableblock{font-size:1em}\nol{margin-left:1.75em}\nul li ol{margin-left:1.5em}\ndl dd{margin-left:1.125em}\ndl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}\nli p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}\nul.checklist,ul.none,ol.none,ul.no-bullet,ol.no-bullet,ol.unnumbered,ul.unstyled,ol.unstyled{list-style-type:none}\nul.no-bullet,ol.no-bullet,ol.unnumbered{margin-left:.625em}\nul.unstyled,ol.unstyled{margin-left:0}\nli>p:empty:only-child::before{content:\"\";display:inline-block}\nul.checklist>li>p:first-child{margin-left:-1em}\nul.checklist>li>p:first-child>.fa-square-o:first-child,ul.checklist>li>p:first-child>.fa-check-square-o:first-child{width:1.25em;font-size:.8em;position:relative;bottom:.125em}\nul.checklist>li>p:first-child>input[type=checkbox]:first-child{margin-right:.25em}\nul.inline{display:flex;flex-flow:row wrap;list-style:none;margin:0 0 .625em -1.25em}\nul.inline>li{margin-left:1.25em}\n.unstyled dl dt{font-weight:400;font-style:normal}\nol.arabic{list-style-type:decimal}\nol.decimal{list-style-type:decimal-leading-zero}\nol.loweralpha{list-style-type:lower-alpha}\nol.upperalpha{list-style-type:upper-alpha}\nol.lowerroman{list-style-type:lower-roman}\nol.upperroman{list-style-type:upper-roman}\nol.lowergreek{list-style-type:lower-greek}\n.hdlist>table,.colist>table{border:0;background:none}\n.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}\ntd.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}\ntd.hdlist1{font-weight:bold;padding-bottom:1.25em}\ntd.hdlist2{word-wrap:anywhere}\n.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}\n.colist td:not([class]):first-child{padding:.4em .75em 0;line-height:1;vertical-align:top}\n.colist td:not([class]):first-child img{max-width:none}\n.colist td:not([class]):last-child{padding:.25em 0}\n.thumb,.th{line-height:0;display:inline-block;border:4px solid #fff;box-shadow:0 0 0 1px #ddd}\n.imageblock.left{margin:.25em .625em 1.25em 0}\n.imageblock.right{margin:.25em 0 1.25em .625em}\n.imageblock>.title{margin-bottom:0}\n.imageblock.thumb,.imageblock.th{border-width:6px}\n.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}\n.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}\n.image.left{margin-right:.625em}\n.image.right{margin-left:.625em}\na.image{text-decoration:none;display:inline-block}\na.image object{pointer-events:none}\nsup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}\nsup.footnote a,sup.footnoteref a{text-decoration:none}\nsup.footnote a:active,sup.footnoteref a:active,#footnotes .footnote a:first-of-type:active{text-decoration:underline}\n#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}\n#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em;border-width:1px 0 0}\n#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;margin-bottom:.2em}\n#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none;margin-left:-1.05em}\n#footnotes .footnote:last-of-type{margin-bottom:0}\n#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}\ndiv.unbreakable{page-break-inside:avoid}\n.big{font-size:larger}\n.small{font-size:smaller}\n.underline{text-decoration:underline}\n.overline{text-decoration:overline}\n.line-through{text-decoration:line-through}\n.aqua{color:#00bfbf}\n.aqua-background{background:#00fafa}\n.black{color:#000}\n.black-background{background:#000}\n.blue{color:#0000bf}\n.blue-background{background:#0000fa}\n.fuchsia{color:#bf00bf}\n.fuchsia-background{background:#fa00fa}\n.gray{color:#606060}\n.gray-background{background:#7d7d7d}\n.green{color:#006000}\n.green-background{background:#007d00}\n.lime{color:#00bf00}\n.lime-background{background:#00fa00}\n.maroon{color:#600000}\n.maroon-background{background:#7d0000}\n.navy{color:#000060}\n.navy-background{background:#00007d}\n.olive{color:#606000}\n.olive-background{background:#7d7d00}\n.purple{color:#600060}\n.purple-background{background:#7d007d}\n.red{color:#bf0000}\n.red-background{background:#fa0000}\n.silver{color:#909090}\n.silver-background{background:#bcbcbc}\n.teal{color:#006060}\n.teal-background{background:#007d7d}\n.white{color:#bfbfbf}\n.white-background{background:#fafafa}\n.yellow{color:#bfbf00}\n.yellow-background{background:#fafa00}\nspan.icon>.fa{cursor:default}\na span.icon>.fa{cursor:inherit}\n.admonitionblock td.icon [class^=\"fa icon-\"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}\n.admonitionblock td.icon .icon-note::before{content:\"\\f05a\";color:#19407c}\n.admonitionblock td.icon .icon-tip::before{content:\"\\f0eb\";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}\n.admonitionblock td.icon .icon-warning::before{content:\"\\f071\";color:#bf6900}\n.admonitionblock td.icon .icon-caution::before{content:\"\\f06d\";color:#bf3400}\n.admonitionblock td.icon .icon-important::before{content:\"\\f06a\";color:#bf0000}\n.conum[data-value]{display:inline-block;color:#fff!important;background:rgba(0,0,0,.8);border-radius:50%;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:\"Open Sans\",\"DejaVu Sans\",sans-serif;font-style:normal;font-weight:bold}\n.conum[data-value] *{color:#fff!important}\n.conum[data-value]+b{display:none}\n.conum[data-value]::after{content:attr(data-value)}\npre .conum[data-value]{position:relative;top:-.125em}\nb.conum *{color:inherit!important}\n.conum:not([data-value]):empty{display:none}\ndt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}\nh1,h2,p,td.content,span.alt,summary{letter-spacing:-.01em}\np strong,td.content strong,div.footnote strong{letter-spacing:-.005em}\np,blockquote,dt,td.content,td.hdlist1,span.alt,summary{font-size:1.0625rem}\np{margin-bottom:1.25rem}\n.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}\n.exampleblock>.content{background:#fffef7;border-color:#e0e0dc;box-shadow:0 1px 4px #e0e0dc}\n.print-only{display:none!important}\n@page{margin:1.25cm .75cm}\n@media print{*{box-shadow:none!important;text-shadow:none!important}\n html{font-size:80%}\n a{color:inherit!important;text-decoration:underline!important}\n a.bare,a[href^=\"#\"],a[href^=\"mailto:\"]{text-decoration:none!important}\n a[href^=\"http:\"]:not(.bare)::after,a[href^=\"https:\"]:not(.bare)::after{content:\"(\" attr(href) \")\";display:inline-block;font-size:.875em;padding-left:.25em}\n abbr[title]{border-bottom:1px dotted}\n abbr[title]::after{content:\" (\" attr(title) \")\"}\n pre,blockquote,tr,img,object,svg{page-break-inside:avoid}\n thead{display:table-header-group}\n svg{max-width:100%}\n p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}\n h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}\n #header,#content,#footnotes,#footer{max-width:none}\n #toc,.sidebarblock,.exampleblock>.content{background:none!important}\n #toc{border-bottom:1px solid #dddddf!important;padding-bottom:0!important}\n body.book #header{text-align:center}\n body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em}\n body.book #header .details{border:0!important;display:block;padding:0!important}\n body.book #header .details span:first-child{margin-left:0!important}\n body.book #header .details br{display:block}\n body.book #header .details br+span::before{content:none!important}\n body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}\n body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}\n .listingblock code[data-lang]::before{display:block}\n #footer{padding:0 .9375em}\n .hide-on-print{display:none!important}\n .print-only{display:block!important}\n .hide-for-print{display:none!important}\n .show-for-print{display:inherit!important}}\n@media amzn-kf8,print{#header>h1:first-child{margin-top:1.25rem}\n .sect1{padding:0!important}\n .sect1+.sect1{border:0}\n #footer{background:none}\n #footer-text{color:rgba(0,0,0,.6);font-size:.9em}}\n@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}"
|