473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Tidy & inline style

I recently discovered the value of tidy for my html adventures. Nice
little app. Only one thing is becoming a bit of a drag.

If I use tidy to clean up my code, it inserts the following in every
<style> segment:

e.g. before:

<style>
p {
color : blue;
}
</style>
after: (tidy -im myfile.html)

<style>
/*<![CDATA[*/
p {
color : blue;
}

/*]]>*/
</style>

I'm assuming (correctly?) these are supposed to be html comment markers
to hide the style from style-unaware browsers ?
Is it possible (how) to have tidy insert the proper <!-- and -->
instead? And without the /* and */, or should they be there ??? And
should the html comment markers not sit outside the <style> element?

I'm confused right now...

Sorry for asking a question with a probably obvious answer.
KR
Sh.
Apr 2 '06 #1
4 2789
em
The CDATA part is an XML construct to handle text strings that does not
need to follow the same rules as everything else. They are there so
that an XML parser can see that it's dealing with content that it
should just skip past. Without using Tidy I can guess that it's adding
the CDATA part to XHTML documents just to make sure they can be parsed
with an XML parser as intended. Hope that helped you somewhat.

--
Emil Stenström
http://friendlybit.com

Schraalhans Keukenmeester wrote:
I recently discovered the value of tidy for my html adventures. Nice
little app. Only one thing is becoming a bit of a drag.

If I use tidy to clean up my code, it inserts the following in every
<style> segment:

e.g. before:

<style>
p {
color : blue;
}
</style>
after: (tidy -im myfile.html)

<style>
/*<![CDATA[*/
p {
color : blue;
}

/*]]>*/
</style>

I'm assuming (correctly?) these are supposed to be html comment markers
to hide the style from style-unaware browsers ?
Is it possible (how) to have tidy insert the proper <!-- and -->
instead? And without the /* and */, or should they be there ??? And
should the html comment markers not sit outside the <style> element?

I'm confused right now...

Sorry for asking a question with a probably obvious answer.
KR
Sh.


Apr 2 '06 #2
em@kth.se wrote:
The CDATA part is an XML construct to handle text strings that does not
need to follow the same rules as everything else. They are there so
that an XML parser can see that it's dealing with content that it
should just skip past. Without using Tidy I can guess that it's adding
the CDATA part to XHTML documents just to make sure they can be parsed
with an XML parser as intended. Hope that helped you somewhat.

--
Emil Stenström
http://friendlybit.com

Thanks for clearing that mystery up. Also explains why I found multiple
docs on the web containing the same construction. And save me from
removing that bit each and every time. :-)

KR
Sh.

PS. Most people -including myself- would rather see you reply below
original postings. Please be so kind and set your newsproggy
accordingly. Most offer you a choice between top or bottom reply.
Apr 2 '06 #3
Schraalhans Keukenmeester wrote :
I recently discovered the value of tidy for my html adventures. Nice
little app. Only one thing is becoming a bit of a drag.

If I use tidy to clean up my code, it inserts the following in every
<style> segment:

e.g. before:

<style>
p {
color : blue;
}
</style>

This is called embedded stylesheet or local stylesheet; not inline style.

after: (tidy -im myfile.html)

<style>
/*<![CDATA[*/
p {
color : blue;
}

/*]]>*/
</style>

I'm assuming (correctly?) these are supposed to be html comment markers
to hide the style from style-unaware browsers ?
Actually, they are not. They are used (sole purpose) to escape
occurences of "<", ">" and "&" in XHTML documents.
This section explains:
http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-4.8

Is it possible (how) to have tidy insert the proper <!-- and -->
instead?

Non-capable CSS browsers which fail to ignore <style> blocks are no
longer in use. So,
<!-- ... -->
inside <style> blocks are no longer necessary and should be dropped.

So, those comment delimiters are no longer serving any useful purpose
inside <style> blocks.
And without the /* and */, or should they be there ??? And
should the html comment markers not sit outside the <style> element?


Ideally, Tidy should have spotted
<style>
and recommend to the user to use
<style type="text/css">

Gérard
--
remove blah to email me
Apr 3 '06 #4
> PS. Most people -including myself- would rather see you reply below
original postings. Please be so kind and set your newsproggy
accordingly. Most offer you a choice between top or bottom reply.


I'm acctually using Google Groups :) I'll think of that in the future.

--
Emil Stenström
http://friendlybit.com

Apr 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Victor Irzak | last post by:
Hello, I have an ABC. it supports: ostream & operator << I also have a derived class that supports this operator. How can I call operator << of the base class for derived object??? Is it...
0
by: Anne van Kesteren | last post by:
Ok, here it goes. Originally I submitted this proposal to www-style. Since I don't get feedback there, I think I missed a few (maybe a lot) of points. Proposal:...
4
by: Shash | last post by:
Hey People, I'm facing a issue with browser compatablity here, I want a certain group of divs to behave like a table row, i.e if one of the cell/div has content longer than the other divs, all...
2
by: Mikaël Hautin | last post by:
Hi there, I'm Mikaël Hautin, a new one to this newsgroup. I will show you how to get rid of <a> tags to put links on pictures. When you want to put a link to another page on a picture, you...
27
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get...
0
by: mahaq | last post by:
Hi Guys, I like to know if there is any better solution to this issue. I am a front end developer using CSS and asp.net technologies I have a .net page and I am using an external CSS file....
13
by: Ragnar | last post by:
Hi, 2 issues left with my tidy-work: 1) Tidy transforms a "&amp;" in the source-xml into a "&" in the tidied version. My XML-Importer cannot handle it 2) in a long <title>-string a wrap is...
3
by: KimberlyM | last post by:
This has been driving me crazy. I hope someone can help. The site displays perfectly in FF but all div's do not show in IE. Please help me find the problem! Thanks! Here is my css. ...
14
by: issentia | last post by:
I'm working on this site: http://www.essenceofsoy.com/redesign/index2.html and I'm having a few problems with getting the layout exactly right. 1) When the menu items are rolled over, they...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.