Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
Shouldn't it work if you omit >< from the keyword list? –  cgnieder Feb 24 '13 at 12:40
    
Wow. That was easy. I missed the forest for the trees. Thank you! You can write this as a solution, so that I can check off the question. –  Benny Neugebauer Feb 24 '13 at 16:36
    
@cgnieder Please write a short answer (or cast the first closing vote). –  lockstep Mar 6 '13 at 12:18
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.