This commit is contained in:
Jonny Gerig Meyer 2023-05-22 15:06:31 -04:00
parent f078485f55
commit d5e4ecfa03
No known key found for this signature in database
2 changed files with 15 additions and 15 deletions

View File

@ -5,20 +5,20 @@ navigation: |
<h2>Contents</h2> <h2>Contents</h2>
- [Syntax](/documentation/syntax){.section} - [Syntax](/documentation/syntax){.section}
- [Overview](/documentation/syntax) - [Overview](/documentation/syntax) {.overview}
- [Parsing a Stylesheet](/documentation/syntax/parsing) - [Parsing a Stylesheet](/documentation/syntax/parsing)
- [Structure of a Stylesheet](/documentation/syntax/structure) - [Structure of a Stylesheet](/documentation/syntax/structure)
- [Comments](/documentation/syntax/comments) - [Comments](/documentation/syntax/comments)
- [Special Functions](/documentation/syntax/special-functions) - [Special Functions](/documentation/syntax/special-functions)
- [Style Rules](/documentation/style-rules){.section} - [Style Rules](/documentation/style-rules){.section}
- [Overview](/documentation/style-rules) - [Overview](/documentation/style-rules) {.overview}
- [Property Declarations](/documentation/style-rules/declarations) - [Property Declarations](/documentation/style-rules/declarations)
- [Parent Selector](/documentation/style-rules/parent-selector) - [Parent Selector](/documentation/style-rules/parent-selector)
- [Placeholder Selectors](/documentation/style-rules/placeholder-selectors) - [Placeholder Selectors](/documentation/style-rules/placeholder-selectors)
- [Variables](/documentation/variables) - [Variables](/documentation/variables)
- [Interpolation](/documentation/interpolation) - [Interpolation](/documentation/interpolation)
- [At-Rules](/documentation/at-rules){.section} - [At-Rules](/documentation/at-rules){.section}
- [Overview](/documentation/at-rules) - [Overview](/documentation/at-rules) {.overview}
- [<code>@use</code>](/documentation/at-rules/use) - [<code>@use</code>](/documentation/at-rules/use)
- [<code>@forward</code>](/documentation/at-rules/forward) - [<code>@forward</code>](/documentation/at-rules/forward)
- [<code>@import</code>](/documentation/at-rules/import) - [<code>@import</code>](/documentation/at-rules/import)
@ -30,14 +30,14 @@ navigation: |
- [<code>@debug</code>](/documentation/at-rules/debug) - [<code>@debug</code>](/documentation/at-rules/debug)
- [<code>@at-root</code>](/documentation/at-rules/at-root) - [<code>@at-root</code>](/documentation/at-rules/at-root)
- [Flow Control](/documentation/at-rules/control) - [Flow Control](/documentation/at-rules/control)
- [Overview](/documentation/at-rules/control) - [Overview](/documentation/at-rules/control) {.overview}
- [<code>@if</code> and <code>@else</code>](/documentation/at-rules/control/if) - [<code>@if</code> and <code>@else</code>](/documentation/at-rules/control/if)
- [<code>@each</code>](/documentation/at-rules/control/each) - [<code>@each</code>](/documentation/at-rules/control/each)
- [<code>@for</code>](/documentation/at-rules/control/for) - [<code>@for</code>](/documentation/at-rules/control/for)
- [<code>@while</code>](/documentation/at-rules/control/while) - [<code>@while</code>](/documentation/at-rules/control/while)
- [From CSS](/documentation/at-rules/css) - [From CSS](/documentation/at-rules/css)
- [Values](/documentation/values){.section} - [Values](/documentation/values){.section}
- [Overview](/documentation/values) - [Overview](/documentation/values) {.overview}
- [Numbers](/documentation/values/numbers) - [Numbers](/documentation/values/numbers)
- [Strings](/documentation/values/strings) - [Strings](/documentation/values/strings)
- [Colors](/documentation/values/colors) - [Colors](/documentation/values/colors)
@ -48,14 +48,14 @@ navigation: |
- [Calculations](/documentation/values/calculations) - [Calculations](/documentation/values/calculations)
- [Functions](/documentation/values/functions) - [Functions](/documentation/values/functions)
- [Operators](/documentation/operators){.section} - [Operators](/documentation/operators){.section}
- [Overview](/documentation/operators) - [Overview](/documentation/operators) {.overview}
- [Equality](/documentation/operators/equality) - [Equality](/documentation/operators/equality)
- [Relational](/documentation/operators/relational) - [Relational](/documentation/operators/relational)
- [Numeric](/documentation/operators/numeric) - [Numeric](/documentation/operators/numeric)
- [String](/documentation/operators/string) - [String](/documentation/operators/string)
- [Boolean](/documentation/operators/boolean) - [Boolean](/documentation/operators/boolean)
- [Built-In Modules](/documentation/modules){.section} - [Built-In Modules](/documentation/modules){.section}
- [Overview](/documentation/modules) - [Overview](/documentation/modules) {.overview}
- [<code>sass:color</code>](/documentation/modules/color) - [<code>sass:color</code>](/documentation/modules/color)
- [<code>sass:list</code>](/documentation/modules/list) - [<code>sass:list</code>](/documentation/modules/list)
- [<code>sass:map</code>](/documentation/modules/map) - [<code>sass:map</code>](/documentation/modules/map)
@ -64,7 +64,7 @@ navigation: |
- [<code>sass:selector</code>](/documentation/modules/selector) - [<code>sass:selector</code>](/documentation/modules/selector)
- [<code>sass:string</code>](/documentation/modules/string) - [<code>sass:string</code>](/documentation/modules/string)
- [Breaking Changes](/documentation/breaking-changes){.section} - [Breaking Changes](/documentation/breaking-changes){.section}
- [Overview](/documentation/breaking-changes) - [Overview](/documentation/breaking-changes) {.overview}
- [Strict Unary Operators](/documentation/breaking-changes/strict-unary) - [Strict Unary Operators](/documentation/breaking-changes/strict-unary)
- [Random With Units](/documentation/breaking-changes/random-with-units) - [Random With Units](/documentation/breaking-changes/random-with-units)
- [Invalid Combinators](/documentation/breaking-changes/bogus-combinators) - [Invalid Combinators](/documentation/breaking-changes/bogus-combinators)
@ -75,7 +75,7 @@ navigation: |
- [Extending Compound Selectors](/documentation/breaking-changes/extend-compound) - [Extending Compound Selectors](/documentation/breaking-changes/extend-compound)
- [CSS Variable Syntax](/documentation/breaking-changes/css-vars) - [CSS Variable Syntax](/documentation/breaking-changes/css-vars)
- [Command Line](/documentation/cli){.section} - [Command Line](/documentation/cli){.section}
- [Overview](/documentation/cli) - [Overview](/documentation/cli) {.overview}
- [Dart Sass](/documentation/cli/dart-sass) - [Dart Sass](/documentation/cli/dart-sass)
- [Ruby Sass](/documentation/cli/ruby-sass) - [Ruby Sass](/documentation/cli/ruby-sass)
- [Migrator](/documentation/cli/migrator) - [Migrator](/documentation/cli/migrator)

View File

@ -10,8 +10,8 @@ function bind(fn, first) {
} }
/** /**
* Take `input` and convert it into a string of all arguments suitable for the * Take text `input` and convert it into a string of all arguments suitable for
* {% compatibility %} tag. * the `{% compatibility %}` tag.
*/ */
function parseCompatibility(input) { function parseCompatibility(input) {
const keyValueRegex = /(\w+):\s*([^,]+)/g; const keyValueRegex = /(\w+):\s*([^,]+)/g;
@ -65,17 +65,17 @@ class SassSiteRenderContext extends DefaultThemeRenderContext {
// Compatibility tags should have a single text block. // Compatibility tags should have a single text block.
const text = compat.content[0].text; const text = compat.content[0].text;
// The first line is arguments to impl_status, anything after that is the // The first line is arguments to `{% compatibility %}` tag, anything
// contents of the block. // after that is the contents of the block.
const lineBreak = text.indexOf('\n'); const lineBreak = text.indexOf('\n');
const firstLine = parseCompatibility( const compatibilityArgs = parseCompatibility(
lineBreak === -1 ? text : text.substring(0, lineBreak), lineBreak === -1 ? text : text.substring(0, lineBreak),
); );
const rest = const rest =
lineBreak === -1 ? null : text.substring(lineBreak + 1).trim(); lineBreak === -1 ? null : text.substring(lineBreak + 1).trim();
return JSX.createElement(JSX.Raw, { return JSX.createElement(JSX.Raw, {
html: html:
`{% compatibility ${firstLine} %}` + `{% compatibility ${compatibilityArgs} %}` +
(rest ? context.markdown(rest) : '') + (rest ? context.markdown(rest) : '') +
'{% endcompatibility %}', '{% endcompatibility %}',
}); });