Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

CSSSyntax doesn't parse numeric range restrictions correctly #1441

@ferdnyc

Description

@ferdnyc

The CSS grammar supports range restrictions for numeric values of the form <integer [0,10]> (signifying a number that can have any integer value from 0...10 inclusive). Range annotations are used in two places in the MDN syntaxes.json file, so far:

  1. In font-weight-absolute (since Restrict font-weight-absolute values to numbers in the 1...1000 range data#420)
  2. In cubic-bezier-timing-function (since restrict cubic-bezier-timing-function abscissas to be in range [0,1] data#416)

However, kumascript/macros/CSSSyntax.ejs mis-parses those annotations, resulting in corrupted HTML source such as this example from font-weight§Formal syntax:

<pre class="syntaxbox notranslate">
<a href="#font-weight-absolute">&lt;font-weight-absolute&gt;</a> 
<a href="/en-US/docs/CSS/Value_definition_syntax#Single_bar" 
title="Single bar: exactly one of the entities must be present">|</a>
 bolder 
<a href="/en-US/docs/CSS/Value_definition_syntax#Single_bar" 
title="Single bar: exactly one of the entities must be present">|</a>
 lighter
<p style="font-family: Open Sans,Arial,sans-serif; margin: 10px 0 0 0;">where <br>
<code style='font-family: Consolas,Monaco,"Andale Mono",monospace;'>
<span id="font-weight-absolute">&lt;font-weight-absolute&gt;</span>
 = normal 
<a href="/en-US/docs/CSS/Value_definition_syntax#Single_bar" 
title="Single bar: exactly one of the entities must be present">|</a>
 bold 
<a href="/en-US/docs/CSS/Value_definition_syntax#Single_bar" 
title="Single bar: exactly one of the entities must be present">|</a>
 &lt;number 
&lt;a href="/en-US/docs/CSS/Value_definition_syntax#Brackets" 
title="Brackets: enclose several entities, combinators, and multipliers to 
transform them as a single component"&gt;
[1,1000
<a href="/en-US/docs/CSS/Value_definition_syntax#Brackets" 
title="Brackets: enclose several entities, combinators, and multipliers to 
transform them as a single component">]</a>
&gt;
</code>
</p></pre>

This renders as:

<font-weight-absolute> | bolder | lighter
where 
<font-weight-absolute> = normal | bold | <number <a href="/en-
US/docs/CSS/Value_definition_syntax#Brackets" title="Brackets: enclose several 
entities, combinators, and multipliers to transform them as a single component">
[1,1000]>

Instead of the expected:

<font-weight-absolute> | bolder | lighter
where 
<font-weight-absolute> = normal | bold | <number [1,1000]>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions