psx-spx.github.io/conversion/run.sh

19 lines
790 B
Bash
Raw Normal View History

2020-07-23 18:51:52 +02:00
#!/bin/sh
# Download and slightly adjust the input file.
# There's one occurence where there's a newline missing, which throws our awk script off.
# Might as well fix it here rather than making the awk script more complex.
curl https://problemkaputt.de/psx-spx.htm |
dos2unix |
sed 's|</FONT></TD></TR></TABLE><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><PRE>|</FONT></TD></TR></TABLE>\n<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><PRE>|' > psx-spx.html
# Run the awk script to generate all of the .md files, as well as the second pass scripts.
gawk -f psx-spx-pass1.awk psx-spx.html
# Invoke the second pass generated by the first pass script, to adjust all the cross references.
. ./run-pass2.sh
# Cleanup
rm psx-spx.html run-pass2.sh psx-spx-pass2.sed
mv *.md ..