aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/func10
-rwxr-xr-xbin/rssg8
2 files changed, 12 insertions, 6 deletions
diff --git a/bin/func b/bin/func
index 97688f5..bea9dea 100644
--- a/bin/func
+++ b/bin/func
@@ -145,6 +145,10 @@ __lowdown() {
lowdown --html-no-skiphtml --html-no-escapehtml "${1}"
}
+__generate_rss_body() {
+ lowdown -tgemini "${1}" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'
+}
+
__apply_template() {
# 1: template name or default
m4 "templates/${1:-default}"
@@ -223,14 +227,14 @@ __handle_md() {
__generate_metadata "${1}" > "${tmp_file}.metadata"
- if [ ! "$(__get_value ${1} index)" = "" ]; then
+ if [ ! "$(__get_value "${1}" index)" = "" ]; then
__generate_index "${1}" > "${tmp_file}.index"
else
[ -f "${tmp_file}.index" ] && rm "${tmp_file}.index"
fi
- __apply_template "$(__get_value ${1} template)" > "${tmp_file}"
- __install "${tmp_file}" "$(__get_out_filename ${1})"
+ __apply_template "$(__get_value "${1}" template)" > "${tmp_file}"
+ __install "${tmp_file}" "$(__get_out_filename "${1}")"
}
__handle() {
diff --git a/bin/rssg b/bin/rssg
index d42ff14..02e6b54 100755
--- a/bin/rssg
+++ b/bin/rssg
@@ -27,11 +27,12 @@ EOF
for file in $(__list_files_date "${rss_dir}"); do
title=$(__get_value_title "${file}")
date=$(__get_value_date_publication "${file}")
- link="${website_link}/$(__get_final_filename ${file})"
+ link="${website_link}/$(__get_final_filename "${file}")"
+ description=$(__generate_rss_body "${file}")
if [ "${uname}" = "Linux" ]; then
- guid="$(echo ${link} | sha256sum | cut -d ' ' -f 1)"
+ guid="$(echo "${link}" | sha256sum | cut -d ' ' -f 1)"
else
- guid="$(echo ${link} | sha256)"
+ guid="$(echo "${link}" | sha256)"
fi
cat <<-EOF >> "${rss_out_file}"
@@ -40,6 +41,7 @@ for file in $(__list_files_date "${rss_dir}"); do
<link>${link}</link>
<pubDate>${date}</pubDate>
<guid>${guid}</guid>
+ <description>${description}</description>
</item>
EOF
done
remember that computers suck.