othree / html5.vim

HTML5 omnicomplete and syntax
http://www.vim.org/scripts/script.php?script_id=3236
934 stars 76 forks source link

Handle lack of optional closing tags #25

Open MarkLodato opened 12 years ago

MarkLodato commented 12 years ago

Many common tags in HTML5, such as <p> and <li>, do not require a closing tag, but the current indent file cannot handle this case. For example,

<ul>
  <li>a
  <li>b
  <li>c

gets turned into

<ul>
  <li>a
    <li>b
      <li>c
stardiviner commented 12 years ago

I guess <p> tag need a closing tag. And I think write HTML in a good style is better. No need to support those tags except some tags only have one tag without closing tag.

MarkLodato commented 12 years ago

Closing optional tags is not universally considered "good style," and besides, the editor is not supposed to impose arbitrary style choices. It should simply interpret the specification correctly.

othree commented 11 years ago

There is no way to detect is this omit close tag or other case. Suggestion?

MarkLodato commented 11 years ago

It is a bit challenging, but I think you could probably cover the most common cases:

othree commented 11 years ago

Thanks for suggestion. Looks possible but I can't give a promise.

mindfulmonk commented 11 years ago

My indentation is now borked if I close <li>

    <ol>
    <li>Item1</li>
  <li>Item2</li>
</ol>