Problem with Transcluded StyleSheets: First Line Not Parsed?

94 views
Skip to first unread message

Scott Simmons

unread,
Jan 12, 2013, 5:25:02 AM1/12/13
to tiddl...@googlegroups.com
Over the last couple of years, my TiddlyWikis have become increasingly distinctive.  Even the most mundane of them have slightly different layouts from each other, introducing a lot of variance in my StyleSheet tiddlers.  To manage this, I recently decided to tear apart my usual StyleSheet into individual tiddlers that can be updated or modified individually on a TW-by-TW basis.

My main StyleSheet tiddler now includes several lists of included StyleSheets, like so:

/*{{{*/
[[StyleSheet_Supplement_01]]
[[StyleSheet_Supplement_02]]
/*}}}*/

For some reason, though, the first style definition in at least some (if not all) of my supplemental stylesheets fails to parse.

I've tried removing the /*{{{*/ and /*}}}*/ braces, like so:

[[StyleSheet_Supplement_01]]
[[StyleSheet_Supplement_02]]

I've also tried simplifying the contents of the supplemental stylesheet tiddlers (to remove comments), but that hasn't solved the problem either.

I've uploaded a test case here:


... with specific examples and a copy of my detailed troubleshooting log, so you can see what I've tried already.  (There are minimal plugins in the test case TW, just to make it a bit more usable -- but I've tested with no plugins installed, so it doesn't seem likely a plugin could be interfering.)

Can any kind souls out there shed some light on what's going wrong?

PMario

unread,
Jan 12, 2013, 12:21:32 PM1/12/13
to TiddlyWiki
> I've uploaded a test case here:
>
> http://tiddlywiki.secret-hq.com/testcase.html
hmmm ...
a simple testcase for me is:

* vanilla TW
* modified StyleSheet tiddler, that contains 2 transcluded tiddlers
where the second one doesn't work. (If I understand your info right)

Your testcase is a full mod. The StyleSheet contains about 30 links.
Any one of them can cause the problem. .... so after 10 min
investigating I stopped looking at it.

-m
Message has been deleted

Scott Simmons

unread,
Jan 12, 2013, 6:27:09 PM1/12/13
to tiddl...@googlegroups.com
Sorry, Mario — you're right; there was nothing minimal about my test case!  As I tinkered, I kept bringing over plugins for convenience, and I never trimmed all the extraneous styles.  Thanks for taking a second to poke your head in and look.

Revised to be much simpler for anyone who wants a peek:


Note that there are still a couple of dependencies -- most importantly, the elements' colors are being referenced from a modified ColorPalette.  I am, however, reasonably certain the ColorPalette isn't causing any problems.  (Copy the styles from the supplemental stylessheet tiddler into the main StyleSheet, and it works fine.  Rearrange the styles in the supplemental stylesheet, and they all work fine except the first one to appear, which fails consistently.)

I've also left the very beginning of my main StyleSheet intact because I'm convinced the problem lies somewhere within my syntax -- and is something that doesn't cause problems when I'm not transcluding styles from other CSS tiddlers.

PMario

unread,
Jan 13, 2013, 8:12:58 AM1/13/13
to TiddlyWiki

On Jan 13, 12:27 am, Scott Simmons <goo...@secret-hq.com> wrote:
>Revised to be much simpler for anyone who wants a peek:
>http://tiddlywiki.secret-hq.com/testcase.html
:)

The new version works fine. I can see the problem now.

I did notice a similar problem several times allready.
eg:
/*[[TranscludedStyleSheet]]*/
[[TranscludedStyleSheet2]]

needs to be
/*[ [TranscludedStyleSheet] ]*/
[[TranscludedStyleSheet2]]

because the StyleSheet transclusion mechanism doesn't respect CSS
comments ...

My fix was to remove the TW syntax stuff, which isn't a real
solution.

I think it needs a closer look to the core StyleSheet transclusion
handling. May be the parser has a problem.

-m

Scott Simmons

unread,
Jan 14, 2013, 7:13:12 AM1/14/13
to tiddl...@googlegroups.com
On Sunday, January 13, 2013 8:12:58 AM UTC-5, PMario wrote:

I did notice a similar problem several times allready. 
eg:
/*[[TranscludedStyleSheet]]*/
[[TranscludedStyleSheet2]]

needs to be
/*[ [TranscludedStyleSheet] ]*/
[[TranscludedStyleSheet2]]

because the StyleSheet transclusion mechanism doesn't respect CSS
comments ...

Interesting — though not directly relevant to my woes, unless I'm misunderstanding.

Assuming /*[[TranscludedStyleSheet]]*/ would appear in the main StyleSheet, how would you ever know there was a transclusion issue?  Wouldn't the /* and */ comment tags prevent the transclusion from being executed by the TW core?
 
My fix was to remove the TW syntax stuff, which isn't a real
solution.

It looks like I'll have to resort to that, too — though I wish I knew specifically where the issue lay and if it's something that should be reported as a bug.

Especially baffling given that Eric's TiddlyTools TW has complex CSS and plenty of TiddlyWiki comments but doesn't seem to have the same problem:

Scott Simmons

unread,
Jan 14, 2013, 7:51:46 AM1/14/13
to tiddl...@googlegroups.com

On Monday, January 14, 2013 7:13:12 AM UTC-5, Scott Simmons wrote:

Interesting — though not directly relevant to my woes, unless I'm misunderstanding.

Assuming /*[[TranscludedStyleSheet]]*/ would appear in the main StyleSheet, how would you ever know there was a transclusion issue?  Wouldn't the /* and */ comment tags prevent the transclusion from being executed by the TW core?

Oh, NOW I see what you were saying, PM!  Sorry for being a bit thick, but I had to see it in action after reading your post before it clicked.

The prettylinks inside my comments are the root of my troubles.  If I understand correctly, TW doesn't parse the contents of those comments as CSS — but the double brackets [[ and ]] DO tell TW's transclusion mechanism to reach out and pull in the contents of the prettylinked tiddlers.  Non-CSS garbage from those tiddlers then causes trouble in the stylesheet.

No prettylinks in the comments, no problems — which is why the TiddlyTools stylesheets don't encounter parsing problems, even though they use more complex transclusions than mine.

PMario

unread,
Jan 14, 2013, 10:00:50 AM1/14/13
to TiddlyWiki
On Jan 14, 1:51 pm, Scott Simmons <goo...@secret-hq.com> wrote:
> The prettylinks inside my comments are the root of my troubles.
may be
>  If I
> understand correctly, TW doesn't parse the contents of those comments as
> CSS — but the double brackets [[ and ]] *DO* tell TW's transclusion
> mechanism to reach out and pull in the contents of the prettylinked
> tiddlers.  Non-CSS garbage from those tiddlers then causes trouble in the
> stylesheet.
probably yes

> No prettylinks in the comments, no problems — which is why the TiddlyTools
> stylesheets don't encounter parsing problems, even though they use more
> complex transclusions than mine.
So you did fix it (??), by removing the prettylinks from your
tiddlywik markup inside CSS tiddlers?

-m

Scott Simmons

unread,
Jan 14, 2013, 10:37:55 AM1/14/13
to tiddl...@googlegroups.com

On Monday, January 14, 2013 10:00:50 AM UTC-5, PMario wrote:

So you did fix it (??), by removing the prettylinks from your
tiddlywik markup inside CSS tiddlers?

Yep!  Once I realized that was the pattern, I was able to work through the transcluded StyleSheets one by one, and those with prettylinks inside the comments were the ones where the first style was failing.

PMario

unread,
Jan 15, 2013, 7:53:25 AM1/15/13
to TiddlyWiki
I did create a issue ticket at github.
https://github.com/TiddlyWiki/tiddlywiki/issues/114

__It would be nice, if your testcase.html would be there for some more
time.__

I can't promise, that someone will fix it (if it is fixable), but imo
it won't get lost :)

-mario

PMario

unread,
Jan 16, 2013, 11:45:36 AM1/16/13
to TiddlyWiki
Jeremy commented the issue. See the full commment here:
https://github.com/TiddlyWiki/tiddlywiki/issues/114#issuecomment-12276133

>I think it's going to be pretty much impossible to reliably link to
>tiddlers within CSS comments without them being picked up as transclusions.
>Sadly, you may need to separate out your CSS documentation.

Or just remove prettylinks from the documentation, which solves the
problem too.

I thought about this allready. But Jeremy knows the syntax parser
better than I do :).

@Scott should I close the issue?

have fun!
mario

Scott Simmons

unread,
Jan 17, 2013, 10:01:50 AM1/17/13
to tiddl...@googlegroups.com
You're a prince of a man, Mario!  :)

I followed your link last night and saw Jeremy's comment.  Nice to know he's aware of it and that we indeed sussed out the cause of my issue.

I agree it's probably not worth a massive undertaking to "fix" when we can just advise folks who stumble across the same issue to not use PrettyLinks in StyleSheet comments.  In my case, the tiddlers I'd prettylinked to already had camelcase names, so all I had to do was remove the bounding brackets.  :D

Go ahead and close out the issue on GitHub when you're ready, and we'll still have the thread here at Google Groups to document what happened in case anyone comes looking.
Reply all
Reply to author
Forward
0 new messages