generate-css: Create cheat sheet with removed icons

With v3.0.0 we removed some icons and some codepoints have been reused
for a different (expanding) set. We want to show the old (removed) icons
correctly and the new ones also, so we need the old and the new font for
the webpage and reference it accordingly.

For the a new style .nfold (read: nd-olf) is introduced and utilized.

See pairing commit in the gh-pages branch:
    Date:   Thu May 4 06:01:33 2023 +0200
    Update cheat sheet WITH removed icons

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-05-03 17:54:44 +02:00
parent 239246599b
commit 1f70d5bc3a
5 changed files with 63 additions and 25 deletions

2
.gitignore vendored
View file

@ -13,3 +13,5 @@ package-lock.json
*.uuid *.uuid
bin/scripts/name_parser/__pycache__/* bin/scripts/name_parser/__pycache__/*
bin/scripts/name_parser/log bin/scripts/name_parser/log
# This is just needed for the cheat sheet and not go into the repo:
css/nerd-fonts-generated-removed.min.css

View file

@ -1,4 +1,9 @@
</div> </div>
<h3>Removed Icons</h3>
<h5 align="center">With Release <code>v3.0.0</code> the Material Design Icons were updated and moved to new codepoints (reasons for that are in the release notes).</h5>
<h5 align="center">They are still shown here for reference, but are missing in the actual fonts.</h5>
<h5 align="center">To find for example the replacement for <code>nf-mdi-altimeter</code> enter just <code>altimeter</code> in the search box.</h5>
<br>
<h3>Example Usages</h3> <h3>Example Usages</h3>

View file

@ -0,0 +1 @@
@font-face{font-family:'V233Symbols';src:url("../fonts/Symbols-2048-em Nerd Font Complete v233.woff2") format("woff2");font-weight:normal;font-style:normal}.nfold,.nerd-font,.nerd-fonts{font-family:'V233Symbols';speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}

View file

@ -4,12 +4,14 @@
# Generates CSS file for the font and cheat sheet code # Generates CSS file for the font and cheat sheet code
# shellcheck disable=SC1091 # shellcheck disable=SC1091
source ./lib/i_all.sh source ./lib/i_all.sh include-old-material
output_css_file="../../css/nerd-fonts-generated.css" output_css_file="../../css/nerd-fonts-generated.css"
output_css_min_file="../../css/nerd-fonts-generated.min.css" output_css_min_file="../../css/nerd-fonts-generated.min.css"
output_css_min_rem_file="../../css/nerd-fonts-generated-removed.min.css"
header_css_file="./data/css-header.txt" header_css_file="./data/css-header.txt"
header_css_min_file="./data/css-min-header.txt" header_css_min_file="./data/css-min-header.txt"
header_css_min_rem_file="./data/css-min-removed-header.txt"
output_json_file="../../glyphnames.json" output_json_file="../../glyphnames.json"
if [ ! -d "../../temp" ]; then if [ ! -d "../../temp" ]; then
@ -25,6 +27,7 @@ version="3.0.0"
# clear files # clear files
true > "$output_css_file" 2> /dev/null true > "$output_css_file" 2> /dev/null
true > "$output_css_min_file" 2> /dev/null true > "$output_css_min_file" 2> /dev/null
true > "$output_css_min_rem_file" 2> /dev/null
true > "$output_cheat_sheet_file" 2> /dev/null true > "$output_cheat_sheet_file" 2> /dev/null
true > "$output_json_file" 2> /dev/null true > "$output_json_file" 2> /dev/null
@ -36,7 +39,7 @@ true > "$output_json_file" 2> /dev/null
printf " *%s Version: %s\\n" "$LINE_PREFIX" "$version" printf " *%s Version: %s\\n" "$LINE_PREFIX" "$version"
printf " *%s The following is generated from the build script\\n" "$LINE_PREFIX" printf " *%s The following is generated from the build script\\n" "$LINE_PREFIX"
printf " */\\n" printf " */\\n"
} | tee "$output_css_min_file" >> "$output_css_file" } | tee "$output_css_min_file" | tee "$output_css_min_rem_file" >> "$output_css_file"
# add top section of CSS # add top section of CSS
{ {
@ -44,6 +47,7 @@ true > "$output_json_file" 2> /dev/null
cat "$header_css_file" cat "$header_css_file"
} >> "$output_css_file" } >> "$output_css_file"
cat "$header_css_min_file" | tr -d '\n' >> "$output_css_min_file" cat "$header_css_min_file" | tr -d '\n' >> "$output_css_min_file"
cat "$header_css_min_rem_file" | tr -d '\n' >> "$output_css_min_rem_file"
cat "$cheat_sheet_head_file" > "$output_cheat_sheet_file" cat "$cheat_sheet_head_file" > "$output_cheat_sheet_file"
@ -76,29 +80,44 @@ for var in "${!i@}"; do
#echo "$glyph_code" #echo "$glyph_code"
#printf "%x" "'$glyph_char'" #printf "%x" "'$glyph_char'"
# generate css rules if [[ "$glyph_name" != mdi-* ]]; then
{ # generate css rules
printf ".nf-%s:before {" "$glyph_name" {
printf "\\n" printf ".nf-%s:before {" "$glyph_name"
printf " content: \"\\%s\";" "$glyph_code" printf "\\n"
printf "\\n" printf " content: \"\\%s\";" "$glyph_code"
printf "}" printf "\\n"
printf "\\n" printf "}"
} >> "$output_css_file" printf "\\n"
} >> "$output_css_file"
# generate css min rules # generate css min rules
{ {
printf ".nf-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code" printf ".nf-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code"
} >> "$output_css_min_file" } >> "$output_css_min_file"
# generate json entry
{
printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%s\"}" "$glyph_name" "$glyph_char" "$glyph_code"
} >> "$output_json_file"
else
# generate css min rules for removed glyphs
{
printf ".nfold-%s:before{content:\"\\%s\"}" "$glyph_name" "$glyph_code"
} >> "$output_css_min_rem_file"
fi
# generate HTML cheat sheet # generate HTML cheat sheet
{ {
printf " <div class=\"column\">" printf " <div class=\"column\">"
printf "\\n" printf "\\n"
if [[ "$glyph_name" = mdi-* ]]; then if [[ "$glyph_name" = mdi-* ]]; then
printf " <span class=\"corner-red\"></span><span class=\"corner-text\">obsolete</span>\\n" printf " <span class=\"corner-red\"></span><span class=\"corner-text\">removed</span>\\n"
printf " <div class=\"nfold nfold-%s center\"></div>" "$glyph_name"
else
printf " <div class=\"nf nf-%s center\"></div>" "$glyph_name"
fi fi
printf " <div class=\"nf nf-%s center\"></div>" "$glyph_name"
printf "\\n" printf "\\n"
printf " <div class=\"class-name\">nf-%s</div><div title=\"Copy Hex Code to Clipboard\" class=\"codepoint\">%s</div>" "$glyph_name" "$glyph_code" printf " <div class=\"class-name\">nf-%s</div><div title=\"Copy Hex Code to Clipboard\" class=\"codepoint\">%s</div>" "$glyph_name" "$glyph_code"
printf "\\n" printf "\\n"
@ -106,14 +125,14 @@ for var in "${!i@}"; do
printf "\\n" printf "\\n"
} >> "$output_cheat_sheet_file" } >> "$output_cheat_sheet_file"
# generate json entry
{
printf ",\"%s\":{\"char\":\"%s\",\"code\":\"%s\"}" "$glyph_name" "$glyph_char" "$glyph_code"
} >> "$output_json_file"
done done
cat "$cheat_sheet_foot_file" >> "$output_cheat_sheet_file" cat "$cheat_sheet_foot_file" >> "$output_cheat_sheet_file"
printf "}\n" >> "$output_json_file" printf "}\n" >> "$output_json_file"
printf "Generated CSS, json, and Cheat Sheet HTML\\n" printf "Generated CSS, json, and Cheat Sheet HTML\\n"
printf "$output_css_file\n"
printf "$output_css_min_file [needs to also go into gh-pages:_includes/css/]\n"
printf "$output_css_min_rem_file [needs to only go into gh-pages:_includes/css/]\n"
printf "$output_cheat_sheet_file [needs to only go into gh-pages:_posts/]\n"
printf "$output_json_file\n"

View file

@ -1,9 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Nerd Fonts Version: 3.0.0 # Nerd Fonts Version: 3.0.0
# Script Version 1.1.0 # Script Version 1.2.0
for i in $(dirname "${BASH_SOURCE[0]:-$0}")/i_{cod,dev,fae,fa,iec,logos,oct,ple,pom,seti,material,weather,md}.sh; do # Usually this is called without argument. If the first argument
# shellcheck source=/dev/null # is 'include-old-material' the old material design icons will be
# included. This is needed for the cheat sheet.
sets=('cod' 'dev' 'fae' 'fa' 'iec' 'logos' 'oct' 'ple' 'pom' 'seti' 'weather' 'md')
base=$(dirname "${BASH_SOURCE[0]:-$0}")
if [ "$1" = "include-old-material" ]; then
sets=(${sets[@]} 'material')
fi
for set in ${sets[@]}; do
i="${base}/i_${set}.sh"
test -f "$i" -a -r "$i" && source "$i" test -f "$i" -a -r "$i" && source "$i"
done done
unset i unset i