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 made a new language definition for a .NET template engine where part of the strings in the C# code are markup.

Example:

string templateString = @"{% for name in names %} 
Hallo {{ name }} 
{% endfor %}";

Everything between {% and %} and {{ and }} is part of the template engine and should be formatted different from the string.

My language definition looks like this:

 \lstdefinelanguage{dotliquid}[Sharp]{C}
 {morecomment=[s][\color{liquidgreen}]{\{\%}{\%\}},
 morecomment=[s][\color{liquidgreen}]{\{\{}{\}\}}
 }

When I have normal C# code with template code inside (not inside a string) it works fine, but in the example above the complete string is formatted one way.

Is there any way to achieve this? I experimented with moredelim and deletestring but didn't manage to get the wanted result.

share|improve this question
    
Hi. Were you already able to solve this problem? Perhaps this does not have an answer until now because it is difficult to set up this problem without enough background. Please provide a minimal working example (MWE) for solvers to play with. –  hpesoj626 Feb 28 '13 at 22:07
add comment

closed as unclear what you're asking by Marco Daniel, lockstep, Claudio Fiandrino, Stefan Kottwitz Jul 7 '13 at 11:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.