[CSS] simple quotes in content

79 views
Skip to first unread message

oxydum

unread,
Mar 1, 2019, 3:52:14 AM3/1/19
to TiddlyWiki
Hi,

Maybe a problem with the wikitext parser :

Don't Work:
<style>
.email::before {
  content
: attr(data-de) '';
}
</style>


<div
 
data-de="✅"
 
class="email">
    te...@gmail.com
</div>

Work:
<style>
.email::before {
  content
: attr(data-de) "";
}
</style>


<div
 
data-de="✅"
 
class="email">
    te...@gmail.com
</div>

So...
How to make this work:

Thx


S. S.

unread,
Mar 1, 2019, 5:06:41 AM3/1/19
to TiddlyWiki
Does this work?

oxydum

unread,
Mar 1, 2019, 6:00:19 AM3/1/19
to TiddlyWiki
To see the problem,

try to replace quotes ;
<style>
.zemail::before {

  content
: attr(data-de) "";
}
</style>




<div
 
data-de="✅"

 
class="zemail">
    te...@gmail.com
</div>

in the line :   content: attr(data-de) "";
by :   content: attr(data-de) '';

BurningTreeC

unread,
Mar 1, 2019, 9:02:44 AM3/1/19
to TiddlyWiki
Hi @oxydum,

if you use the double '' in a tiddler without a given type or with type vnd.tiddlywiki, the wiki-parser will interpret the double-single-quotes as bold formatting, which breaks your style definitions

you can do two things:

1) put your styles in another tiddler tagged $:/tags/Stylesheet , remove the <style></style> tags therefor. either make its type application/css or put a pragma rule on top that turns off all or certain wiki-parser rules

2) use your tiddler as it is, but put a pragma rule on top that turns off bold formatting (bold using ''this text is bold'' won't work in that tiddler)

a rule is set at the very top of a tiddler or at the top of a macro

it looks like this:

\rules

it follows "only" or "except"

then it follows a list of rules, see all shadow tiddlers with the title $:/core/modules/parsers/wikiparser/rules/...


...

in your case

\rules except bold

... all rules allowed except bold

BurningTreeC

unread,
Mar 1, 2019, 9:07:50 AM3/1/19
to TiddlyWiki
Just to make "the problem" visually clear:

the wikiparser takes this code:

<style>
.zemail::before {
  content
: attr(data-de) '';
}
</style>




<div
 
data-de="✅"
 
class="zemail">
   
te...@gmail.com
</div>

and creates this:

<style>
.zemail::before {
  content
: attr(data-de)
<strong>
;
}
</style>




<div
 
data-de="✅"
 
class="zemail">
   
te...@gmail.com
</div>
</strong>

but it ignores the double '' if \rules except bold is on top ... and your style definition isn't destroyed

oxydum

unread,
Mar 1, 2019, 9:43:31 AM3/1/19
to tiddl...@googlegroups.com
Very clear @BurningTreeC : thank you that's exactly what I need.
There's also an issue for me when I change the name of the class from
email

to
e--mail

(yes, with two hyphens "--")

what kind of rule can I add?

BurningTreeC

unread,
Mar 1, 2019, 9:46:44 AM3/1/19
to TiddlyWiki
Very clear @BurningTreeC : thank you that's exactly what I need.
There's also an issue for me when I change the name of the class from
email

to
e--mail

(yes, with two "--")

what kind of rule can I add?

I believe it's called dash, but have a look at the mentioned parser tiddlers, the tiddlers are named using the rule name 

oxydum

unread,
Mar 1, 2019, 10:36:26 AM3/1/19
to TiddlyWiki
Yes! This is perfect it works like a charm ;)

\rules except bold underline strikethrough subscript superscript italic dash


https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/parsers/wikiparser/rules/dash.js


Thank you so much
Reply all
Reply to author
Forward
0 new messages