Commented Issue: Css markup crashes view [6114]

11 views
Skip to first unread message

sparkviewengine Issue Tracker Rss Feed

unread,
May 13, 2010, 9:42:03 PM5/13/10
to spar...@googlegroups.com
<style type="text/css">
#breadCrumb ul li.first {
{
background-image:none;
float:left;
margin:0 5px;
padding:0;
}
</style>

error produced is: "error CS1513: } expected"
which is caused by "#breadCrumb ul li.first {"
Comments: ** Comment from web user: steveo84 **

Sorry theres a typo there I added an extra "{" but the thats not what causes the issue.

URL: http://sparkviewengine.codeplex.com/WorkItem/View.aspx?WorkItemId=6114

--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spark-dev?hl=en.

Adam Schroder

unread,
May 13, 2010, 9:45:02 PM5/13/10
to spar...@googlegroups.com
# delimits C# code in spark.
You should move your style to a .css file, or change the delimiter.

James Hughes

unread,
May 14, 2010, 2:25:42 AM5/14/10
to Spark View Engine Dev
Alternatively you can preface your rule with html

<style type="text/css">
html #breadCrumb ul li.first {
{
background-image:none;
float:left;
margin:0 5px;
padding:0;
}

</style>

Essentially still the same rule but you can use it inline if you
really need to.

James

On May 14, 2:45 am, Adam Schroder <adamschro...@gmail.com> wrote:
> # delimits C# code in spark.
> You should move your style to a .css file, or change the delimiter.
>
> On Fri, May 14, 2010 at 11:42 AM, sparkviewengine Issue Tracker Rss Feed <
>
>
>
>
>
> sp...@dejardin.org> wrote:
> > <style type="text/css">
> > #breadCrumb ul li.first {
> > {
> > background-image:none;
> > float:left;
> > margin:0 5px;
> > padding:0;
> > }
> > </style>
>
> > error produced is: "error CS1513: } expected"
> > which is caused by "#breadCrumb ul li.first {"
> > Comments: ** Comment from web user: steveo84 **
>
> > Sorry theres a typo there I added an extra "{" but the thats not what
> > causes the issue.
>
> > URL:
> >http://sparkviewengine.codeplex.com/WorkItem/View.aspx?WorkItemId=6114
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Spark View Engine Dev" group.
> > To post to this group, send email to spar...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > spark-dev+...@googlegroups.com<spark-dev%2Bunsubscribe@googlegroups .com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/spark-dev?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
> To post to this group, send email to spar...@googlegroups.com.
> To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/spark-dev?hl=en.

Charles Strahan

unread,
May 14, 2010, 10:14:56 AM5/14/10
to spar...@googlegroups.com
Perhaps something like <# and #> could be added to spark, which would
ignore what would otherwise appear to be a spark code block. What do
you all think?


Sent from my iPhone

Rob G

unread,
May 14, 2010, 10:25:44 AM5/14/10
to spar...@googlegroups.com
If you did this, then you would lose the semantic meaning that the "#" symbol gives to CSS anyway. You may as well just put "html #breadCrumb" instead and Spark will ignore is anyway, but the bigger issue here is that it's bad ju-ju to put your styles in-line regardless, and even if you have to, you can get around it as pointed out by James.

Not to mention the headaches you're giving me while trying to build IntelliSense for this thing! ;-P

Less is more... my two pennies.
RobertTheGrey

spark-dev+...@googlegroups.com<spark-dev%2Bunsubscribe@googlegroups .com>

.
For more options, visit this group at
http://groups.google.com/group/spark-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/spark-dev?hl=en.

--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spark-dev?hl=en.


--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.
To unsubscribe from this group, send email to spark-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spark-dev?hl=en.

Charles Strahan

unread,
May 14, 2010, 1:56:32 PM5/14/10
to spar...@googlegroups.com

Good point, Robert. I didn’t really like my idea either :).

 

-Charles

sparkviewengine Issue Tracker Rss Feed

unread,
May 14, 2010, 9:42:03 PM5/14/10
to spar...@googlegroups.com
<style type="text/css">
#breadCrumb ul li.first {
{
background-image:none;
float:left;
margin:0 5px;
padding:0;
}
</style>

error produced is: "error CS1513: } expected"
which is caused by "#breadCrumb ul li.first {"
Comments: ** Comment from web user: tylerl **

This is a known issue that has happened to a number of people. It's a syntax collision between spark and HTML that really should be fixed, but probably won't be.

The simplest and most elegant solution is to set your statement marker to "# " instead of just "#". This means that if you want to inline a line of code into your markup, you simply put a space after the "#" sign, which agrees with the visual studio addin as well. And since CSS demands that there NOT be a space between the "#" and the ID, spark won't choke on your HTML.

Use the SetStatementMarker("# ") function in your SparkSettings object (usually in your Global.asax.cs file), or use the corresponding XML equivalent in your web.config to set this up.

URL: http://sparkviewengine.codeplex.com/WorkItem/View.aspx?WorkItemId=6114

--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To post to this group, send email to spar...@googlegroups.com.

Matthew Hinze

unread,
May 14, 2010, 10:36:05 PM5/14/10
to spar...@googlegroups.com
Great tip.  It's important to realize that Spark is used to render HTML not only for websites but also for scenarios where embedding CSS rules is not so questionable.

tylerl

unread,
May 18, 2010, 1:51:00 AM5/18/10
to Spark View Engine Dev
This comment has been bothering me for a couple of days.

First of all, inline styles are no more inappropriate in HTML than
"goto" statements are in C. There are clear and unambiguously correct
usages for both, even though they may not fit your particular project,
problem set, or coding style. Your statement is true for a limited set
of circumstances, but when you're writing a tool for public use, you
can't assume that everyone else's problem set is the same as yours.

Second, and more importantly, this associated flaw in the Spark markup
language represents a deviation from the way Spark is supposed to
work. In other words, it's a bug. "Spark loves your HTML like a
kitten" as Lou put it. You're supposed to be able to drop in normal,
valid HTML and expect it to almost always render correctly. However,
Spark fails spectacularly at this in a significant percentage of
cases. If the code uses inline styles and starts a line with an ID
selector (which, for all the banter about coding style, is still very
common), then your page will blow up with an extremely unhelpful error
message. That's not the way Spark was intended to work. And it's
clearly happening quite frequently to new users.

The proposed solution--modifying your HTML to avoid the bug--isn't a
solution. It's a workaround. And it's crappy.

As an analogy, imagine Spark is instead a C# compiler, but for some
reason it left out the implementation of the bit-shift ("<<" and ">>")
operators. Now when someone points this out, you could chide them and
say that bit manipulation has no place in managed code, or you could
argue that a user could just rewrite his code to use division and
multiplication instead. But that doesn't change the fact that your
compiler is, from the user's perspective, broken. It doesn't perform
as a reasonable user would expect, and instead chokes on what the user
expects is perfectly valid code.

This problem has been brought up several times. It's been solved
several times. And the solution has been mentioned here several times.
And what's more frustrating is that the solution is so stupidly
simple, but each new user has to re-discover and re-implement it on
his own. Spark has a coding land-mine. And it's so easy to fix.

The simple solution is to set the default StatementMarker to "#
" (with a trailing space). This fixes CSS issue because putting a
space between the # and the identifier is not valid CSS, and won't
occur "in the wild". Furthermore, users already commonly put a space
between the # and their C# code, because it makes the code easier to
read. A line like "#if (x==1)" apparently looks wrong, like it's a
preprocessor command; while "# if (x==1)" is apparently a bit easier
on the eyes because that "#" isn't crowding the code. And the
Intellisense still works. All win, no lose.

So why not make that the default? It's easier on the newcomers because
their HTML will work, and people who are used to the old way can
always set the StatementMarker back if they want to.

-Tyler

On May 14, 7:25 am, Rob G <robertgreyl...@gmail.com> wrote:
> If you did this, then you would lose the semantic meaning that the "#"
> symbol gives to CSS anyway. You may as well just put "html #breadCrumb"
> instead and Spark will ignore is anyway, but the bigger issue here is that
> it's bad ju-ju to put your styles in-line regardless, and even if you have
> to, you can get around it as pointed out by James.
>

RobertTheGrey

unread,
May 18, 2010, 9:42:47 AM5/18/10
to Spark View Engine Dev
Notwithstanding my comments before about inline CSS leading to brittle
designs, I must say that I'm sold on Tyler's assertions and
suggestions.

I think it's a very elegant solution and he's also right about the
intellisense bits. In fact, my completion handlers for SparkSense
already put a trailing space after the "#" symbol for the exact reason
that he mentions (readability and comprehension), so new users who use
the plugin will not even notice, and most importantly, it doesn't seem
like it will be a breaking change for existing users (but I could be
wrong about that).

Anyway, +1 for changing the default Statement Marker to "# " instead
of "#".

My additional two pence,
RobertTheGrey

RobertTheGrey

unread,
May 18, 2010, 9:46:58 AM5/18/10
to Spark View Engine Dev
Scratch that last bit - it will be a breaking change. Those users who
"accidentally" choose no space will loose a bunch of compiled code
unless they change their Statement Marker to "#" inthe config.

I still agree with Tyler that the default should be changed though....
it's cleaner.

John Gietzen

unread,
May 18, 2010, 9:58:33 AM5/18/10
to spar...@googlegroups.com
I feel that we should go for the breaking change, since it will potentially solve a lot of headache.

When I first learned about the config option, the first thing I did was set it to pound-space.  Since it is such an easy fix, (that is, since it is a single config option) I think we should make the change.

I have, in fact, already made the change in my local repository. "otac0n/spark"
Reply all
Reply to author
Forward
0 new messages