Re: Auto-inserting <![CDATA[ ... ]]>
"D. D. Brierton" <[email protected]> Mon, 23 Feb 2004 10:46:18 +0000
| Newsgroups | gmane.emacs.psgml.user |
|---|---|
| Organization | DZR Web Development |
| Message-ID | <[email protected]> |
On Sun, 2004-02-22 at 23:02, Peter Flynn wrote:
> On Sun, 2004-02-22 at 15:55, D. D. Brierton wrote:
> > When working in XHTML, although I try and keep all my CSS and Javascript
> > in external files I occasionally have to include some stuff in the
> > document itself which, because it contains characters like ">", needs to
> > go in CDATA tags like so:
>
> The ">" character (TAGC) never needs to go in a CDATA Marked
> Section, as it's just character data unless there is a prior
> "<". The only two characters that need CDATA Marked Sections
> are "<" and "&" because they introduce markup.
Ooh. I didn't know that. Thanks!
> > <style type="text/css">
> > /*<![CDATA[*/
> >
> > /*]]>*/
> > </style>
>
> I'm not quite clear what you're trying to do here. Can you give
> a full example?
Okay. I'm assuming you mean a whole document:
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en-GB">
<head>
<title>
CDATA in script Example
</title>
<meta http-equiv="Content-Type"
content="application/xhtml+xml; charset=us-ascii" />
<script type="text/javascript">
/*<![CDATA[*/
if (i < foo && j < bar) {
baz;
}
/*]]>*/
</script>
</head>
<body>
<p>
Hello World!
</p>
</body>
</html>
> > Could someone recommend some handy way of including the commented CDATA
> > stuff with the minimum of typing? Is that what Markup -> Custom Markup
> > is for?
>
> I've never investigated Custom Markup. Why not just record the
> relevant keystrokes and save them in your .emacs bound to an
> unused key (eg F12)?
Because I don't now how to do that! Also, I'd really like something I
didn't have to memorise, but instead was available from a menu.
Best, Darren
--
=====================================================================
D. D. Brierton [email protected] www.dzr-web.com
Trying is the first step towards failure (Homer Simpson)
=====================================================================
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click