2

I'm working on the implementation of a HTML5 code style for \listings.

Currently I have the problem that there are different ways to define HTML tags. In my example, I don't get /p in <p></p> marked.

Screenshot:

enter image description here

My keyword definition looks like this:

otherkeywords={>,><,</p,<p,</p>}

If I add /p to the list, then </p> is not marked anymore.

Here is my language definition:

\lstdefinelanguage{HTML5}{
  language=html,
  sensitive=true,   
  alsoletter={<>=-},    
  morecomment=[s]{<!-}{-->},
  tag=[s],
  otherkeywords={>,><,</p,<p,</p>}
}

For a complete example I've created this document: https://www.writelatex.com/74567mmxwkw

Benny Code
  • 3,042

1 Answers1

3

You're declaring the keyword >< which leads to the wrong coloring. The line

<p></p>

is interpreted as the keywords <p and >< followed by /p (which is no keyword) and then again a keyword, >.

Leaving the >< keyword out should suffice. The line the would be interpreted as the keywords <p, >, </p, and >, which should be what you want.

cgnieder
  • 66,645