12

Closed

HTML 5 and Spark view engine - Naming conflict 'section'

description

I was just trying to create a html 5 page and added some <section> (http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-section-element) tags to separate content. When the spark compiler tried to compile this page I got:

[CompilerException: Section cannot be used at this location]
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.VisitSection(SpecialNode node, SpecialNodeInspector inspector) +800
Spark.Compiler.NodeVisitors.ChunkBuilderVisitor.Visit(SpecialNode specialNode) +132
Spark.Compiler.NodeVisitors.AbstractNodeVisitor.Accept(IList`1 nodes) +101
....

I'm not sure if there are any other naming conflicts between html 5 and spark but this is a serious one as section is an important new tag.

No files are attached

Closed Feb 4 2011 at 7:30 AM by RobertGreyling

This has now been fixed. As of Spark v1.5 - you now use the <segment> tag - not the <section> tag for Spark, and if you can use the <section> tag for Html5.

There is backwards compatibility setting in the config for people who have already used <section> for Spark and wish to continue.


comments

RobertGreyling wrote Feb 4 2011 at 7:29 AM

This has now been fixed. As of Spark v1.5 - you now use the <segment> tag - not the <section> tag for Spark, and if you can use the <section> tag for Html5

RobertGreyling wrote Jan 22 2011 at 7:45 AM

Thanks gatapia, We came to the same conclusion on the Spark Dev email list: https://groups.google.com/d/msg/spark-dev/NGyTixz3N4s/w7KSwU0abv0J <-- have a look there if you'd like to add more...

Regards,
Rob

gatapia wrote Jan 22 2011 at 12:46 AM

Robert, that sounds like a complex solution to a pretty rare problem. Just check any applicable specs (HTML4, 5) and don't use those names in the future, In the case of 'section', just rename it with some backwards compatibility smarts but I wouldn't make all tags configurable, I mean the specs change every 11 years not really a recurring problem.

RobertGreyling wrote Jan 21 2011 at 12:03 PM

Regarding the HTML 5 section tag – I was thinking of putting functionality in to allow anyone to rename one of the Spark specific tags. For example, you could specify in your config that Spark “section” should actually be called “mysection” or that “var” could become “declare” or whatever. Would that kind of config solve your problem? The way I see it, then future naming conflicts could also be tackled this way without changing Spark at all.

kharlamov wrote Jan 20 2011 at 4:09 PM

You can use a binding:

<bindings>
<element name="Section">
<start>
!{string.Format("<section {0} >", "@*" )}
</start>
<end>
!{"</section>"}
</end>
</element>
</bindings>

--
Usage:

<Section id="Blah">

</Section>

RobertGreyling wrote Nov 17 2010 at 8:40 AM

If you use a namespace for your spark elements like this <s:section>blah</s:section>, then Spark will ignore <section> tags.

You can find more info here: http://sparkviewengine.com/documentation/syntax#Sparkelementprefixwithxmlnsnamespaces

DigiKev wrote Jun 17 2010 at 5:37 AM

There is nothing elegant about this work around but it solves the problem for anyone who wishes to use the section tag now.

gatapia wrote Jun 16 2010 at 9:06 PM

That is super ugly

DigiKev wrote Jun 16 2010 at 12:01 PM

Where there is a will there is a way, just spit out the section tags as string literals like so:

!{"<section id='page-content'>"}

!{"</section>"}