Skip to content

Commit

Permalink
Enhance the script to remove the space between categories/tags an…
Browse files Browse the repository at this point in the history
…d colon in YAML.
  • Loading branch information
cotes2020 committed Aug 31, 2020
1 parent 3a90a14 commit 8edcdcc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions _scripts/sh/create_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ _read_yaml() {

read_categories() {
local _yaml="$(_read_yaml "$1")"
local _categories="$(echo "$_yaml" | grep "^categories:")"
local _category="$(echo "$_yaml" | grep "^category:")"
local _categories="$(echo "$_yaml" | grep "^categories *:")"
local _category="$(echo "$_yaml" | grep "^category *:")"

if [[ ! -z "$_categories" ]]; then
echo "$_categories" | sed "s/categories: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
echo "$_categories" | sed "s/categories *: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
elif [[ ! -z "_category" ]]; then
echo "$_category" | sed "s/category: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
echo "$_category" | sed "s/category *: *//;s/\[//;s/\].*//;s/, */,/g;s/\"//g;s/'//g"
fi
}


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


Expand Down

0 comments on commit 8edcdcc

Please sign in to comment.