libreboot

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit cbd70f62fd0944e42d5281418f7a3f004eb73f2e
parent 34eaf8660a011930bc1a46c93f2db69cf3c28a01
Author: Leah Rowe <info@minifree.org>
Date:   Sat,  8 Apr 2017 21:32:47 +0000

Merge branch 'blog/rss' of libreboot/libreboot into master

Diffstat:
.gitignore | 1+
www/index.sh | 46++++++++++++++++++++++++++++++++++++++++++++--
www/news/index.md | 14--------------
www/publish.sh | 17++++++++---------
4 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -42,3 +42,4 @@ tocheck* *.html !www/template.html /www/temp.md +/www/news/index.md diff --git a/www/index.sh b/www/index.sh @@ -15,10 +15,18 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +BLOGTITLE="Libreboot News" +BLOGBASE="https://libreboot.org/news/" +BLOGDESCRIPTION="News on Libreboot development" + +title() { + sed -n 1p $f | sed -e s-^..-- +} + meta() { URL=$(echo ${f%.md}.html | sed -e s-news/--) - echo "[$(sed -n 1p $f | sed -e s-^..--)]($URL){.title}" + echo "[$(title)]($URL){.title}" echo "[$(sed -n 3p $f | sed -e s-^..--)]{.date}" echo "" tail -n +5 $f | perl -p0e 's/(\.|\?|\!)( |\n)(.|\n)*/.../g' @@ -27,10 +35,44 @@ meta() { echo "" } +# generate the index file + +FILES=$(ls -1 -t news/*.md | sed -e s-.*index.md-- -e s-.*presentation.md--) + cat news-list.md > news/index.md -for f in $(ls -1 -t news/*.md | sed -e s-.*index.md-- -e s-.*presentation.md--) +for f in $FILES do touch -d "$(sed -n 3p $f | sed -e 's/^..//g')" $f meta >> news/index.md done + +# generate an RSS index + +rss() { + echo '<rss version="2.0">' + echo '<channel>' + + echo "<title>$BLOGTITLE</title>" + echo "<link>"$BLOGBASE"news/</link>" + echo "<description>$BLOGDESCRIPTION</description>" + + for f in $FILES + do + # render content and escape + desc=$(sed ${f%.md}.bare.html -e 's/</\&lt;/g' | sed -e 's/>/\&gt;/g') + url="${f%.md}.html" + + echo '<item>' + echo "<title>$(title)</title>" + echo "<link>$BLOGBASE$url</link>" + echo "<description>$desc</description>" + echo '</item>' + done + + echo '</channel>' + echo '</rss>' +} + +rss > news/feed.xml +cp news/feed.xml feed.xml diff --git a/www/news/index.md b/www/news/index.md @@ -1,14 +0,0 @@ -% News announcements from the Libreboot project - -Updates to libreboot, both technical and organisational, will be written about -here over time. - -------------------------------------------------------------------------------- - -[Open Letter to the Free Software Community](unity.html){.title} -[2 Apr 2017]{.date} - -To the free software community: - -Over the past six months, the Libreboot project has been in a state of discord... - diff --git a/www/publish.sh b/www/publish.sh @@ -24,6 +24,8 @@ FILE=${1%.md} cat $1 > temp.md +OPTS= + if [ "${FILE}" != "./index" ]; then if [[ $FILE == *index ]] then @@ -33,6 +35,7 @@ if [ "${FILE}" != "./index" ]; then fi RETURN="<a href='$DEST'>Back to previous index</a>" + OPTS="--css /headerleft.css -T Libreboot" fi echo "" >> temp.md @@ -48,13 +51,9 @@ TOC=$(grep -q "^x-toc-enable: true$" temp.md && echo "--toc --toc-depth=2") || T # work around heterogenous pandoc versions SMART=$(pandoc -v | grep -q '2\.0' || echo "--smart") || SMART="" - - -if [ "${FILE}" != "./index" ]; then - # chuck through pandoc - pandoc $TOC $SMART temp.md -s --css /global.css --css /headerleft.css -T Libreboot \ +# chuck through pandoc +pandoc $TOC $SMART temp.md -s --css /global.css $OPTS \ --template template.html --metadata return="$RETURN"> $FILE.html -else - pandoc $TOC $SMART temp.md -s --css /global.css \ - --template template.html --metadata return="$RETURN"> $FILE.html -fi + +# additionally, produce bare file for RSS +pandoc $1 > $FILE.bare.html