diff options
Diffstat (limited to '')
| -rwxr-xr-x | build.sh | 19 |
1 files changed, 16 insertions, 3 deletions
| @@ -16,8 +16,6 @@ recursivebuild() { | |||
| 16 | done | 16 | done |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | # This function is currently useless, but we keep it in case we need to | ||
| 20 | # preprocess some m4 files. | ||
| 21 | mdpreprocess() { | 19 | mdpreprocess() { |
| 22 | file="$1" | 20 | file="$1" |
| 23 | if [ "$(echo "$file" | sed 's/.*\.//')" = "m4" ]; then | 21 | if [ "$(echo "$file" | sed 's/.*\.//')" = "m4" ]; then |
| @@ -75,6 +73,17 @@ htmltitle() { | |||
| 75 | grep '<!--TITLE: ' "$1" | sed 's/^<!--TITLE: //' | sed 's/-->$//' | 73 | grep '<!--TITLE: ' "$1" | sed 's/^<!--TITLE: //' | sed 's/-->$//' |
| 76 | } | 74 | } |
| 77 | 75 | ||
| 76 | feedify() { | ||
| 77 | printf '\n<![CDATA[\n' | ||
| 78 | printf '<p><emph>Note: internal links to ' | ||
| 79 | printf '<a href="https://sebastiano.tronto.net">sebastiano.tronto.net</a> ' | ||
| 80 | printf 'may be broken in feed view. Read this page online or fix them ' | ||
| 81 | printf 'manually if you want to follow them.</emph></p>\n\n' | ||
| 82 | sed -n '/<main>/,/<\/main>/p; s/]]>/]]]]>\n<![CDATA[/g' "$1" \ | ||
| 83 | | head -n -2 | tail -n +3 | ||
| 84 | printf '\n]]>\n' | ||
| 85 | } | ||
| 86 | |||
| 78 | makeblogindexandfeed() { | 87 | makeblogindexandfeed() { |
| 79 | mkdir -p http/blog | 88 | mkdir -p http/blog |
| 80 | bf=http/blog/index.html | 89 | bf=http/blog/index.html |
| @@ -95,6 +104,9 @@ makeblogindexandfeed() { | |||
| 95 | d="$(echo "$i" | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}')" | 104 | d="$(echo "$i" | grep -oE '^[0-9]{4}-[0-9]{2}-[0-9]{2}')" |
| 96 | t="$(markdowntitle $f)" | 105 | t="$(markdowntitle $f)" |
| 97 | link="https://sebastiano.tronto.net/blog/$i" | 106 | link="https://sebastiano.tronto.net/blog/$i" |
| 107 | #cont="$(sed -n '/<main>/,/<\/main>/p' http/blog/$i/index.html |\ | ||
| 108 | #head -n -2 | tail -n +3)" | ||
| 109 | cont="$(feedify http/blog/$i/index.html)" | ||
| 98 | 110 | ||
| 99 | thisyear="$(echo "$d" | sed 's/-.*//')" | 111 | thisyear="$(echo "$d" | sed 's/-.*//')" |
| 100 | if [ "$thisyear" != "$lastyear" ]; then | 112 | if [ "$thisyear" != "$lastyear" ]; then |
| @@ -113,6 +125,7 @@ makeblogindexandfeed() { | |||
| 113 | echo "<link>$link</link>"; | 125 | echo "<link>$link</link>"; |
| 114 | echo "<guid isPermaLink=\"true\">$link</guid>"; | 126 | echo "<guid isPermaLink=\"true\">$link</guid>"; |
| 115 | echo "<description>$t</description>"; | 127 | echo "<description>$t</description>"; |
| 128 | echo "<content:encoded>$cont</content:encoded>"; | ||
| 116 | echo "<pubDate>$dd $mon $thisyear 00:00:00 GMT</pubDate>"; | 129 | echo "<pubDate>$dd $mon $thisyear 00:00:00 GMT</pubDate>"; |
| 117 | echo "</item>"; | 130 | echo "</item>"; |
| 118 | echo ""; } >> $ff | 131 | echo ""; } >> $ff |
| @@ -166,5 +179,5 @@ month() { | |||
| 166 | } | 179 | } |
| 167 | 180 | ||
| 168 | sed "s/LASTUPDATE/$(date +'%Y-%m-%d')/" <bottom.html >"$bottomtmp" | 181 | sed "s/LASTUPDATE/$(date +'%Y-%m-%d')/" <bottom.html >"$bottomtmp" |
| 169 | makeblogindexandfeed | ||
| 170 | recursivebuild src | 182 | recursivebuild src |
| 183 | makeblogindexandfeed | ||
