Remove .config/DankMaterialShell/firefox.css
Remove .config/DankMaterialShell/plugin_settings.json Remove .config/DankMaterialShell/plugins/calculator/CalculatorLauncher.qml Remove .config/DankMaterialShell/plugins/calculator/CalculatorSettings.qml Remove .config/DankMaterialShell/plugins/calculator/README.md Remove .config/DankMaterialShell/plugins/calculator/calculator.js Remove .config/DankMaterialShell/plugins/calculator/.git/HEAD Remove .config/DankMaterialShell/plugins/calculator/.git/config Remove .config/DankMaterialShell/plugins/calculator/.git/index Remove .config/DankMaterialShell/plugins/calculator/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.idx Remove .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.rev Remove .config/DankMaterialShell/plugins/calculator/.git/objects/pack/pack-67f644835e660794f65c9273e46788b0c3da57cf.pack Remove .config/DankMaterialShell/plugins/calculator/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/calculator/.git/refs/remotes/origin/qalc Remove .config/DankMaterialShell/plugins/calculator/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/calculator/plugin.json Remove .config/DankMaterialShell/plugins/calculator/screenshot.png Remove .config/DankMaterialShell/plugins/calculator/test_precision.js Remove .config/DankMaterialShell/plugins/calculator/test_single.js Remove .config/DankMaterialShell/plugins/commandRunner/CommandRunner.qml Remove .config/DankMaterialShell/plugins/commandRunner/CommandRunnerSettings.qml Remove .config/DankMaterialShell/plugins/commandRunner/LICENSE Remove .config/DankMaterialShell/plugins/commandRunner/README.md Remove .config/DankMaterialShell/plugins/commandRunner/.git/HEAD Remove .config/DankMaterialShell/plugins/commandRunner/.git/config Remove .config/DankMaterialShell/plugins/commandRunner/.git/index Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.idx Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.rev Remove .config/DankMaterialShell/plugins/commandRunner/.git/objects/pack/pack-5a720f795fd2994ef506cd867d86ca7df8a25a31.pack Remove .config/DankMaterialShell/plugins/commandRunner/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/commandRunner/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/commandRunner/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/commandRunner/plugin.json Remove .config/DankMaterialShell/plugins/commandRunner/screenshot.png Remove .config/DankMaterialShell/plugins/dankActions.meta Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/DankActionsWidget.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankActions/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlerts.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/DankBatteryAlertsSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankBatteryAlerts/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooks.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/DankHooksSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/README.md Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankHooks/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroSettings.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/DankPomodoroWidget.qml Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/DankPomodoroTimer/plugin.json Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/LICENSE Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/README.md Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/HEAD Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/config Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/index Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.idx Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.rev Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/objects/pack/pack-3221a15c022ef4a7bb6bf2c47e40068b66b3588b.pack Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/heads/master Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/remotes/origin/master Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/.repos/0026f1eba8dedaec/.gitignore Remove .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncher.qml Remove .config/DankMaterialShell/plugins/emojiLauncher/EmojiLauncherSettings.qml Remove .config/DankMaterialShell/plugins/emojiLauncher/LICENSE Remove .config/DankMaterialShell/plugins/emojiLauncher/README.md Remove .config/DankMaterialShell/plugins/emojiLauncher/catalog.js Remove .config/DankMaterialShell/plugins/emojiLauncher/data/emojis.txt Remove .config/DankMaterialShell/plugins/emojiLauncher/data/math.txt Remove .config/DankMaterialShell/plugins/emojiLauncher/data/nerdfont.txt Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/HEAD Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/config Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/index Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.idx Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.rev Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/objects/pack/pack-e04a5b1ea381dc3a792b8bf08cf70e735b195c0d.pack Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/emojiLauncher/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/emojiLauncher/plugin.json Remove .config/DankMaterialShell/plugins/emojiLauncher/screenshot.png Remove .config/DankMaterialShell/plugins/emojiLauncher/scripts/generate_catalog.py Remove .config/DankMaterialShell/plugins/dankActions Remove .config/DankMaterialShell/plugins/webSearch/LICENSE Remove .config/DankMaterialShell/plugins/webSearch/README.md Remove .config/DankMaterialShell/plugins/webSearch/WebSearch.qml Remove .config/DankMaterialShell/plugins/webSearch/WebSearchSettings.qml Remove .config/DankMaterialShell/plugins/webSearch/.git/HEAD Remove .config/DankMaterialShell/plugins/webSearch/.git/config Remove .config/DankMaterialShell/plugins/webSearch/.git/index Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/info/.keep Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.idx Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.rev Remove .config/DankMaterialShell/plugins/webSearch/.git/objects/pack/pack-6a60c736f418e5b4b1f0505f66c1e2a371d46fed.pack Remove .config/DankMaterialShell/plugins/webSearch/.git/refs/heads/main Remove .config/DankMaterialShell/plugins/webSearch/.git/refs/remotes/origin/main Remove .config/DankMaterialShell/plugins/webSearch/.git/refs/tags/.keep Remove .config/DankMaterialShell/plugins/webSearch/plugin.json Remove .config/DankMaterialShell/plugins/webSearch/screenshot.png Remove .config/DankMaterialShell/settings.json
This commit is contained in:
parent
e08bb9229f
commit
917b479a94
103 changed files with 0 additions and 24611 deletions
|
|
@ -1,161 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""Builds the catalog.js bundle from the plain-text data sources."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DATA = ROOT / "data"
|
||||
OUTPUT = ROOT / "catalog.js"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
emoji_entries = parse_emoji(DATA / "emojis.txt")
|
||||
unicode_entries = parse_unicode(DATA / "math.txt")
|
||||
nerd_font_entries = parse_nerdfont(DATA / "nerdfont.txt")
|
||||
|
||||
write_catalog(
|
||||
emoji_entries=emoji_entries,
|
||||
unicode_entries=unicode_entries,
|
||||
nerd_font_entries=nerd_font_entries,
|
||||
)
|
||||
|
||||
|
||||
def parse_emoji(path: Path) -> list[dict]:
|
||||
return _parse_symbol_file(
|
||||
path,
|
||||
key_name="emoji",
|
||||
extra_keywords=lambda raw: [],
|
||||
)
|
||||
|
||||
|
||||
def parse_unicode(path: Path) -> list[dict]:
|
||||
return _parse_symbol_file(
|
||||
path,
|
||||
key_name="char",
|
||||
extra_keywords=lambda raw: [],
|
||||
)
|
||||
|
||||
|
||||
def parse_nerdfont(path: Path) -> list[dict]:
|
||||
def extra_keywords(raw: str) -> list[str]:
|
||||
extras = ["nerdfont", raw]
|
||||
if raw.startswith("ple-"):
|
||||
extras.extend(["powerline", "ple"])
|
||||
return extras
|
||||
|
||||
entries = _parse_symbol_file(
|
||||
path,
|
||||
key_name="char",
|
||||
preprocess_name=lambda name: re.sub(r"[_-]+", " ", name).strip(),
|
||||
extra_keywords=extra_keywords,
|
||||
)
|
||||
|
||||
for entry in entries:
|
||||
name = entry.get("name", "")
|
||||
if name.startswith("Ple "):
|
||||
entry["name"] = "Powerline " + name[4:]
|
||||
|
||||
return entries
|
||||
|
||||
|
||||
def _parse_symbol_file(
|
||||
path: Path,
|
||||
*,
|
||||
key_name: str,
|
||||
preprocess_name=lambda name: name,
|
||||
extra_keywords=lambda raw: [],
|
||||
) -> list[dict]:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
entries: list[dict] = []
|
||||
|
||||
for raw_line in text.splitlines():
|
||||
if not raw_line:
|
||||
continue
|
||||
trimmed = raw_line.strip()
|
||||
if not trimmed or trimmed.startswith("#"):
|
||||
continue
|
||||
|
||||
match = re.match(r"^(\S+|\s)\s+(.*)$", raw_line)
|
||||
if not match:
|
||||
continue
|
||||
|
||||
symbol = match.group(1)
|
||||
raw_name = match.group(2).strip()
|
||||
|
||||
if not raw_name or ".." in symbol:
|
||||
continue
|
||||
|
||||
cleaned_name = preprocess_name(raw_name) or raw_name
|
||||
friendly = prettify_name(cleaned_name)
|
||||
keywords = build_keywords(cleaned_name, extra_keywords(raw_name))
|
||||
|
||||
entry = {
|
||||
key_name: symbol,
|
||||
"name": friendly,
|
||||
"keywords": keywords,
|
||||
}
|
||||
entries.append(entry)
|
||||
|
||||
return entries
|
||||
|
||||
|
||||
def prettify_name(raw: str) -> str:
|
||||
tokens = [token for token in re.split(r"\s+", raw) if token]
|
||||
return " ".join(token.capitalize() for token in tokens)
|
||||
|
||||
|
||||
def build_keywords(raw: str, extras: list[str]) -> list[str]:
|
||||
seen: set[str] = set()
|
||||
keywords: list[str] = []
|
||||
|
||||
def add_token(token: str) -> None:
|
||||
lowered = token.lower()
|
||||
if lowered and lowered not in seen:
|
||||
seen.add(lowered)
|
||||
keywords.append(lowered)
|
||||
|
||||
def tokenize(value: str) -> list[str]:
|
||||
return [part for part in re.split(r"[^a-zA-Z0-9+]+", value.lower()) if part]
|
||||
|
||||
for token in tokenize(raw):
|
||||
add_token(token)
|
||||
|
||||
for extra in extras:
|
||||
for token in tokenize(extra):
|
||||
add_token(token)
|
||||
|
||||
return keywords
|
||||
|
||||
|
||||
def write_catalog(*, emoji_entries, unicode_entries, nerd_font_entries) -> None:
|
||||
OUTPUT.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
"// Auto-generated by scripts/generate_catalog.py",
|
||||
"// Do not edit manually.",
|
||||
".pragma library",
|
||||
"",
|
||||
f"var emojiEntries = {json.dumps(emoji_entries, ensure_ascii=False)};",
|
||||
f"var unicodeEntries = {json.dumps(unicode_entries, ensure_ascii=False)};",
|
||||
f"var nerdFontEntries = {json.dumps(nerd_font_entries, ensure_ascii=False)};",
|
||||
"",
|
||||
"function clone(array) {",
|
||||
" return array ? array.slice() : [];",
|
||||
"}",
|
||||
"",
|
||||
"function getEmojiEntries() { return clone(emojiEntries); }",
|
||||
"function getUnicodeEntries() { return clone(unicodeEntries); }",
|
||||
"function getNerdFontEntries() { return clone(nerdFontEntries); }",
|
||||
]
|
||||
)
|
||||
+ "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue