20251130093917 push
This commit is contained in:
8
blog.sh
8
blog.sh
@@ -46,7 +46,7 @@ build_pages() {
|
||||
# fi
|
||||
# done
|
||||
#}
|
||||
build_feeds() {
|
||||
build_feed() {
|
||||
local BLOG_INDEX="$BLOG_DIR/index.html"
|
||||
local OUTPUT_FILE="$OUTPUT_DIR/index.xml"
|
||||
printf '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' > "$OUTPUT_FILE"
|
||||
@@ -61,7 +61,7 @@ build_feeds() {
|
||||
local POST_FILE="$CONTENT_DIR$POST_URL"
|
||||
local POST_TITLE="$(grep "class=\"title\"" "$POST_FILE" | head -n 1 | sed 's!^[^>]*>!!' | sed 's!<.*$!!')"
|
||||
local POST_DATE="$(date -d "$(grep "class=\"date\"" "$POST_FILE" | head -n 1 | sed 's!^[^>]*>!!' | sed 's!<.*$!!')" '+%a, %d %b %Y %H:%M:%S %Z')"
|
||||
local POST_CONTENT="$(tail -n +6 "$POST_FILE" | head -n -1)"
|
||||
local POST_CONTENT="$(tail -n +6 "$POST_FILE" | head -n -1 | sed 's/^\t//g')"
|
||||
printf '<item><author>%s</author>' "$AUTHOR" >> "$OUTPUT_FILE"
|
||||
printf '<pubDate>%s</pubDate>' "$POST_DATE" >> "$OUTPUT_FILE"
|
||||
printf '<title>%s</title>' "$POST_TITLE" >> "$OUTPUT_FILE"
|
||||
@@ -71,13 +71,13 @@ build_feeds() {
|
||||
printf '%s</link>' "$POST_URL" >> "$OUTPUT_FILE"
|
||||
printf '<description><![CDATA[\n' >> "$OUTPUT_FILE"
|
||||
printf '%s' "$POST_CONTENT" >> "$OUTPUT_FILE"
|
||||
printf '\n]]></description></item>\n' >> "$OUTPUT_FILE"
|
||||
printf ']]></description></item>\n' >> "$OUTPUT_FILE"
|
||||
done
|
||||
printf '</channel></rss>\n' >> "$OUTPUT_FILE"
|
||||
}
|
||||
case "$1" in
|
||||
build)
|
||||
build_pages
|
||||
build_feeds
|
||||
build_feed
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user