Skip to content

Commit 9cebb02

Browse files
Fix
1 parent 54d8a58 commit 9cebb02

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/documentation/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ _just.version = vrsn;
5555
_just.array = require('../modules/array.js');
5656
_just.prevnext = require('./prevnext.js');
5757
const esc = '\x1B';
58+
_just.parseCSS = require('../modules/ast/css.js');
5859

5960
const link = (text, link_, ext = false, extid = "ext", target = "_blank", title_) => `<a href="${link_}" target="${target}"${ext ? ` id="${extid}"` : ''}${title_ ? ` title="${title_}"` : ''}>${text}</a>`;
6061
const span = (text) => `<span>${text}</span>`;
@@ -273,7 +274,14 @@ JS = JS.replaceAll('trimmedStr', jstrimmedstrvar)
273274
.replace('getElementById("search")', `getElementById("${cssid.search}")`)
274275
.replace("setProperty('--sdfix'", `setProperty('--${cssvar.sdfix}'`)
275276
.replaceAll("('searchactive')", `('${cssclass.searchactive}')`);
276-
CSSHIGHLIGHT += `.${cssclass.l}{${JSON.parse(HIGHLIGHTJSON)["_just_light"]}}`;
277+
const lighthighlight = _just.parseCSS.JSON(JSON.parse(HIGHLIGHTJSON)["_just_light"]);
278+
lighthighlight.forEach(rule => {
279+
const props = [];
280+
for (const [keyy, valme] of Object.entries(rule.properties)) {
281+
props.push(`${keyy}:${valme}`);
282+
}
283+
CSSHIGHLIGHT += `${rule.selectors.map(s => `.${cssclass.l} ${s}`).join(',')}{${props.join(';')}}`;
284+
});
277285

278286
const charset = docsConfig ? docsConfig.charset || template.charset : template.charset;
279287

src/modules/ast/css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ exports.JSON = function(cssText) {
112112

113113
skipWhitespace();
114114

115-
if (/^[.#a-zA-Z0-9\-\s,:()]+$/.test(selectorText)) {
115+
if (/^[.#a-zA-Z0-9\-\s,:()%]+$/.test(selectorText)) {
116116
const selectors = selectorText.split(',').map(s => s.trim());
117117
const properties = {};
118118
const nestedRules = [];

0 commit comments

Comments
 (0)