My last post contains an HTML table that is a modified version of the big table on the "Closing the Gap on Autism" page. Here, mainly for my own future reference, is how I generated the modified table. There are probably ways I could have done it smarter or quicker.
- Generate a sorted CSV file
- Select the table contents in Safari and copy-paste them to a Numbers spreadsheet.
- Sort on state, city, and ZIP, in that order. I was thrown off by the fact that Numbers doesn't have a menu item with the word "Sort" in it. I learned from the Help documentation that what I wanted was "Reorganize".
- Format the ZIP column to be five digits, padded on the left with zeros. Otherwise the leading zeros will be omitted when the file is exported.
- Export to a CSV file.
- Pipe the CSV file through
uniqto remove duplicate entries.
- Convert the CSV to an HTML table
- Clean up the HTML
- Paste the HTML into Sublime Text.
- Get rid of the spaces that the CSV Converter inserted before many of the closing ">" characters. This wasn't important; I just didn't like looking at the extra spaces.
- Replace tabs with spaces. I couldn't get find-and-replace to work with tabs, and was too lazy to try harder than I did.
- Use regex plus global find-and-replace to convert the store numbers into links to the Gap web site. Because there were sometimes two store numbers, I used two find-and-replace passes to generate the store links. I manually cleaned up one case where three store numbers were given.
- Use another regex find-and-replace to fix phone numbers with spaces in them.
- Use another find-and-replace to remove the extra spaces from "St ." and "Ave .".
- Replace "
&amp;" with an ampersand.
There are a whole bunch more punctuation fixes I could have made, but I decided not to bother. I allowed myself to fix one typo, and corrected "Loehmen"s" to "Loehman's".
I added a bit of CSS before posting to WordPress. You can tell I'm not a CSS expert — mainly I wanted to draw the borders.