diff options
author | Leah Rowe <info@minifree.org> | 2017-04-08 21:32:47 +0000 |
---|---|---|
committer | Gogs <gogitservice@gmail.com> | 2017-04-08 21:32:47 +0000 |
commit | cbd70f62fd0944e42d5281418f7a3f004eb73f2e (patch) | |
tree | e15e55902a321231b117452ff21283cb0a95aa32 | |
parent | 34eaf8660a011930bc1a46c93f2db69cf3c28a01 (diff) | |
parent | 8a509204473e2922e60c806e65e7829d0e2d2cde (diff) | |
download | librebootfr-cbd70f62fd0944e42d5281418f7a3f004eb73f2e.tar.gz librebootfr-cbd70f62fd0944e42d5281418f7a3f004eb73f2e.zip |
Merge branch 'blog/rss' of libreboot/libreboot into master
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | www/index.sh | 46 | ||||
-rw-r--r-- | www/news/index.md | 14 | ||||
-rwxr-xr-x | www/publish.sh | 17 |
4 files changed, 53 insertions, 25 deletions
@@ -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 index 9d0a9b28..c1eeb600 100755 --- 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/</\</g' | sed -e 's/>/\>/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 deleted file mode 100644 index 6d12ce7d..00000000 --- a/www/news/index.md +++ /dev/null @@ -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 index 4a580787..6f35fd93 100755 --- 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 |