mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-11-19 16:39:20 +02:00
standardize-and-complete-readmes: Simplify code
[why] We have a lot duplicated code here. [how] As the to and to-dir never changes we can assign that outside all the if cases. We can also always just add the extra information to the (only one, independent of number of incoming data files) output after all the ifs. Note that this also adds the extra information if we had no readme at all. Previous code would not add anything to that (for whatever reason). Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
ebdcc0b746
commit
a2bd75865a
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nerd Fonts Version: 3.0.2
|
||||
# Script Version: 1.1.2
|
||||
# Script Version: 1.1.3
|
||||
# Iterates over all patched fonts directories
|
||||
# converts all non markdown readmes to markdown (e.g., txt, rst) using pandoc
|
||||
# adds information on additional-variations and complete font variations
|
||||
@ -101,72 +101,44 @@ do
|
||||
|
||||
[[ -d "$outputdir" ]] || mkdir -p "$outputdir"
|
||||
|
||||
to_dir="${patched_parent_dir}/$filename"
|
||||
to="${to_dir}/$infofilename"
|
||||
|
||||
if [ "${RST[0]}" ];
|
||||
then
|
||||
for i in "${RST[@]}"
|
||||
do
|
||||
echo "$LINE_PREFIX Found RST"
|
||||
|
||||
from="$unpatched_parent_dir/$i"
|
||||
to_dir="${patched_parent_dir}/$filename"
|
||||
to="${to_dir}/$infofilename"
|
||||
|
||||
clearDestination "$to_dir" "$to"
|
||||
|
||||
pandoc "$from" --from=rst --to=markdown --output="$to"
|
||||
|
||||
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to"
|
||||
cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to"
|
||||
done
|
||||
elif [ "${TXT[0]}" ];
|
||||
then
|
||||
for i in "${TXT[@]}"
|
||||
do
|
||||
echo "$LINE_PREFIX Found TXT"
|
||||
|
||||
from="$unpatched_parent_dir/$i"
|
||||
to_dir="${patched_parent_dir}/$filename"
|
||||
to="${to_dir}/$infofilename"
|
||||
|
||||
clearDestination "$to_dir" "$to"
|
||||
|
||||
cp "$from" "$to"
|
||||
|
||||
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to"
|
||||
cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to"
|
||||
done
|
||||
elif [ "${MD[0]}" ];
|
||||
then
|
||||
for i in "${MD[@]}"
|
||||
do
|
||||
echo "$LINE_PREFIX Found MD"
|
||||
|
||||
from="$unpatched_parent_dir/$i"
|
||||
to_dir="${patched_parent_dir}/$filename"
|
||||
to="${to_dir}/$infofilename"
|
||||
|
||||
clearDestination "$to_dir" "$to"
|
||||
|
||||
cp "$from" "$to"
|
||||
|
||||
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to"
|
||||
cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to"
|
||||
done
|
||||
else
|
||||
echo "$LINE_PREFIX Did not find any readme files (RST,TXT,MD) generating just title of Font"
|
||||
|
||||
to_dir="${patched_parent_dir}/$filename"
|
||||
to="${to_dir}/$infofilename"
|
||||
|
||||
clearDestination "$to_dir" "$to"
|
||||
|
||||
{
|
||||
printf "# %s\\n\\n" "$base_directory"
|
||||
} >> "$to"
|
||||
|
||||
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to"
|
||||
cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to"
|
||||
fi
|
||||
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to"
|
||||
cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to"
|
||||
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user