tridactyl/scripts/newtab.md.sh

30 lines
940 B
Bash
Raw Normal View History

2017-11-10 13:03:08 +00:00
#!/bin/sh
# Combine newtab markdown and template
cd src/static
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"
$(npm 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?
sed "/REPLACE_ME_WITH_THE_CHANGE_LOG_USING_SED/,$ d" "$newtabtemp" > "$newtab"
# Note: If you're going to change this HTML, make sure you don't break the JS in src/newtab.ts
2018-04-19 12:16:34 +01:00
echo """
<input type="checkbox" id="spoilerbutton" />
<label for="spoilerbutton" onclick=""><div id="nagbar-changelog">New features!</div>Changelog</label>
<div id="changelog" class="spoiler">
2018-04-19 12:16:34 +01:00
""" >> "$newtab"
$(npm bin)/marked ../../CHANGELOG.md >> "$newtab"
2018-04-19 12:16:34 +01:00
echo """
</div>
""" >> "$newtab"
sed "1,/REPLACE_ME_WITH_THE_CHANGE_LOG_USING_SED/ d" "$newtabtemp" >> "$newtab"
rm "$newtabtemp"