add assets

This commit is contained in:
2022-01-23 22:48:09 +00:00
parent 49810833ca
commit c6b191ce16
1000 changed files with 9828 additions and 7954 deletions

View File

@@ -134,8 +134,7 @@
for (const lookup of ALL_DOWNCODE_MAPS) {
Object.assign(Downcoder.map, lookup);
}
Downcoder.chars = Object.keys(Downcoder.map);
Downcoder.regex = new RegExp(Downcoder.chars.join('|'), 'g');
Downcoder.regex = new RegExp(Object.keys(Downcoder.map).join('|'), 'g');
}
};
@@ -149,23 +148,9 @@
function URLify(s, num_chars, allowUnicode) {
// changes, e.g., "Petty theft" to "petty-theft"
// remove all these words from the string before urlifying
if (!allowUnicode) {
s = downcode(s);
}
const hasUnicodeChars = /[^\u0000-\u007f]/.test(s);
// Remove English words only if the string contains ASCII (English)
// characters.
if (!hasUnicodeChars) {
const removeList = [
"a", "an", "as", "at", "before", "but", "by", "for", "from",
"is", "in", "into", "like", "of", "off", "on", "onto", "per",
"since", "than", "the", "this", "that", "to", "up", "via",
"with"
];
const r = new RegExp('\\b(' + removeList.join('|') + ')\\b', 'gi');
s = s.replace(r, '');
}
s = s.toLowerCase(); // convert to lowercase
// if downcode doesn't hit, the char will be stripped here
if (allowUnicode) {