commit 64a60a25019d0ee71b1fe597f47d607eeb8f53b9
parent 9799afd74809670bc7284bb8343200017480f7e1
Author: St John Karp <contact@stjo.hn>
Date: Sat, 20 Jun 2020 21:08:45 -0500
Remove some unnecessary logic from the RSS block
Removed some logic that's not necessary when using the correct
command arguments.
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/squeeze.sh b/squeeze.sh
@@ -37,14 +37,12 @@ find "$SOURCE_PATH" -type f -name "*.md" |
mkdir -p "$OUTPUT_PATH/feeds"
# Grep the date of each article.
ARTICLES=$(grep --recursive --include=\*.md "^Date: " "$SOURCE_PATH" |
- # Reformat the output so the date comes first, then the file name.
- sed --quiet --regexp-extended 's/^([^:]+):(.+)$/\2\t\1/p' |
- # Sort articles by date.
- sort |
- # Reformat to just the file names.
- cut --fields=2 |
+ # Sort articles by date (skipping the first field).
+ sort +1 |
# Get the last (i.e. most recent) posts for the RSS feed.
tail -5 |
+ # Reformat to just the file names.
+ cut --fields=1 --delimiter=: |
# Convert paths so we operate on the generated HTML, not the unformatted Markdown.
sed "s|^$SOURCE_PATH|$OUTPUT_PATH|" |
sed 's|.md$|.html|' |