planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

18
node_modules/hast-util-to-html/lib/all.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict'
var one = require('./one')
module.exports = all
// Serialize all children of `parent`.
function all(ctx, parent) {
var results = []
var children = (parent && parent.children) || []
var index = -1
while (++index < children.length) {
results[index] = one(ctx, children[index], index, parent)
}
return results.join('')
}

17
node_modules/hast-util-to-html/lib/comment.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
'use strict'
var xtend = require('xtend')
var entities = require('stringify-entities')
module.exports = serializeComment
function serializeComment(ctx, node) {
// See: <https://html.spec.whatwg.org/multipage/syntax.html#comments>
return ctx.bogusComments
? '<?' + entities(node.value, xtend(ctx.entities, {subset: ['>']})) + '>'
: '<!--' + node.value.replace(/^>|^->|<!--|-->|--!>|<!-$/g, encode) + '-->'
function encode($0) {
return entities($0, xtend(ctx.entities, {subset: ['<', '>']}))
}
}

28
node_modules/hast-util-to-html/lib/constants.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
'use strict'
// Maps of subsets.
// Each value is a matrix of tuples.
// The first value causes parse errors, the second is valid.
// Of both values, the first value is unsafe, and the second is safe.
module.exports = {
// See: <https://html.spec.whatwg.org/#attribute-name-state>.
name: [
['\t\n\f\r &/=>'.split(''), '\t\n\f\r "&\'/=>`'.split('')],
['\0\t\n\f\r "&\'/<=>'.split(''), '\0\t\n\f\r "&\'/<=>`'.split('')]
],
// See: <https://html.spec.whatwg.org/#attribute-value-(unquoted)-state>.
unquoted: [
['\t\n\f\r &>'.split(''), '\0\t\n\f\r "&\'<=>`'.split('')],
['\0\t\n\f\r "&\'<=>`'.split(''), '\0\t\n\f\r "&\'<=>`'.split('')]
],
// See: <https://html.spec.whatwg.org/#attribute-value-(single-quoted)-state>.
single: [
["&'".split(''), '"&\'`'.split('')],
["\0&'".split(''), '\0"&\'`'.split('')]
],
// See: <https://html.spec.whatwg.org/#attribute-value-(double-quoted)-state>.
double: [
['"&'.split(''), '"&\'`'.split('')],
['\0"&'.split(''), '\0"&\'`'.split('')]
]
}

42
node_modules/hast-util-to-html/lib/doctype.js generated vendored Normal file
View File

@@ -0,0 +1,42 @@
'use strict'
var xtend = require('xtend')
var ccount = require('ccount')
var entities = require('stringify-entities')
module.exports = serializeDoctype
function serializeDoctype(ctx, node) {
var sep = ctx.tightDoctype ? '' : ' '
var parts = ['<!' + (ctx.upperDoctype ? 'DOCTYPE' : 'doctype')]
if (node.name) {
parts.push(sep, node.name)
if (node.public != null) {
parts.push(' public', sep, quote(ctx, node.public))
} else if (node.system != null) {
parts.push(' system')
}
if (node.system != null) {
parts.push(sep, quote(ctx, node.system))
}
}
return parts.join('') + '>'
}
function quote(ctx, value) {
var string = String(value)
var quote =
ccount(string, ctx.quote) > ccount(string, ctx.alternative)
? ctx.alternative
: ctx.quote
return (
quote +
entities(string, xtend(ctx.entities, {subset: ['<', '&', quote]})) +
quote
)
}

198
node_modules/hast-util-to-html/lib/element.js generated vendored Normal file
View File

@@ -0,0 +1,198 @@
'use strict'
var xtend = require('xtend')
var svg = require('property-information/svg')
var find = require('property-information/find')
var spaces = require('space-separated-tokens')
var commas = require('comma-separated-tokens')
var entities = require('stringify-entities')
var ccount = require('ccount')
var all = require('./all')
var constants = require('./constants')
module.exports = serializeElement
function serializeElement(ctx, node, index, parent) {
var schema = ctx.schema
var omit = schema.space === 'svg' ? false : ctx.omit
var parts = []
var selfClosing =
schema.space === 'svg'
? ctx.closeEmpty
: ctx.voids.indexOf(node.tagName.toLowerCase()) > -1
var attrs
var content
var last
if (schema.space === 'html' && node.tagName === 'svg') {
ctx.schema = svg
}
attrs = serializeAttributes(ctx, node.properties)
content = all(
ctx,
schema.space === 'html' && node.tagName === 'template' ? node.content : node
)
ctx.schema = schema
// If the node is categorised as void, but it has children, remove the
// categorisation.
// This enables for example `menuitem`s, which are void in W3C HTML but not
// void in WHATWG HTML, to be stringified properly.
if (content) selfClosing = false
if (attrs || !omit || !omit.opening(node, index, parent)) {
parts.push('<', node.tagName, attrs ? ' ' + attrs : '')
if (selfClosing && (schema.space === 'svg' || ctx.close)) {
last = attrs.charAt(attrs.length - 1)
if (
!ctx.tightClose ||
last === '/' ||
(schema.space === 'svg' && last && last !== '"' && last !== "'")
) {
parts.push(' ')
}
parts.push('/')
}
parts.push('>')
}
parts.push(content)
if (!selfClosing && (!omit || !omit.closing(node, index, parent))) {
parts.push('</' + node.tagName + '>')
}
return parts.join('')
}
function serializeAttributes(ctx, props) {
var values = []
var index = -1
var key
var value
var last
for (key in props) {
if (props[key] != null) {
value = serializeAttribute(ctx, key, props[key])
if (value) values.push(value)
}
}
while (++index < values.length) {
last = ctx.tight ? values[index].charAt(values[index].length - 1) : null
// In tight mode, dont add a space after quoted attributes.
if (index !== values.length - 1 && last !== '"' && last !== "'") {
values[index] += ' '
}
}
return values.join('')
}
function serializeAttribute(ctx, key, value) {
var info = find(ctx.schema, key)
var quote = ctx.quote
var result
var name
if (info.overloadedBoolean && (value === info.attribute || value === '')) {
value = true
} else if (
info.boolean ||
(info.overloadedBoolean && typeof value !== 'string')
) {
value = Boolean(value)
}
if (
value == null ||
value === false ||
(typeof value === 'number' && value !== value)
) {
return ''
}
name = entities(
info.attribute,
xtend(ctx.entities, {
// Always encode without parse errors in non-HTML.
subset:
constants.name[ctx.schema.space === 'html' ? ctx.valid : 1][ctx.safe]
})
)
// No value.
// There is currently only one boolean property in SVG: `[download]` on
// `<a>`.
// This property does not seem to work in browsers (FF, Sa, Ch), so I cant
// test if dropping the value works.
// But I assume that it should:
//
// ```html
// <!doctype html>
// <svg viewBox="0 0 100 100">
// <a href=https://example.com download>
// <circle cx=50 cy=40 r=35 />
// </a>
// </svg>
// ```
//
// See: <https://github.com/wooorm/property-information/blob/main/lib/svg.js>
if (value === true) return name
value =
typeof value === 'object' && 'length' in value
? // `spaces` doesnt accept a second argument, but its given here just to
// keep the code cleaner.
(info.commaSeparated ? commas.stringify : spaces.stringify)(value, {
padLeft: !ctx.tightLists
})
: String(value)
if (ctx.collapseEmpty && !value) return name
// Check unquoted value.
if (ctx.unquoted) {
result = entities(
value,
xtend(ctx.entities, {
subset: constants.unquoted[ctx.valid][ctx.safe],
attribute: true
})
)
}
// If we dont want unquoted, or if `value` contains character references when
// unquoted…
if (result !== value) {
// If the alternative is less common than `quote`, switch.
if (ctx.smart && ccount(value, quote) > ccount(value, ctx.alternative)) {
quote = ctx.alternative
}
result =
quote +
entities(
value,
xtend(ctx.entities, {
// Always encode without parse errors in non-HTML.
subset: (quote === "'" ? constants.single : constants.double)[
ctx.schema.space === 'html' ? ctx.valid : 1
][ctx.safe],
attribute: true
})
) +
quote
}
// Dont add a `=` for unquoted empties.
return name + (result ? '=' + result : result)
}

56
node_modules/hast-util-to-html/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
'use strict'
var html = require('property-information/html')
var svg = require('property-information/svg')
var voids = require('html-void-elements')
var omission = require('./omission')
var one = require('./one')
module.exports = toHtml
var deprecationWarningIssued
function toHtml(node, options) {
var settings = options || {}
var quote = settings.quote || '"'
var alternative = quote === '"' ? "'" : '"'
if (quote !== '"' && quote !== "'") {
throw new Error('Invalid quote `' + quote + '`, expected `\'` or `"`')
}
if ('allowDangerousHTML' in settings && !deprecationWarningIssued) {
deprecationWarningIssued = true
console.warn(
'Deprecation warning: `allowDangerousHTML` is a nonstandard option, use `allowDangerousHtml` instead'
)
}
return one(
{
valid: settings.allowParseErrors ? 0 : 1,
safe: settings.allowDangerousCharacters ? 0 : 1,
schema: settings.space === 'svg' ? svg : html,
omit: settings.omitOptionalTags && omission,
quote: quote,
alternative: alternative,
smart: settings.quoteSmart,
unquoted: settings.preferUnquoted,
tight: settings.tightAttributes,
upperDoctype: settings.upperDoctype,
tightDoctype: settings.tightDoctype,
bogusComments: settings.bogusComments,
tightLists: settings.tightCommaSeparatedLists,
tightClose: settings.tightSelfClosing,
collapseEmpty: settings.collapseEmptyAttributes,
dangerous: settings.allowDangerousHtml || settings.allowDangerousHTML,
voids: settings.voids || voids.concat(),
entities: settings.entities || {},
close: settings.closeSelfClosing,
closeEmpty: settings.closeEmptyElements
},
node && typeof node === 'object' && 'length' in node
? {type: 'root', children: node}
: node
)
}

168
node_modules/hast-util-to-html/lib/omission/closing.js generated vendored Normal file
View File

@@ -0,0 +1,168 @@
'use strict'
var element = require('hast-util-is-element')
var whiteSpaceStart = require('./util/white-space-start')
var comment = require('./util/comment')
var siblings = require('./util/siblings')
var omission = require('./omission')
module.exports = omission({
html: html,
head: headOrColgroupOrCaption,
body: body,
p: p,
li: li,
dt: dt,
dd: dd,
rt: rubyElement,
rp: rubyElement,
optgroup: optgroup,
option: option,
menuitem: menuitem,
colgroup: headOrColgroupOrCaption,
caption: headOrColgroupOrCaption,
thead: thead,
tbody: tbody,
tfoot: tfoot,
tr: tr,
td: cells,
th: cells
})
// Macro for `</head>`, `</colgroup>`, and `</caption>`.
function headOrColgroupOrCaption(node, index, parent) {
var next = siblings.after(parent, index, true)
return !next || (!comment(next) && !whiteSpaceStart(next))
}
// Whether to omit `</html>`.
function html(node, index, parent) {
var next = siblings.after(parent, index)
return !next || !comment(next)
}
// Whether to omit `</body>`.
function body(node, index, parent) {
var next = siblings.after(parent, index)
return !next || !comment(next)
}
// Whether to omit `</p>`.
function p(node, index, parent) {
var next = siblings.after(parent, index)
return next
? element(next, [
'address',
'article',
'aside',
'blockquote',
'details',
'div',
'dl',
'fieldset',
'figcaption',
'figure',
'footer',
'form',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'header',
'hgroup',
'hr',
'main',
'menu',
'nav',
'ol',
'p',
'pre',
'section',
'table',
'ul'
])
: !parent ||
// Confusing parent.
!element(parent, [
'a',
'audio',
'del',
'ins',
'map',
'noscript',
'video'
])
}
// Whether to omit `</li>`.
function li(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, 'li')
}
// Whether to omit `</dt>`.
function dt(node, index, parent) {
var next = siblings.after(parent, index)
return next && element(next, ['dt', 'dd'])
}
// Whether to omit `</dd>`.
function dd(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, ['dt', 'dd'])
}
// Whether to omit `</rt>` or `</rp>`.
function rubyElement(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, ['rp', 'rt'])
}
// Whether to omit `</optgroup>`.
function optgroup(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, 'optgroup')
}
// Whether to omit `</option>`.
function option(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, ['option', 'optgroup'])
}
// Whether to omit `</menuitem>`.
function menuitem(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, ['menuitem', 'hr', 'menu'])
}
// Whether to omit `</thead>`.
function thead(node, index, parent) {
var next = siblings.after(parent, index)
return next && element(next, ['tbody', 'tfoot'])
}
// Whether to omit `</tbody>`.
function tbody(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, ['tbody', 'tfoot'])
}
// Whether to omit `</tfoot>`.
function tfoot(node, index, parent) {
return !siblings.after(parent, index)
}
// Whether to omit `</tr>`.
function tr(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, 'tr')
}
// Whether to omit `</td>` or `</th>`.
function cells(node, index, parent) {
var next = siblings.after(parent, index)
return !next || element(next, ['td', 'th'])
}

3
node_modules/hast-util-to-html/lib/omission/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
'use strict'
exports.opening = require('./opening')
exports.closing = require('./closing')

View File

@@ -0,0 +1,18 @@
'use strict'
module.exports = omission
var own = {}.hasOwnProperty
// Factory to check if a given node can have a tag omitted.
function omission(handlers) {
return omit
// Check if a given node can have a tag omitted.
function omit(node, index, parent) {
return (
own.call(handlers, node.tagName) &&
handlers[node.tagName](node, index, parent)
)
}
}

85
node_modules/hast-util-to-html/lib/omission/opening.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
'use strict'
var element = require('hast-util-is-element')
var siblings = require('./util/siblings')
var whiteSpaceStart = require('./util/white-space-start')
var comment = require('./util/comment')
var closing = require('./closing')
var omission = require('./omission')
module.exports = omission({
html: html,
head: head,
body: body,
colgroup: colgroup,
tbody: tbody
})
// Whether to omit `<html>`.
function html(node) {
var head = siblings.after(node, -1)
return !head || !comment(head)
}
// Whether to omit `<head>`.
function head(node) {
var children = node.children
var seen = []
var index = -1
while (++index < children.length) {
if (element(children[index], ['title', 'base'])) {
if (seen.indexOf(children[index].tagName) > -1) return false
seen.push(children[index].tagName)
}
}
return children.length
}
// Whether to omit `<body>`.
function body(node) {
var head = siblings.after(node, -1, true)
return (
!head ||
(!comment(head) &&
!whiteSpaceStart(head) &&
!element(head, ['meta', 'link', 'script', 'style', 'template']))
)
}
// Whether to omit `<colgroup>`.
// The spec describes some logic for the opening tag, but its easier to
// implement in the closing tag, to the same effect, so we handle it there
// instead.
function colgroup(node, index, parent) {
var previous = siblings.before(parent, index)
var head = siblings.after(node, -1, true)
// Previous colgroup was already omitted.
if (
element(previous, 'colgroup') &&
closing(previous, parent.children.indexOf(previous), parent)
) {
return false
}
return head && element(head, 'col')
}
// Whether to omit `<tbody>`.
function tbody(node, index, parent) {
var previous = siblings.before(parent, index)
var head = siblings.after(node, -1)
// Previous table section was already omitted.
if (
element(previous, ['thead', 'tbody']) &&
closing(previous, parent.children.indexOf(previous), parent)
) {
return false
}
return head && element(head, 'tr')
}

View File

@@ -0,0 +1,5 @@
'use strict'
var convert = require('unist-util-is/convert')
module.exports = convert('comment')

View File

@@ -0,0 +1,27 @@
'use strict'
var whiteSpace = require('hast-util-whitespace')
exports.before = siblings(-1)
exports.after = siblings(1)
// Factory to check siblings in a direction.
function siblings(increment) {
return sibling
// Find applicable siblings in a direction.
function sibling(parent, index, includeWhiteSpace) {
var siblings = parent && parent.children
var offset = index + increment
var next = siblings && siblings[offset]
if (!includeWhiteSpace) {
while (next && whiteSpace(next)) {
offset += increment
next = siblings[offset]
}
}
return next
}
}

View File

@@ -0,0 +1,13 @@
'use strict'
var convert = require('unist-util-is/convert')
var whiteSpace = require('hast-util-whitespace')
module.exports = whiteSpaceStart
var isText = convert('text')
// Check if `node` starts with white-space.
function whiteSpaceStart(node) {
return isText(node) && whiteSpace(node.value.charAt(0))
}

26
node_modules/hast-util-to-html/lib/one.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
'use strict'
module.exports = serialize
var handlers = {
comment: require('./comment'),
doctype: require('./doctype'),
element: require('./element'),
raw: require('./raw'),
root: require('./all'),
text: require('./text')
}
var own = {}.hasOwnProperty
function serialize(ctx, node, index, parent) {
if (!node || !node.type) {
throw new Error('Expected node, not `' + node + '`')
}
if (!own.call(handlers, node.type)) {
throw new Error('Cannot compile unknown node `' + node.type + '`')
}
return handlers[node.type](ctx, node, index, parent)
}

9
node_modules/hast-util-to-html/lib/raw.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
'use strict'
var text = require('./text')
module.exports = serializeRaw
function serializeRaw(ctx, node) {
return ctx.dangerous ? node.value : text(ctx, node)
}

13
node_modules/hast-util-to-html/lib/text.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
'use strict'
var xtend = require('xtend')
var entities = require('stringify-entities')
module.exports = serializeText
function serializeText(ctx, node, index, parent) {
// Check if content of `node` should be escaped.
return parent && (parent.tagName === 'script' || parent.tagName === 'style')
? node.value
: entities(node.value, xtend(ctx.entities, {subset: ['<', '&']}))
}