Finally – I Am Useful
Today was a great day at work. Instead of putzing around, I got my hands dirty and dug into BBEdit. Justin showed me around one of the talk radio stations (which we’ll need to manually edit). Essentially, we’re going to create Dreamweaver templates for the station webmasters. But – we’re going to strip out a lot of the existing code, throwing out the dynamic links, and just grab the raw data. In essence, we’ll create two versions – a copy of the existing page and a templated version for them to use in the future.
This is still a temporary fix (for the next few months), before Justin gets a larger, sophisticated content management app up and running. But since we’re losing a lot of dynamic data (feeds and whatnot), we need to get this shit converted rather quickly.
Today, I worked on create an applescript that will run a series of "scrubbing" patterns. Justin was still working out some of the bugs on the computer, and could only give me a few tools to work with. For example – I had a copy of an earlier applescript he had written, but we were unable to get access to a dictionary (which listed what commands applescript used to access other programs).
But enough of that. Here’s the thing I’m proud of:
[ \t]*(<[/]?table[^>]*>|<[/]?tr[^>]*>|<[/]?td[^>]*>)
My first GREP pattern. *sniff* A bit verbose, but I think it works. I’m telling BBEdit to look for any <table>, <tr> or <td> tags (and also any of their equivalent closing tags). With a search and replace, I’ll replace them with nothing – and this should strip out any table references in a page. Regular patterns are, the more I work with them, immensely powerful. Before long, I should be able to have a bunch of scripts that will go through an HTML document, look for specific tags, and cut/copy/paste and format according to my wishes. I’m still going through a lot of trial and error, but it’s really, really fun. :)
And just so I don’t get a big head, here’s Justin’s take on the code (which he had done before me):
[ \t]*</?table[^>]*>|[ \t]*</?t[rd][^>]*>
Notice his is slightly more efficient, as he was able to use t[rd] to combine a search for a <tr> and <td> tag. Sneaky!
This Post Has 0 Comments