standardize-and-complete-readmes: Allow to link releases

[why]
Some fonts will not be released to the repo; but only exist patched as
release atrifacts. This needs adapted readmes.

[how]
If such a font is encountered direct links to the release archives are
put into the readme file.

Decide based on information in the font.json file.

If no info is found in the json file (i.e. all existing fonts) it
defaults to release-also-to-repo behavior.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2023-07-26 14:10:28 +02:00 committed by Fini
parent a2bd75865a
commit f29c62ab17
3 changed files with 24 additions and 3 deletions

View file

@ -307,6 +307,8 @@ jobs:
committer_email: 41898282+github-actions[bot]@users.noreply.github.com committer_email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Commit patched fonts back to repo - name: Commit patched fonts back to repo
# For fonts with repoRelease == false in the font.json the gitignore should
# have been setup in a way that this commits only the README.md
uses: EndBug/add-and-commit@v9 uses: EndBug/add-and-commit@v9
with: with:
fetch: false fetch: false

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Nerd Fonts Version: 3.0.2 # Nerd Fonts Version: 3.0.2
# Script Version: 1.1.3 # Script Version: 1.1.4
# Iterates over all patched fonts directories # Iterates over all patched fonts directories
# converts all non markdown readmes to markdown (e.g., txt, rst) using pandoc # converts all non markdown readmes to markdown (e.g., txt, rst) using pandoc
# adds information on additional-variations and complete font variations # adds information on additional-variations and complete font variations
@ -18,6 +18,19 @@ cd "$sd/../../src/unpatched-fonts/" || {
} }
function appendGeneralInfo {
local dest=$1; shift
local fontname=$1; shift
local has_repo=$1; shift
if [ -n "${has_repo}" ]
then
downloadfrom="Or download the development version from the folders here"
else
downloadfrom="https://github.com/ryanoasis/nerd-fonts/releases/latest/${fontname}.zip or https://github.com/ryanoasis/nerd-fonts/releases/latest/${fontname}.tar.xz"
fi
sed -e "s|%DOWNLOADFROM%|${downloadfrom}|" "${sd}/../../src/readme-per-directory-addendum.md" >> "${dest}"
}
function appendRfnInfo { function appendRfnInfo {
local config_rfn=$1; shift local config_rfn=$1; shift
local config_rfn_substitue=$1; shift local config_rfn_substitue=$1; shift
@ -90,6 +103,12 @@ do
unset config_rfn_substitue unset config_rfn_substitue
fi fi
fi fi
unset release_to_repo
# This defaults to true if no info is given:
if [ "$(echo "$fontdata" | jq .repoRelease)" != "false" ]
then
release_to_repo=TRUE
fi
fi fi
mapfile -t RST < <(find "$searchdir" -type f -iname 'readme.rst') mapfile -t RST < <(find "$searchdir" -type f -iname 'readme.rst')
@ -139,6 +158,6 @@ do
} >> "$to" } >> "$to"
fi fi
appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to" appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to"
cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to" appendGeneralInfo "$to" "$base_directory" "$release_to_repo"
done done

View file

@ -21,7 +21,7 @@ Once you narrow down your font choice of family (`Droid Sans`, `Inconsolata`, et
#### `Option 1: Download already patched font` #### `Option 1: Download already patched font`
* For a stable version download a font package from the [release page](https://github.com/ryanoasis/nerd-fonts/releases) * For a stable version download a font package from the [release page](https://github.com/ryanoasis/nerd-fonts/releases)
* Or download the development version from the folders here * %DOWNLOADFROM%
#### `Option 2: Patch your own font` #### `Option 2: Patch your own font`