The itch: better formatted METAR and TAF in my phone browser. The scratch: a script to get weathers and format a web page that displays acceptably in my phone browser.
Script:
- curl: collect useful weather from Aviation Digital Data Service (ADDS) and save to file.
- grep: remove a couple of unwanted lines.
- pipe to:
- sed: edit the saved file to remove HTML tags and excess spaces, add some markdown formatting, then add two spaces at EOL ready for processing as Markdown. Save to file. I use a basic
/bin/sed -e 's/<[^>]*>//g'
to remove html tags. - pandoc: input the saved file as markdown format and output HTML. Lots to learn! I added meta-data and edited the default.html5 to ensure no relevant errors or warnings from the w3.org html validator. The validator does not always correctly identify the page language: not German!
/usr/bin/pandoc [file] -f markdown_strict -t html5 -s -V title="neil on the web" -M author="ADDS Results" -M title="ADDS Results" -M lang="en" --title-prefix="neilt.org" --css="/css/neiltorg.css" -o ~/public_html/WeatherGR.html
. I got thedefault.html5
template file with:pandoc -D html5 > default.html5
, made the directorymkdir -p .pandoc/templates
and moved filemv default.html5 .pandoc/templates/default.html5
.
This script is specific to this task! A cronjob runs the script regularly.
There are, no doubt, more elegant ways to do this, but it works. I intend to do a little more processing on the HTML if I get the time. I may revisit a similar old script that was VHHH specific.
I took a short but significant holiday in the busy, vibrant, thankfully warmer than UK, Hong Kong.