From 6136b8a79a7f0ce5e35dc07cd88965953bd0e1af Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 1 Mar 2026 17:39:53 +0200 Subject: Extract generate::extract_title helper to eliminate duplication Title extraction ($SED pattern + quote sanitization) was duplicated in generate, atomfeed, gemfeed, notes, and template modules. Now centralized with unit tests for heading extraction and empty files. Co-Authored-By: Claude Opus 4.6 --- lib/atomfeed.source.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/atomfeed.source.sh') diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh index 3fe46be..20a87d0 100644 --- a/lib/atomfeed.source.sh +++ b/lib/atomfeed.source.sh @@ -121,7 +121,7 @@ atomfeed::_entry () { assert::not_empty content "$content" # Extract first heading as post title. - local title=$($SED -n '/^# / { s/# //; p; q; }' "$gemfeed_dir/$gmi_file" | tr '"' "'") + local title=$(generate::extract_title "$gemfeed_dir/$gmi_file") assert::not_empty title "$title" # Extract first paragraph from Gemtext as the summary. -- cgit v1.2.3