printf"What's the link to the blog post? This needs to be a path from the path to the RSS feed to the HTML post. Example: '/articles/my-post.php'.\n> "
read -r LINK
[ -z "$LINK"]&&printf"You must specify a link to the blog post.\n"&& readlink "$@"||return0
}
readguid(){
printf"What's the GUID (unique identifier) of the blog post? Example: '%s'. Enter 'link' to use '%s'.\n> ""$LINK""$LINK"
read -r GUID
[ -z "$GUID"]&&printf"You must specify a GUID for the blog post.\n"&& readguid "$@"
[ -z "$DESC"]&&printf"You must specify a description for the blog post.\n"&& readdesc "$@"
[ -e "$DESC"]&&PT=false||PT=true
return0
}
readq(){
[ -z "$NAME"]&& readname "$@"
[ -z "$DATE"]&& readdate "$@"
[ -z "$LINK"]&& readlink "$@"
[ -z "$GUID"]&& readguid "$@"
[ -z "$DESC"]&& readdesc "$@"
}
mk(){
["$PT" !="true"]&&DESC="$(cat "$DESC")"
sed "s|mkrsspost_title|$NAME|g; \
s|mkrsspost_link|$LINK|g;\
s|mkrsspost_guid|$GUID|g;\
s|mkrsspost_date|$DATE|g;\
s|mkrsspost_description|$DESC|g" \
/tmp/mkrsspost_template > $NAME-generated.rss.xml && print "Generated '$NAME-generated.rss.xml'."|| die "Failed to generate item."
return0
}
init(){
setvars
[ -e "$rssdir/$templatename"]&& cp "$rssdir/$templatename""/tmp/mkrsspost_template"|| die "Template doesn't exist. Edit the script to fix this or export \$rssdir, \$realrssdir, \$realrss, \$templatename."