W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

Re: Wrapping scripts in CDATA for XHTML

From: Gary L Peskin <garyp@firstech.com>
Date: Tue, 11 Jul 2000 14:41:03 -0700
Message-ID: <396B946F.9F7BA44B@firstech.com>
To: "Tieu H.Luu" <THLuu@aethersystems.com>
CC: "'html-tidy@w3.org'" <html-tidy@w3.org>
Tieu --

These are basically the same changes as the c code.  However, here it
is:

In class PPrint, method printTree, the changes look like this:

  else if (node.tag == TagTable.tagStyle || node.tag ==
TagTable.tagScript) {
    condFlushLine(fout, indent);

    indent = 0;
//  condFlushLine(fout, indent);    LINE REMOVED AS REDUNDANT
    printTag(lexer, fout, mode, indent, node);
    flushLine(fout, indent);

    // Start of added code

    if (this.configuration.xHTML) {
      int savewraplen = this.configuration.wraplen;
      /* disable wrapping */
      this.configuration.wraplen = 0xFFFFFF;  /* a very large number */
      addC('<', linelen++);
      addC('!', linelen++);
      addC('[', linelen++);
      addC('C', linelen++);
      addC('D', linelen++);
      addC('A', linelen++);
      addC('T', linelen++);
      addC('A', linelen++);
      addC('[', linelen++);
      condFlushLine(fout, indent);
      this.configuration.wraplen = savewraplen;
    }

    // End of added code

    for (content = node.content;
            content != null;
            content = content.next)
        printTree(fout, (short)(mode | PREFORMATTED | NOWRAP |CDATA),
indent, lexer, content);

    condFlushLine(fout, indent);

    // Start of added code

    if (this.configuration.xHTML) {
      int savewraplen = this.configuration.wraplen;
      /* disable wrapping */
      this.configuration.wraplen = 0xFFFFFF;  /* a very large number */
      addC(']', linelen++);
      addC(']', linelen++);
      addC('>', linelen++);
      condFlushLine(fout, indent);
      this.configuration.wraplen = savewraplen;
    }

    // End of added code

    printEndTag(fout, mode, indent, node);
    flushLine(fout, indent);

    if (this.configuration.IndentContent == false && node.next != null)
        flushLine(fout, indent);
  }

HTH,
Gary

"Tieu H.Luu" wrote:
> 
> Hi Gary,
> 
> I'm using JTidy to convert HTML to XHTML and also need to wrap scripts in
> CDATA.  I was wondering if you could post the changes that you made to the
> Java version of Tidy to accomplish this.
> 
> Thanks in advance,
> Tieu Luu
Received on Tuesday, 11 July 2000 17:41:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT