10 USAGE
="Usage: $(basename "$0") VERSION TAG DIST RELEASE_DATE"
12 [ $# -eq 4 ] || error
"$USAGE"
17 export RELEASE_DATE
="$4"
19 MARKDOWN_TMPFILE
=$
(mktemp
/tmp
/tor-blog-post-XXXXXX.md
)
23 MARKDOWN_SOURCE
="wiki/src/news/version_${VERSION:?}.mdwn"
26 MARKDOWN_SOURCE
="wiki/src/news/test_${TAG:?}.mdwn"
29 error
"Unsupported DIST: '${DIST}'\n${USAGE}"
34 ikiwiki
--setup ikiwiki.setup \
36 --render "$MARKDOWN_SOURCE" |
38 --mute MISSING_ENDTAG_BEFORE
,INSERTING_TAG
,DISCARDING_UNEXPECTED
,UNKNOWN_ENTITY
,MISSING_ATTRIBUTE
,TRIM_EMPTY_ELEMENT
,STRING_CONTENT_LOOKS \
40 sed '0,/^<section id="content" role="main">$/d' |
41 sed '/^<footer id="footer" class="pagefooter" role="contentinfo">$/,$d' |
42 sed '/^<div class="toc">$/,+7d' |
43 sed '/^<p><img [^<>]*\/><\/p>$/d' |
44 sed '/^<div[^<>]*\>/d' |
46 sed 's@<img [^<>]*/>@@g' |
47 sed 's@<a name[^<>]*></a>@@g' |
48 sed 's@href="\.\./@href="https://tails.net/@g' |
49 sed 's@src="\./@src="https://tails.net/news/@g' |
50 sed 's@\(\.en\)\?.html@/@g' |
51 perl
-pE 'BEGIN{undef $/;}s{<nav class="language-switcher">.*?<\/nav>}{}smg'
53 echo '<h1>Support and feedback</h1>'
54 echo '<p>For support and feedback, visit the <a href="https://tails.net/support/">Support section</a> on the Tails website.</p>'
57 BODY
=$
(html_body | html2markdown | perl
-pE 's{^[#]}{##}') j2
--import-env '' \
58 config
/release_management
/templates
/Tor_blog_post.md.jinja \
61 echo "Done! The draft Tor blog post was written to $MARKDOWN_TMPFILE"