diff options
| author | Paul Buetow <paul@buetow.org> | 2023-03-25 17:52:28 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-03-25 17:52:28 +0200 |
| commit | 588ffda72f452b02f699c851451a1f6542cf701b (patch) | |
| tree | f1aa43739bcb9604acde98b6ff837820fe6567af /lib | |
| parent | 5b763ba45f6be3bccbc9dcf1959e3011f5c7d7d2 (diff) | |
also add publishing date to .tpl posts
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/atomfeed.source.sh | 6 | ||||
| -rw-r--r-- | lib/template.source.sh | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/atomfeed.source.sh b/lib/atomfeed.source.sh index d614fe0..059bdda 100644 --- a/lib/atomfeed.source.sh +++ b/lib/atomfeed.source.sh @@ -115,7 +115,7 @@ atomfeed::_entry () { assert::not_empty summary "$summary" # Extract the date from the file name. - local date=$($SED -n '/^> Published at / { s/.*Published at //; s/;.*//; p; }' "$gemfeed_dir/$gmi_file") + local date=$(head "$gemfeed_dir/$gmi_file" | $SED -n '/^> Published at / { s/.*Published at //; s/;.*//; p; }') if [ -z "$date" ]; then # Extract the date from the file. date=$($DATE $DATE_FORMAT --reference "$gemfeed_dir/$gmi_file") @@ -173,4 +173,8 @@ atomfeed::_insert_date () { } > "$gmi_file_path.insert.tmp" mv "$gmi_file_path.insert.tmp" "$gmi_file_path" + + if [ -f "$gmi_file_path.tpl" ]; then + atomfeed::_insert_date "$date" "$gmi_file_path.tpl" + fi } diff --git a/lib/template.source.sh b/lib/template.source.sh index 204078d..17f6a5f 100644 --- a/lib/template.source.sh +++ b/lib/template.source.sh @@ -62,7 +62,7 @@ $line" echo "$line" ;; esac - done | $SED 's/^\[\[\[/<<</; s/^\]\]\]/>>>/; s/^\[\[/<</;' + done | $SED 's/^\[\[\[/<<</; s/^\]\]\]/>>>/; s/^\[\[/<</; s/^\]/>/;' } template::_line () { @@ -138,4 +138,6 @@ Just so that you know' echo bar >>>' assert::equals "$(template::_generate <<< "$template5")" "$expect5" + + assert::equals "$(template::_generate <<< ']')" '>' } |
