Jeff-Lewis / nhaml

Automatically exported from code.google.com/p/nhaml
0 stars 0 forks source link

Allow : colon in attributes when using c# compilers #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Related to a post in users mailing list it is currently not possible to use
a colone inside an attribute to get this working:

<html lang="en", xml:lang="en", xmlns="http://www.w3.org/1999/xhtml">

The simple way is to mask the colon with some special char and then replace
in output with a colon again. But i dont know how to escape a special char
if we only have an _ available. 

On the long way we should remove the creation of an anonymous type and use
a c# 3 parser (in example from mono) to do the same like the attributes in
boo template compiler works and so we can support attributes as string.
With this we could also support the attribute messages.
http://code.google.com/p/nhaml/issues/detail?id=24

Original issue reported on code.google.com by lanwin...@gmail.com on 18 Nov 2008 at 9:15

GoogleCodeExporter commented 9 years ago
"But i dont know how to escape a special char
if we only have an _ available."

C# variable names can be in Unicode so I too think using a special char is the 
way to 
go.

Original comment by andrew.j...@gmail.com on 18 Nov 2008 at 9:44

GoogleCodeExporter commented 9 years ago

Original comment by andrew.j...@gmail.com on 18 Nov 2008 at 9:44

GoogleCodeExporter commented 9 years ago
Just to clarify the problem, I would like to point out that the problem is only 
relevant for cases where the attribute (with a colon its name) is bound to a 
dynamic 
expression, rather than a string literal. If the attribute value is a string 
literal, everything works as expected.

The following lines can be added to the test suite in order to trigger the 
defect:

/Tests/Templates/CSharp2/AttributeEval.haml
  - var lang = "en"
  %html{lang=lang, xml:lang=lang, xmlns="http://www.w3.org/1999/xhtml"} Baz

/Tests/Expected/AttributeEval.xhtml
  <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">Baz</html>

Original comment by jsr%mala...@gtempaccount.com on 6 Dec 2008 at 10:08

GoogleCodeExporter commented 9 years ago
This is because we currently use two strategies to parse the attributes.

Original comment by lanwin...@gmail.com on 6 Dec 2008 at 3:35

GoogleCodeExporter commented 9 years ago

Original comment by simon.cropp@gmail.com on 13 May 2009 at 12:10