tridactyl/scripts/newtab.md.sh

35 lines
972 B
Bash
Raw Normal View History

2017-11-10 13:03:08 +00:00
#!/bin/sh
# Combine newtab markdown and template
2019-03-24 17:29:42 +01:00
if ! cd src/static ; then
echo "Failed to cd in src/static. Aborting."
exit
fi
2017-11-27 17:01:45 +11:00
newtab="../../generated/static/newtab.html"
2018-04-19 12:16:34 +01:00
newtabtemp="../../generated/static/newtab.temp.html"
2017-11-27 17:01:45 +11:00
2018-04-19 12:16:34 +01:00
sed "/REPLACETHIS/,$ d" newtab.template.html > "$newtabtemp"
2019-05-31 16:48:53 +01:00
"$(yarn bin)/marked" newtab.md >> "$newtabtemp"
2018-04-19 12:16:34 +01:00
sed "1,/REPLACETHIS/ d" newtab.template.html >> "$newtabtemp"
# Why think when you can pattern match?
2019-03-24 17:29:42 +01:00
(
sed "/REPLACE_ME_WITH_THE_CHANGE_LOG_USING_SED/,$ d" "$newtabtemp"
# Note: If you're going to change this HTML, make sure you don't break the JS in src/newtab.ts
2019-03-24 17:29:42 +01:00
cat <<EOF
2018-04-19 12:16:34 +01:00
<input type="checkbox" id="spoilerbutton" />
<label for="spoilerbutton" onclick=""><div id="nagbar-changelog">New features!</div>Changelog</label>
<div id="changelog" class="spoiler">
2019-03-24 17:29:42 +01:00
EOF
2019-05-31 16:48:53 +01:00
"$(yarn bin)/marked" ../../CHANGELOG.md
2018-04-19 12:16:34 +01:00
echo """
</div>
2019-03-24 17:29:42 +01:00
"""
sed "1,/REPLACE_ME_WITH_THE_CHANGE_LOG_USING_SED/ d" "$newtabtemp"
) > "$newtab"
2018-04-19 12:16:34 +01:00
rm "$newtabtemp"