Skip to content

Commit b9bf2ed

Browse files
committed
Enhance the script to remove the space between categories/tags and colon in YAML.
1 parent d749ef2 commit b9bf2ed

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

_scripts/sh/create_pages.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ _read_yaml() {
2727

2828
read_categories() {
2929
local _yaml="$(_read_yaml "$1")"
30-
local _categories="$(echo "$_yaml" | grep "^categories:")"
31-
local _category="$(echo "$_yaml" | grep "^category:")"
30+
local _categories="$(echo "$_yaml" | grep "^categories *:")"
31+
local _category="$(echo "$_yaml" | grep "^category *:")"
3232

3333
if [[ ! -z "$_categories" ]]; then
34-
echo "$_categories" | sed "s/categories: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
34+
echo "$_categories" | sed "s/categories *: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
3535
elif [[ ! -z "_category" ]]; then
36-
echo "$_category" | sed "s/category: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
36+
echo "$_category" | sed "s/category *: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
3737
fi
3838
}
3939

4040

4141
read_tags() {
4242
local _yaml="$(_read_yaml "$1")"
43-
echo "$_yaml" | grep "^tags:" | sed "s/tags: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
43+
echo "$_yaml" | grep "^tags *:" | sed "s/tags *: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
4444
}
4545

4646

0 commit comments

Comments
 (0)