mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:07:35 +00:00
Meta: Only include headings for populated groups/subgroups in emoji.txt
The primary motivation for this is to make `generate-emoji-txt.sh` more useful for generating a compact list of new emoji being added (e.g. for use in commit messages / PRs) if it's run with an emoji image directory that contains only the new emojis.
This commit is contained in:
parent
0dd88fd836
commit
032e06b762
1 changed files with 22 additions and 6 deletions
|
@ -15,14 +15,16 @@ OUTPUT_PATH="$3"
|
||||||
:>| "$OUTPUT_PATH"
|
:>| "$OUTPUT_PATH"
|
||||||
|
|
||||||
first_heading=true
|
first_heading=true
|
||||||
|
printed_group_header=false
|
||||||
|
printed_subgroup_header=false
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
do
|
do
|
||||||
if [[ $line == \#\ subgroup:\ * || $line == \#\ group:\ * ]]; then
|
if [[ $line == \#\ group:\ * ]]; then
|
||||||
if [ $first_heading = false ]; then
|
current_group="$line"
|
||||||
echo "" >> "$OUTPUT_PATH"
|
printed_group_header=false
|
||||||
fi
|
elif [[ $line == \#\ subgroup:\ * ]]; then
|
||||||
echo "$line" >> "$OUTPUT_PATH"
|
current_subgroup="$line"
|
||||||
first_heading=false
|
printed_subgroup_header=false
|
||||||
elif [[ ${#line} -ne 0 && $line != \#* ]]; then
|
elif [[ ${#line} -ne 0 && $line != \#* ]]; then
|
||||||
codepoints_string=${line%%;*}
|
codepoints_string=${line%%;*}
|
||||||
IFS=" " read -r -a codepoints <<< "$codepoints_string"
|
IFS=" " read -r -a codepoints <<< "$codepoints_string"
|
||||||
|
@ -45,6 +47,20 @@ do
|
||||||
lookup_filename="${lookup_filename_parts[*]}.png"
|
lookup_filename="${lookup_filename_parts[*]}.png"
|
||||||
|
|
||||||
if [ -f "$EMOJI_DIR/$lookup_filename" ]; then
|
if [ -f "$EMOJI_DIR/$lookup_filename" ]; then
|
||||||
|
if [ $printed_group_header = false ]; then
|
||||||
|
if [ $first_heading = false ]; then
|
||||||
|
echo "" >> "$OUTPUT_PATH"
|
||||||
|
fi
|
||||||
|
echo "$current_group" >> "$OUTPUT_PATH"
|
||||||
|
first_heading=false
|
||||||
|
printed_group_header=true
|
||||||
|
fi
|
||||||
|
if [ $printed_subgroup_header = false ]; then
|
||||||
|
echo "" >> "$OUTPUT_PATH"
|
||||||
|
echo "$current_subgroup" >> "$OUTPUT_PATH"
|
||||||
|
printed_subgroup_header=true
|
||||||
|
fi
|
||||||
|
|
||||||
emoji_and_name=${line#*# }
|
emoji_and_name=${line#*# }
|
||||||
emoji=${emoji_and_name%% E*}
|
emoji=${emoji_and_name%% E*}
|
||||||
name_with_version=${emoji_and_name#* }
|
name_with_version=${emoji_and_name#* }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue