Enhance the script to remove the space between categories
/tags
and colon in YAML.
This commit is contained in:
parent
2d7df50774
commit
232dd36b78
1 changed files with 5 additions and 5 deletions
|
@ -27,20 +27,20 @@ _read_yaml() {
|
||||||
|
|
||||||
read_categories() {
|
read_categories() {
|
||||||
local _yaml="$(_read_yaml "$1")"
|
local _yaml="$(_read_yaml "$1")"
|
||||||
local _categories="$(echo "$_yaml" | grep "^categories:")"
|
local _categories="$(echo "$_yaml" | grep "^categories *:")"
|
||||||
local _category="$(echo "$_yaml" | grep "^category:")"
|
local _category="$(echo "$_yaml" | grep "^category *:")"
|
||||||
|
|
||||||
if [[ ! -z "$_categories" ]]; then
|
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
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
read_tags() {
|
read_tags() {
|
||||||
local _yaml="$(_read_yaml "$1")"
|
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"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue