dcsimg

Don’t Make Me Write HTML

No one likes writing -- or reading -- HTML. Thankfully there are tools like Markdown, HAML and SaSS to make your hypertext life easier.

I hate writing HTML. Wait. Let me rephrase that. I hate writing and reading HTML.

Compared to Ruby, Perl, and even SQL code, HTML is just so… verbose. Crafting open and close tags is taxing; nesting is error prone; and it’s difficult to simply glance at HTML to grok its purpose. CSS is even worse. Because a stylesheet is a long, flat, unstructured list, it’s nigh impossible to discern those cumulative rules that apply to nested elements. A good editor helps, but syntax coloring is often just a shiny veneer.

And many concur with my distaste for HTML. Alternatives, such as Textile and Markdown—aptly named since it’s intended to be the opposite of markup—provide author-friendly shorthand that is programatically promoted into full-blown HTML. For example, the Markdown snippet…

Ordered lists use numbers followed by periods:

    1.  Bird
    2.  McHale
    3.  Parish

… produces the HTML…

<p>
  Ordered lists use numbers followed by periods:
  </p>
<ol>
  <li>Bird</li>
  <li>McHale</li>
  <li>Parish</li>
  </ol>

Markdown is very natural to write—it resembles text you might put in an email, say— and thus very easy to read, too. It’s no wonder that many content management systems, blogs, and wikis support simplified markup of Markdown’s ilk.

Ideally, Markdown would replace weighty, tagged text in my applications, but it wasn’t designed to be a wholesale replacement for HTML and provides no relief for CSS. Yet, the notion is very appealing: Keep (or add) structure, lose the infernal typing.

And that’s the exact charter of HAML and companion SaSS. HAML (short for XHTML Abstraction Markup Language) expresses HTML in an outline form, while SaSS (an acronym for Syntactically Awesome StyleSheets) does the same for CSS. Both provide conveniences such as macros and expressions, and structure is implied with active white space (a la Python). You can also embed code in outline form: no blocks required.

I use HAML and SaSS with Rails, but implementations of HAML are available for Merb, PHP 5, Python, and .NET. And if your programming language does not yet support HAML or SaSS, have no fear! There are command-line utilities to convert the minimalist templates into HTML and CSS. There’s also a pair of utilities to reduce HTML and CSS to HAML and SaSS, respectively.

I eschew other templating forms in favor of HAML. It makes me very productive, even happy to craft Web pages and forms. Let’s take a look.

Less Code, More Joy

At left is HAML; at right is the equivalent HTML generated with the haml command-line utility.

!!! XML
!!!
%html
  %head
    %title
      Example
  %body
    %h1 You can place text on this line
    %p#vip.prose
      Or you can put more lengthy text
      here as content.

<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD
  XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/...">
<html>
  <head>
    <title>
      Example
    </title>
  </head>
  <body>
    <div id='main'>
      <h1>You can place text on this line</h1>
      <p class='prose' id='vip'>
        Or you can put more
        lengthy text here as content.
      </p>
    </div>
  </body>
</html>

HAML is concise and its syntax is simple. For instance:

  • To use an element, preface its tag with %, such as %head and %p.
  • You can assign an ID to an element with the clause #your_id. You can assign one or more classes to an element with a set of .your_class clauses. You can also combine the two kinds of clauses.
  • If the element is a div, you can omit %div and it is inferred.
  • To nest an element or place content within an element, simply indent two spaces. For convenience, you can also place content on the same line as the element, if the text is short.

This first example does not demonstrate all the syntax available. You can find the complete HAML reference online.

HAML is full of other tricks, too. If you like Markdown, you can embed it in HAML. A filter expands the Markdown in place. This snippet…

%div
  :markdown
    Example 2
    =======

    Hello, *World*

… produces:

<div>
  <h1>Example 2</h1>
  <p>Hello, <em>World</em></p>
</div>

In the HAML code, the keyword :markdown invokes the eponymous filter. A filter exists for JavaScript, Textile, SaSS, plain text, and Ruby code, among others.

And because all browsers aren’t equal, you can also insert Internet Explorer conditionals using /[condition].

/if[IE]
  %p
    Use the Firefox, Luke.

The slash (/) denotes a comment in HAML. You can use slash to comment a single line or an entire, indented section.

/ This is a single-line comment
/
  #footnote
    %p None of this will render since its part of the comment

Comments on "Don’t Make Me Write HTML"

Why visitors still make use of to read news papers when in this technological world all is existing on web?

Greetings from Colorado! I’m bored to death at work
so I decided to check out your blog on my iphone during lunch break.
I really like the information you provide here and
can’t wait to take a look when I get home. I’m shocked at how quick your blog loaded on my mobile ..
I’m not even using WIFI, just 3G .. Anyways, great blog!

This is very interesting, You are a very skilled blogger.
I’ve joined your feed and look forward to seeking more of your excellent post.
Also, I’ve shared your web site in my social networks!

I intended to write you the very small note to finally thank you
the moment again for the fantastic opinions you’ve shown here.
It’s simply extremely open-handed with people
like you to offer freely precisely what a lot of people would’ve sold for an e-book to help make
some money on their own, precisely considering that you could possibly have done it if you
ever desired. These concepts as well worked to be the great way to know that some people have the identical desire just as my own to
see a lot more in respect of this issue. I’m sure there are several more enjoyable opportunities up front for many who find out your website.

Hi there, just became alert to your blog through Google,
and found that it is really informative. I am gonna watch out for brussels.
I will appreciate if you continue this in future. Lots of people will
be benefited from your writing. Cheers!

Good article. I absolutely appreciate this website. Thanks!

I don’t even understand how I stopped up right here, but I believed this put
up was once great. I don’t understand who you are but definitely you’re going
to a well-known blogger in the event you aren’t already. Cheers!

wow, awesome blog post.

First of all, there’s nothing inappropriate havimg supportive to eat.

There arre many people tha dwell to consume and there are some exactly who try to eat to reside.
However the complete human race won’t are part of sometimes off the different types.
There are many exactly who appreciate beneficial foods, although their particular lives rely on the meals.
Nightclub meal Cheshire can be bellved in lots of parts of the country
as well as for anyoje who is a meaql lover, you need to ecpertise the
lvel of meals you receive the following. Vsit a family
bar Cheshire and you’ll take advantage of the ideal meal
along with products with all your entire family.
Absolutely nothing is drasticaslly wrong using adoring to eat.
There are some people who live to eat along with there are
a few exactly who take to call home. But the overall people won’t
fit iin with both of such classes. There are a few whom
love beneficial meals, although their particular lifestyles
depend on the meals. Tavern food Cheshire is actually cherished inn
most areas and for anyoje who iss some sort of food lover, you will need to encounter the kind of food you wil get the following.
Search for a family members nightclub Cheshire and you can experience the finest food in addition to refreshments using your overall spouse and children. Your message club is often related to
grown ups. The best bars in the united kingdom usually are
entertained byy activities buffss exactly wwho want to observe their competitors fight the ideaa out when they drink light beer and also lager
and so forth. Although it’s not necessarily essential that your kids are not able to go to thee
bar. Yes, there arre many discos which you may not choose to carry the kids to.
But lovedd ones bar Cheshire seriously isn’t among these establishments.
The padticular nightclub meal Cheshire witth this
bar is really great that will all people actually reaches take pleasure
in somehow or perhaps thee other. This family pub Cheshire provides the ideal throughout English food.
You’ll find some people expressing which Englsh foods seriously isn’t competitive with the
foodstuff that is cewrtainly organized within the other places like People from france and also The nation and the like.
In addition, your trend regarding Native american curries possesses additionally
altered the actual palette in the United kingdom foodies.
Although truth be told which United kingdom meals provides a
unique good taste. You eat common British isles meal
and also you can not assist yet practically coat the hands.
Of course, the item issues that this chief cook is great,
yet whenever you stop by the best place
with regard to pub food Cheshire, you may expect
the particular cocinero for being towards the top of his or her
preparing expertise. With this household puub Cheshire you
get almst everything you wish to cconsume in addition to beverage.
In the drinks portion you could have optimum cask beers, British isles
along with imported beer, cider and a comprehensive collection of wine drinks.
The food food selection can be extensive soo youu have the option tto select from the diber
food list, the 2-for-1 menus, this clubhouse food selecction along with the Wednesday food selection. This mouth-watering food tend to be sure to make you feel greater than happy.
In the event you would like getrting this particular tavern foodstuff Cheshire, visit the web site and
alo take a look at this food list. All the information that you might want will be granted inside site like tthe
quantity to be able to telephne to create your own booking.
With weekdays you could possibly reach this cafe and
locate a location, although while in weekends, it is foolhardy
trying to find a place without a booking. Whatever thhe case, it?s a good idea
to hellp hold upfront no matter what whenever you are.
Get more informatuon on the net to be ale to sample outstanding nightclub meals Cheshire.
With this loved ones nightclub Cheshire you will get thee many
food items that produce you delighted. The costs are well within your
budget, though the foodstuff is actually outside the entire world.

Feel free to visit my homepage – [bokep indo streaming](http://www.huolixiang.com/comment/html/index.php?page=1&id=7694 “bokep indo streaming”)

I was able to find good information from your articles.

Here are some hyperlinks to websites that we link to mainly because we feel they’re worth visiting.

Major thankies for the blog post.Really thank you! Keep writing.

I just want to tell you that I’m all new to blogging and site-building and actually enjoyed this web-site. Likely I’m likely to bookmark your site . You certainly come with perfect articles and reviews. Cheers for sharing your website page.

Hi there. I discovered your blog by means of Google at the same time as looking for a related subject, your website got here up. It appears good. I have bookmarked it in my google bookmarks to come back then.

Always a large fan of linking to bloggers that I enjoy but really don’t get a good deal of link like from.

I will right away seize your rss as I can not find your email subscription hyperlink or newsletter service. Do you’ve any? Kindly permit me know in order that I could subscribe. Thanks.

My web page … [kicklink.net](http://www.kicklink.net/members/rosettawinifre/ “kicklink.net”)

I just want to tell you that I am just newbie to blogging and actually savored your web-site. Probably I’m planning to bookmark your blog . You surely have wonderful posts. Thanks a bunch for sharing your web site.

Lawyer or attorney Victorianne Musonza, Lawyer At Laws, Licensed in NY And NC, Maxwell Law Office, PLLC is accepted to rehearse
rules in Rhode – Tropical isle and Massachusetts, so the Federal government Section Courts, which is a member of the Pub of the us Superior Court.
When working under GAAP, revenues and gains have completely separate definitions.

I decided to use their OIC service to lower my tax bill.

Here is my web page … [Charles Brandon Fort Lauderdale CPAs](https://rebelmouse.com/zacheryifz83/unanswered-questions-on-investment-advisor-kelowna-that-you-should-kno-1295917670.html “Charles Brandon Fort Lauderdale CPAs”)

The not? provided that all principal and accrued interest was due in a single
balloon p?yment at the end of the note term, and neithe? principal nor interest
could be prepaid. If you hav? received IRS ta?
notice, yo? need not to be panic. Itemized deducti?ns and ?ersonal exemptions do not affect self-employment taxe?.

Her? is m? weblog: [boca raton financial advisor jobs salary](https://Www.rebelmouse.com/jerilyncollee3/what-everybody-ought-to-know-about-daylight-savings-time-1327078276.html “boca raton financial advisor jobs salary”)

BCL’s C?A iin Bangalor? Enable Effective Running of A Business
opportunity Lender. See? for the full encouragement of th?e pe?ple around ?ou
soo that you’ll be motivated too fulfil?
yolur targets. One important asplect of the business to save money in order to avoid the accumu?ation of corporate debt.

My weblog [http://Ashton3621.Buzznet.Com/user/journal/27057055/pain-john-costello-cpa-boca](http://Ashton3621.Buzznet.com/user/journal/27057055/pain-john-costello-cpa-boca/ “http://Ashton3621.Buzznet.Com/user/journal/27057055/pain-john-costello-cpa-boca”)

It records all the transact?ons taking place in a c?m?any
so that y?u can always have a check on the loss?s if required and according t? gener?lly accepted accounting principles,
the basic framework of accounting should alway? include finance and accounting rec?rds.
Many people are making a lot ?f money promoting CPA
offers, but as usual, there is a lot of misinformation floating ?round.
You would possibly make an sum ?f cash similar to a consequence of
the ?egional group.

Here is my page – ?oca Raton CPAt test video ([Jeremy](http://like.Share2.net/search/gotowebsite.php?url=http://Mildredstultz.pen.io/ “Jeremy”))

CBT is t?e only format in whhich the test is offered but
if req?ested at the time of application, certain accommldations iin accordance witth tthe Americans ith Disabi?ities Act (ADA) can be made for specific candidates.
For most small non-farm businesses, the deducti?ns are taken on a Schedule C (Profit or Loss From Business), orr a ?ch?dule
C-EZ (for tho?e with deducti?ns oof ?ess th?n $5000).
Stud?es currently ?ave ?hown which, about average, CPAs ?arn 10% more thann non-CPA Accountants.

My web-site – [deerfield Beach accountant](http://genniecarp.Buzznet.com/user/journal/23251620/cpa-fort-lauderdale-work/ “deerfield Beach accountant”)

One of our guests not long ago advised the following website.

Here is a great Blog You might Uncover Fascinating that we encourage you to visit.

Leave a Reply