feat: include_cw_pages_in_search
All checks were successful
Lint / shellcheck (push) Successful in 19s
Publish kewt-git to AUR / publish-aur-git (push) Successful in 33s

This commit is contained in:
2026-04-01 12:39:06 +02:00
parent 0c0f249226
commit 8814c12480
3 changed files with 17 additions and 12 deletions

View File

@@ -589,7 +589,6 @@ if [ "$generate_search" = "true" ] || [ "$generate_tags" = "true" ]; then
parse_frontmatter "$md_file"
[ "$fm_draft" = "true" ] && continue
[ -n "$fm_content_warning" ] && continue
md_heading="$fm_title"
if [ -z "$md_heading" ]; then
@@ -606,16 +605,17 @@ if [ "$generate_search" = "true" ] || [ "$generate_tags" = "true" ]; then
md_heading="$title - Page"
fi
fi
if [ "$generate_search" = "true" ]; then
md_content=$(awk '{
if (NR == 1 && $0 == "---") { in_fm = 1; next }
if (in_fm && $0 == "---") { in_fm = 0; next }
if (in_fm) next
if ($0 ~ /^```/) { in_code = !in_code; next }
if (in_code) next
print
}' "$md_file" | sed \
if [ -z "$fm_content_warning" ] || [ "$include_cw_pages_in_search" = "true" ]; then
md_content=$(awk '{
if (NR == 1 && $0 == "---") { in_fm = 1; next }
if (in_fm && $0 == "---") { in_fm = 0; next }
if (in_fm) next
if ($0 ~ /^```/) { in_code = !in_code; next }
if (in_code) next
print
}' "$md_file" | sed \
-e 's/^#\{1,6\} //' \
-e 's/\*\*\([^*]*\)\*\*/\1/g' \
-e 's/\*\([^*]*\)\*/\1/g' \
@@ -637,6 +637,7 @@ if [ "$generate_search" = "true" ] || [ "$generate_tags" = "true" ]; then
fi
printf ' {"url": "%s", "title": "%s", "content": "%s"}' "$md_url" "$md_heading" "$md_content" >> "$out/search.json"
first_search_item="false"
fi
fi
if [ "$generate_tags" = "true" ] && [ -n "$fm_tags" ]; then