Stop hand coding, start Zen Coding
whiletruecode.com
whiletruecode.com
I am hand coding HTML in nXML mode in emacs. I'm also hand coding various templating languages/libraries which generate HTML. Nothing's wrong.
What the OP is doing wrong is writing bad titles for posts about an otherwise decent tool, Zen Coding. Better to skip the post and just read about Zen Coding directly: http://code.google.com/p/zen-coding/
Idiotic headlines are not.
There are hundreds of reasons to hand-code HTML, and this article addresses why one of them is inefficient.
I'm a great fan of zen, specially for CSS, but every editor has had autocomplete/expansion for years, and it ends up being nearly the same speed (t+tab, tr+tab, td+tab, cmd+alt+d x5) once you internalize it. I even ended up removing it from ST2 since it conflicts with default shortcuts. CSS is a whole different story, I haven't seen any editor with expansions as complete as Zen.
Table-based layouts is the only practical option for HTML emails, which is exactly what these guys were doing.
> writing an XSLT stylesheet to transform an in-memory representation of a customer's bill into an HTML version for display on our site.
If you decide to counter-preach, it helps to read the article and understand it first.
It has been argued here before that HTML is nothing more than "assembly" for the browser, and if it renders properly, why does it matter if the layout is done via nested tables or CSS?
The original problem with tables was using them together with spacers to create layout, not much other uses.
There's no inherent problem with tables, it is perfect for tabular layout. Data grids are tabular, most forms are tabular.
Tables are ok; table-based layouts are not. Anyway, I was just getting back at the author for mocking the gist of my current profession - upon seeing the headline I thought he was promoting the use of WYSIWYG tools or something.
I'd rather type a few closing tags myself, and use copy-paste to duplicate a bunch of lines. I really don't see how that is going to take longer in the end.
div>ul>li*5
Needs the class "active"? While this may seem simple, I feel a tool like this should be able to handle something extremely simple. What it looks like is I have to write an entire conditional.
There is something to handwritten code that (to me) will always seem more beautiful than machine generated code.
Over the past year I've spent about 4 weeks just thinking about how to construct the data structure I need to solve one hairy problem or another. I've spend maybe a day writing html over the entire fucking year.
Don't optimize the easy parts.
I don't see any problem hand-writing HTML at all, in-fact you get to a point in your development career when you can type sufficiently fast enough to beat out even some of the best auto completion functionality an IDE or third-party library/plugin can offer. Zen Coding definitely has its uses, but I don't really remember the last time I had to hand-write much HTML at all anyway. I use the HTML5 boilerplate as a basis for my projects, if using Wordpress I use a barebones Wordpress theme or if I am developing a HTML newsletter I'll use the HTML email boilerplate.
But if you know what you're doing, and you know why exactly you need a table here to do this particular thing (which should not be your entire web page due to maintenance issues), then go ahead and use a table. Like for emails it's pretty much a necessity (along with style attributes, sigh).
For this nested table example, it's great. Another multiple instance example. There's probably no easier way to pump out that code so fast, but if it were a standard table, anything will do, even the hated (by most on here) WYSIWYGs, that could drop a customized table in a few clicks.
A more significant part of the time spent creating a webpage is wasted on CSS (or in javascript but I don't put it in the same boat). So if you have to optimise your process it's more efficient to learn something that will improve your css workflow (Sass, Compass, Less) than to add a layer above your html code.
If it works, don't fix it.
html:5>(div.header>ul.nav>li>a[href="javascript:"]#menu$*6)
It's a complete HTML template in a one-liner... <!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div class="header">
<ul class="nav">
<li>
<a href="javascript:" id="menu1"></a>
<a href="javascript:" id="menu2"></a>
<a href="javascript:" id="menu3"></a>
<a href="javascript:" id="menu4"></a>
<a href="javascript:" id="menu5"></a>
<a href="javascript:" id="menu6"></a>
</li>
</ul>
</div>
</body>
</html>(I'm only kidding around...sorta.)
It's not. Though your thought process might be.
Get some self esteem so you don't need to author posts insulting strangers.
Who actually spends the majority of their time editing html?