mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Add escapecss filter (#3546)
* add escapecss filter this filter would allow creating valid css classes from titles containing special characters we assign a class to an element using `encodeuricomponent[]` so that the class name is encoded in a stylesheet we create the classname by `<title>escapecss[]` which applies the uri encoding and escapes characters that need to be escaped * Update encodings.js * refactor tagToCssSelector, add escapeCssSelector * use escapeCssSelector * escape using CSS.escape if it's available * Update encodings.js * revert factoring out escapeCssSelector
This commit is contained in:
parent
e313b0b7ca
commit
69d3a47073
@ -98,4 +98,13 @@ exports.escaperegexp = function(source,operator,options) {
|
|||||||
return results;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.escapecss = function(source,operator,options) {
|
||||||
|
var results = [];
|
||||||
|
source(function(tiddler,title) {
|
||||||
|
// escape any character with a special meaning in CSS using CSS.escape()
|
||||||
|
results.push(CSS.escape(title));
|
||||||
|
});
|
||||||
|
return results;
|
||||||
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
Reference in New Issue
Block a user