This commit is contained in:
Yann Esposito (Yogsototh) 2019-09-25 12:11:24 +02:00
parent db10d72dea
commit e229deb765
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
2 changed files with 27 additions and 7 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh #!/usr/bin/env nix-shell
#!nix-shell -i zsh
rsstpl="rss.tpl" rsstpl="rss.tpl"
webdir="_site" webdir="_site"
@ -12,6 +13,10 @@ finddate(){
local fic="$1" local fic="$1"
grep 'article-date' < $fic | perl -pe 's#.*<span class="article-date">([^<]*)</span>.*#$1#'|egrep '[0-9]+-[0-9]+-[0-9]+' grep 'article-date' < $fic | perl -pe 's#.*<span class="article-date">([^<]*)</span>.*#$1#'|egrep '[0-9]+-[0-9]+-[0-9]+'
} }
findtitle(){
local fic="$1"
grep '<h1>' < $fic | perl -pe 's#.*<h1>([^<]*)</h1>.*#$1#'
}
getcontent(){ getcontent(){
local fic="$1" local fic="$1"
cat $fic | perl -pe 's#.*<(link|meta).*$##;s#<(img|input) ([^>]*[^/])>#<img $1/>#g' | hxselect '#content' cat $fic | perl -pe 's#.*<(link|meta).*$##;s#<(img|input) ([^>]*[^/])>#<img $1/>#g' | hxselect '#content'
@ -20,11 +25,25 @@ getcontent(){
realname="Yann Esposito" realname="Yann Esposito"
website="https://her.esy.fun" website="https://her.esy.fun"
autoload -U colors && colors
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
for fic in $webdir/posts/**/*.html; do for fic in $webdir/posts/**/*.html; do
rssdate=$(formatdate $(finddate $fic)) printf "%-40s" "$fic"
d=$(finddate $fic)
echo -n " [$d]"
rssdate=$(formatdate $d)
title=$(findtitle $fic)
printf ": %-30s" "$title"
blogfile="$(echo $fic | perl -pe 's#.*?/posts/#/posts/#')" blogfile="$(echo $fic | perl -pe 's#.*?/posts/#/posts/#')"
printf "\\n<item>\\n<title>%s</title>\\n<guid>%s%s</guid>\\n<pubDate>%s</pubDate>\\n<description><![CDATA[\\n%s\\n]]></description>\\n</item>\\n\\n" "$realname" "$website" "$blogfile" "$rssdate" "$(getcontent "$fic")" >> "$tmpdir/rss" printf "\\n<item>\\n<title>%s</title>\\n<guid>%s%s</guid>\\n<pubDate>%s</pubDate>\\n<description><![CDATA[\\n%s\\n]]></description>\\n</item>\\n\\n" "$title" "$website" "$blogfile" "$rssdate" "$(getcontent "$fic")" >> "$tmpdir/${d}-$(basename $fic).rss"
echo " [${fg[green]}OK${reset_color}]"
done
for fic in $(ls $tmpdir/*.rss | sort -r); do
# echo $fic
cat $fic >> $tmpdir/rss
done done
sed "/<!-- LB -->/r $tmpdir/rss" "$rsstpl" > "$rssfile" sed "/<!-- LB -->/r $tmpdir/rss" "$rsstpl" > "$rssfile"
rm -rf $tmpdir
echo "RSS Generated"

View file

@ -22,15 +22,16 @@ how you consume Internet for the best.
+ Control real-time interactions + Control real-time interactions
#+end_notes #+end_notes
The way I and most people use Internet as changed drastically in a few years. The way we use Internet as changed drastically in a few years.
It started with social networks and smartphones. It started with social networks and smartphones.
More recently, applications started to introduce "features" targeting our More recently, applications started to introduce "features" targeting our
"lower brain" or "social brain". "lower brain" or "social brain".
It is not unusual to stay a lot longer on our smartphone than what we It is not unusual to stay a lot longer on our smartphone than what we
expected. expected.
Since the introduction of those methods, more and more people experience Those changes start to influence our life balance.
difficulties to balance their life, to focus a long time on some subject,
and even might feel a lot more social anxieties. Focus on long time on some subject, and even might feel a lot more social
anxieties.
One solution is of course to totally get rid of those platforms. One solution is of course to totally get rid of those platforms.
But it would mean throw away all the benefit they provide. But it would mean throw away all the benefit they provide.