Evil code won’t defeat me!

scan of a page of code

I’ve always known that Microsoft Word is capable of vile acts. Years spent wrestling with recalcitrant section breaks, vanishing headers and footers, or missing chunks of text — or whole documents — have fostered a fraught relationship. Paired with HTML code, Word can really wreak havoc. But I’m a stubborn git, so I’ve generally won.

Now that I’m drafting content for this blog in Word, the struggle has taken on renewed intensity.

Years ago, peering over a developer colleague’s shoulder, I learned enough about web code to pick my way through basic HTML. It helped that he was a natural teacher who patiently answered dumb questions.

When the Fluffster offspring was in French middle school, armed with that basic knowledge, I blithely volunteered to maintain his (mostly English-language) school website. I had no idea what I was up against. Months of late-night head-scratching trial and error later, I'd ported the site over from Microsoft FrontPage to Dreamweaver and edited content written by French-speaking parents. Editing took very little time. Code clean-up ate my weekends and evenings.

The endeavour was deeply satisfying. Of course, no sooner had I finished than the Fluffster offspring graduated and the site was abandoned to the next hapless volunteer. I vowed never to look at it again.

I thought that would be my last hands-on HTML experience, but 16 years later, I'm still cleaning up cluttered code.

I’d almost forgotten what that looks like. When I started, I obliviously cut and pasted content from Word to Blogger's Compose view. If something didn’t behave, I just deleted and recreated it. I should have known better.

I can’t remember now what made me look under the hood, but when I did, I suddenly heard my developer colleague’s voice in my head: “Clean up that code and it'll get a lot easier!”

Sadly, I’d already put up 16 posts, so it took several weeks to clean up the mess. Cleanup consisted of deleting reams of junk code that Microsoft Word kindly deposits into anything you copy and paste and then checking to make sure nothing on the page changed.

The screenshot above shows one such code ream. I found several, plus smaller instances of surplus code on almost every line. In fact, there was more junk code than content. Deleting it wholesale changed absolutely nothing. However, it’s like cleaning out a utensil drawer that also holds random plastic forks, elastic bands, bottle tops, corks, etc.; if you have to find that spatula quickly, it won’t be concealed by the other rubbish.

I'll keep using Word to draft entries because I’m a creature of habit (ok, maybe a bit of a masochist). Then I'll strip out formatting in TextEdit and rebuild from scratch in Blogger. It doubles the time it takes, but there’s satisfaction in doing it right. I have all the time in the world now, after all. And it’ll silence my former colleague's voice in my head.

wineglasses icon

Created by Eliricon from Noun Project

No comments:

Post a Comment