News

Loading...

Wednesday, August 17, 2011

Back in the Day...

I used to write a lot of HTML "code." (Real code is assembler. C is a high-level scripting language.) A lot of the beauty of it was its simplicity.

Not no more. Have you ever looked at the code automatically "generated" by Blogger or MS Word? ("Generated" is in quotes because it resembles an abortion more than a birth.) Here is the luger I found blogger spitting out recently -- notice that it is creating this mess despite the fact that there is no text of mine in these "spans"!

UPDATE: Had to pull out the angle brackets to get the code to show up!

span class="Apple-style-span" style="font-family: Helvetica, Arial, sans-serif; font-size: 13px;" span

div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 13px; font-style: inherit; font-weight: inherit; line-height: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"

span class="Apple-style-span" style="font-family: Helvetica, Arial, sans-serif; font-size: 13px;"span class="Apple-style-span" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 15px; font-style: inherit; font-weight: inherit; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"

div style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 13px; font-style: inherit; font-weight: inherit; line-height: inherit; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"

span class="Apple-style-span" style="font-family: Helvetica, Arial, sans-serif; font-size: 13px;"span class="Apple-style-span" style="border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: inherit; font-size: 15px; font-style: inherit; font-weight: inherit; line-height: 20px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: initial; outline-width: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"

14 comments:

  1. I don't see any code in your blog entry here. I am not a fan of auto-generated code. I think you'll like this article on this topic that I recently came across:

    http://www.joelonsoftware.com/articles/LeakyAbstractions.html

    ReplyDelete
  2. Thanks, Larry. Fixed.

    ReplyDelete
  3. Larry, that's a good article, but it doesn't seem to be about auto-generated code!

    ReplyDelete
  4. Blogger did that? That is the worst case of div/span abuse that I've laid eyes on. This is what CSS class definitions are for.

    ReplyDelete
  5. Blogger did that? That is the worst case of div/span abuse that I've laid eyes on. Use a CSS class for that kind of detail.

    ReplyDelete
  6. Yes. I would never had known if I hadn't switched into "Edit HTML" mode.

    ReplyDelete
  7. I'm just surprised Google would be guilty of turning out such atrocious code—especially since a lot of those are superfluous (they just specify that the browser should use what is already the default value).

    ReplyDelete
  8. Believe me. PSH, I didn't type in all that nonsense by hand!

    Have you noticed that Blogger does stretches of highlighting all wrong?

    If what you want is:

    \Par. 1

    Par. 2

    Par. 3
    \


    What you get is:

    \Par. 1
    \


    \Par. 2
    \


    \Par. 3
    \


    And how about the fact that, when you sign up to receive future comments, they send you your own!

    ReplyDelete
  9. It's for precisely that reason that I generally use the "Edit HTML" mode from the get-go for posts on Blogger. The "Visual" mode always seems to produce about five times as much markup as is really necessary to accomplish any particular thing.

    ReplyDelete
  10. WYSIWIG saves time and blogspot decides these things. Don't much care for the template, though. The old layout had a certain charm but this is a bit raw. And a Chinese Red border is visually distracting. Best, Fritz Wagner

    ReplyDelete
  11. "WYSIWIG saves time and blogspot decides these things."

    Yes, I know. My point was it was deciding them badly!

    "Don't much care for the template, though."

    Your wish is my command.

    ReplyDelete
  12. Tom, I used to use "Edit HTML" all the time, too. Do you know what got to me about that? I'd be in the middle of typing a tag when it would decide to autosave. Then this error would flash up telling me I had no close tag! Of course not, I'm in the middle of typing the friggin' tag!

    I did not see anyway to turn that "help" off, but perhaps I missed it? (If only I had apprenticed with Silas!)

    ReplyDelete
  13. I first write both the opening tag and the closing tag, and then fill in the content. That way the auto-save feature does not pester me—provided I'm fast enough. It's a speed game.

    Anyone know why the comments feature in Blogger accepts em tags but not cite tags? Reformers seem dead set on phasing out all "presentational" elements, which would seem to spell doom for the i tag. But that means we need some other way of italicizing titles.

    ReplyDelete
  14. "I first write both the opening tag and the closing tag, and then fill in the content. That way the auto-save feature does not pester me—provided I'm fast enough. It's a speed game."

    That's what I was doing. And I'd had enough of it!

    ReplyDelete