After reading this thread I went and looked at topstyle to see if there was
a way to take care of the formating with styles. And the answer as I
suspected is yes. The code below works in IE6 and Netscape 6+ not sure
about IE 5. One thing to note is that the style only work in IE6 when it is
rendering in Standards compliant mode. Don't remember the rules for how it
picks but I know XHTML Strict works. I used the code tag because what is
being displayed is code so use the tag to denote it as code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Untitled</title>
<style type="text/css">
code {white-space : pre;
}
</style>
</head>
<body>
<code >this is a test
there should be some tabs and return
s in this doc.
</code>
</body>
</html>
Daniel D.
-----Original Message-----
From: Charlie Arehart [mailto:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 11:05 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Off Topic, but
Just a follow-up, the guy who ran that site responded to my suggestion and
added a new "retain formatting" checkbox. While all it does is add a pair of
<pre> tags around the result, it's a nifty solution if one wouldn't have
thought of it themselves.
The only drawback is that it keeps the code from breaking the lines, which
might be a benefit for some code fragments (where the language wouldn't
support if the line was broken), though with HTML and CF code, that's not as
important. It can mean that a code display may force the browser window to
be as wide as the longest line of code in the code fragment, which can cause
unexpected ugliness if you're used to seeing the code with "wrap" on in an
editor. Just beware.
I will grant that the pre tag approach is better than my idea of converting
tabs to non-breaking spaces in one respect: it keeps any tabs in the code so
that they continue to be represented as such on the browser, and then also
if that code is copied out of the page (like your blog) and pasted into an
editor.
BTW, someone may point out that another way to show code (and one used by MM
now) is to show it in a <textarea> tag. That's cool, too. The only problem
is that if you use blogger for your blog, it always puts <br> tags on every
line--even inside textarea tags. This is a real annoyance. And while there's
an option to turn that off, it would then turn it off for all entries you've
ever and will ever create, so the next time you publish, all your entries
would become one big paragraph each. Not pretty! So it appears we have to
solve it ourselves, so this web site tool has been useful.
I've not found a feature in Studio or DWMX to do this for us. I tried the
Codesweeper in Studio/HomeSite+ as well as it's Options>Set Document as
XHTML (which may be only a Studio 5/HS+ feature). That didn't do it.
I just noticed after writing this and before sending it that Ray offered in
the next note to show a Studio solution. Yes, Ray, please do share it (with
me off-list if not on-list). Thanks
/charlie
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Charlie Arehart
> Sent: Friday, March 21, 2003 1:42 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] Off Topic, but
>
>
> Here's an even cooler solution if you ever have to convert a bunch of code
> into those character entities:
>
> http://www.stanford.edu/~bsuter/js/convert.html
>
> Paste your code in the left window, click the button below it, then
> copy/paste the code from the right window. The only thing is that it
> doesn't currently turn tabs or spaces for indenting into the
> needed s
> it would take to keep the code properly indented when rendered in
> HTML. But
> that's relatively to add yourself. I've requested that the tool
> author do it
> for us.
>
> /charlie
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Behalf Of Nathan Dintenfass
> > Sent: Thursday, March 20, 2003 11:14 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: [CFCDev] Off Topic, but
> >
> >
> > If the blogging software you are using doesn't escape HTML, do it
> > yourself.
> > Use the < and > "special" characters -- which render as the tag
> > brackets you know and love.
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] Behalf Of
> > David Mineer
> > Sent: Thursday, March 20, 2003 8:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: [CFCDev] Off Topic, but
> >
> >
> > Can someone tell me how I post HTML and other CODE snippets in
> blogger. I
> > want to see the code literally and not have it rendered. Know
> > what I mean.
> > Can't figure this out. Hope you don't mind, but I got the idea to try
> > blogging from this news group and looking at spike's blog, I
> notice he has
> > now problem posting code snippets.
> >
> > TIA
> >
> > David M
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).