generate-css: Create a json database with css names

[why]
Somebody might want to have a file where all symbols we add are listed.
At the moment there are only the i_*.sh scripts and the CSS files. Both
are rather unwieldy.

[how]
Just create a json file with all symbol names, like the CSS file.

Fixes: #448

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-03-02 12:14:49 +01:00 committed by Fini
parent 5d57dbe9a0
commit 368ba3444b
3 changed files with 21 additions and 2 deletions

View file

@ -347,7 +347,7 @@ jobs:
id: push_css
with:
fetch: false
add: 'css'
add: "['css', 'glyphnames.json']"
message: "[ci] Regenerate CSS files"
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com

View file

@ -10,6 +10,7 @@ output_css_file="../../css/nerd-fonts-generated.css"
output_css_min_file="../../css/nerd-fonts-generated.min.css"
header_css_file="./data/css-header.txt"
header_css_min_file="./data/css-min-header.txt"
output_json_file="../../glyphnames.json"
if [ ! -d "../../temp" ]; then
mkdir "../../temp"
@ -25,6 +26,7 @@ version="2.3.3"
true > "$output_css_file" 2> /dev/null
true > "$output_css_min_file" 2> /dev/null
true > "$output_cheat_sheet_file" 2> /dev/null
true > "$output_json_file" 2> /dev/null
# describe how the classes were established
{
@ -45,6 +47,16 @@ cat "$header_css_min_file" | tr -d '\n' >> "$output_css_min_file"
cat "$cheat_sheet_head_file" > "$output_cheat_sheet_file"
# add top section of json
{
printf "{\"METADATA\":{"
printf "\"website\":\"https://www.nerdfonts.com\","
printf "\"development-website\":\"https://github.com/ryanoasis/nerd-fonts\","
printf "\"version\":\"$version\","
printf "\"date\":\"$(date -u --rfc-3339=seconds)\""
printf "}"
} >> "$output_json_file"
echo;
# shellcheck disable=SC2154
@ -94,8 +106,14 @@ for var in "${!i@}"; do
printf "\\n"
} >> "$output_cheat_sheet_file"
# generate json entry
{
printf ",\"%s\":\"%s\"" "$glyph_name" "$glyph_char"
} >> "$output_json_file"
done
cat "$cheat_sheet_foot_file" >> "$output_cheat_sheet_file"
printf "}\n" >> "$output_json_file"
printf "Generated CSS and Cheat Sheet HTML\\n"
printf "Generated CSS, json, and Cheat Sheet HTML\\n"

1
glyphnames.json Normal file

File diff suppressed because one or more lines are too long