simpler
This commit is contained in:
@@ -4,23 +4,6 @@
|
|||||||
|
|
||||||
file_path="$1"
|
file_path="$1"
|
||||||
base_cmd="go-yq --front-matter=process"
|
base_cmd="go-yq --front-matter=process"
|
||||||
# Check if the file has valid front matter
|
|
||||||
|
|
||||||
is_empty() {
|
|
||||||
if $(echo "$1" | grep -q "^null$"); then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
is_true() {
|
|
||||||
if $(echo "$1" | grep -q "^true$"); then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Checking front matter"
|
echo "Checking front matter"
|
||||||
if ! head -n 1 "$file_path" | grep -q "^---$"; then
|
if ! head -n 1 "$file_path" | grep -q "^---$"; then
|
||||||
@@ -32,18 +15,10 @@ if ! head -n 1 "$file_path" | grep -q "^---$"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
wc -l $file_path
|
wc -l $file_path
|
||||||
cat $file_path
|
|
||||||
|
|
||||||
# Get the title from the front matter
|
# Get the title from the front matter
|
||||||
echo "Checking title"
|
echo "Updating title"
|
||||||
title=$($base_cmd '.title' "$file_path")
|
$base_cmd -i '.title="Changelog"' "$file_path"
|
||||||
# Check if the title is empty
|
|
||||||
if is_empty "$title"; then
|
|
||||||
$base_cmd -i '.title="Changelog"' "$file_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Checking pagefind"
|
echo "Updating pagefind"
|
||||||
pagefind=$($base_cmd '.pagefind' "$file_path")
|
$base_cmd -i '.pagefind=false' "$file_path"
|
||||||
if is_empty "$pagefind" || is_true "$pagefind"; then
|
|
||||||
$base_cmd -i '.pagefind=false' "$file_path"
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -39,4 +39,4 @@ sources:
|
|||||||
- https://github.com/truecharts/charts/tree/master/charts/incubator/flashpaper
|
- https://github.com/truecharts/charts/tree/master/charts/incubator/flashpaper
|
||||||
- https://ghcr.io/andrewpaglusch/flashpaper
|
- https://ghcr.io/andrewpaglusch/flashpaper
|
||||||
type: application
|
type: application
|
||||||
version: 2.0.11
|
version: 2.0.12
|
||||||
|
|||||||
Reference in New Issue
Block a user