[TYPO3] tinyRTE removes col and colgroup tags

Caterina caterina_kitty at yahoo.com
Thu Jul 17 20:21:32 CEST 2008


Hello to everyone!

I have such a problem: when I'm pasting a table (its pure html code) 
into tinyRTE html source editor and press "Update", it stripes all tags 
"col" from this table. And these tags are needed there!! I'm using TYPO3 
4.2.1 with  tinyRTE 1.6.6 and CSS Styled Content 0.4.0.  In the site 
root page TS Config there are settings:

page.config.doctype = xhtml_trans
page.config.xmlprologue = none
page.config.xhtml_cleaning = all

//Default RTE processing rules

RTE.default.addParam {
   cleanup = true
   extended_valid_elements = 
"form[method|action],input[type|name],select[name],option[value|selected],hr[class|width|size|noshade],help,col[class|width],colgroup[class]"
   doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
   verify_html = true
   cleanup_on_startup = true
   apply_source_formatting = true
}


RTE.default.proc {

  //TRANSFORMATION METHOD - CSS Styled Content is used.
  overruleMode = ts_css
  //DO NOT CONVERT BR TAGS INTO LINEBREAKS
  dontConvBRtoParagraph = 1

  //preserve div sections - do not remap them to p
  preserveDIVSections = 1

  //tags allowed outside p and div

  allowTagsOutside = hr, address, ul, ol, li, img

  // tags allowed
  // Added to the default internal list:
  // But, for the sake of clarity, we use a complete list in alphabetic 
order.
  // center, font, strike, sdfield and  u will be removed on entry (see 
below).
  // b and i will be remapped on exit (see below).
  // Note that the link accessibility feature of htmlArea RTE does 
insert img tags.

  allowTags (

      p, div, table, thead, tfoot, tbody, col, colgroup, tr, td, th,
      blockquote, ol, ul, li, dl, dt, dd, img, hr, br, span, strong,
      em, object, param, script, a, pre, h1, h2, h3, h4, h5, h6, i, b,
      sub, sup, u, abbr, address, area, map, code, cite, del, dfn, q,
      samp, ins, kbd, caption

  )

  // tags denied
  // Make sure we can set rules on any tag listed in allowTags.

  denyTags >

  //allowed P & DIV attributes
  //Attributes class and align are always preserved
  //Align attribute will be unset on entry (see below)
  //This is a list of additional attributes to keep

  keepPDIVattribs = id, title, dir, lang, xml:lang

  //allow to write about HTML
  dontUndoHSC_db = 1
  dontHSC_rte = 1

  //Tags allowed outside p and div
  //Adding img tag to the default list

  proc.allowTagsOutside := addToList(img)

  //Do not remove img and col tags

  proc.entryHTMLparser_db.tags.img >
  proc.entryHTMLparser_db.tags.col >

  //CONTENT TO DATABASE Transformation Settings

  entryHTMLparser_db = 1
  entryHTMLparser_db {

    //Tags allowed
    //Always use the same list of allowed tags.
    allowTags < RTE.default.proc.allowTags

    //Tags denied
    //Make sure we can set rules on any tag listed in allowTags.
    denyTags >

    //Avoid content being HSC'ed Twice
    htmlSpecialChars = 0

    tags {

      //Clean attributes for the following tags
      //span.fixAttrib.style.unset = 1

      //Allow following attributes for the following tags
      p.fixAttrib.align.unset >
      div.fixAttrib.align.unset >
      p.allowedAttribs = class, style, align, id
      ol.allowedAttribs = class, start
      ol.fixAttrib.start.unset >
      ul.allowedAttribs = class
      li.allowedAttribs = class, value
      br.allowedAttribs = class
      hr.allowedAttribs = class
      col.allowedAttribs = class, width
    }

    //REMOVE OPEN OFFICE META DATA TAGS AND DEPRECATED HTML TAGS
    //We use this rule instead of the denyTags rule so that we can
    //protect custom tags without protecting these unwanted tags.
   removeTags = center, font, o:p, sdfield, strike, u, sub, sup
   removeTags := removeFromList(col)

    //PROTECT CUSTOM TAGS
    keepNonMatchedTags = 1
  
    xhtml_cleaning = 1
  }

  exitHTMLparser_db = 1
  exitHTMLparser_db {

    // KEEP ALL TAGS
    // Unwanted tags were removed on entry.
    // Without this rule, the parser will remove all tags!
    //Presumably, this rule will be more efficient than repeating the 
allowTags rule

    allowTags < RTE.default.proc.allowTags
    keepNonMatchedTags = 1

    //AVOID CONTENT BEING HSC'ed TWICE
    htmlSpecialChars = 0

    //remapping of i and b tags
    //tags{
    //  i.remap = em
     // b.remap = strong
      //span.rmTagIfNoAttrib = 1
   // }

  }

  entryHTMLparser_rte >
  entryHTMLparser_rte < entryHTMLparser_db

  exitHTMLparser_rte >
  exitHTMLparser_rte < exitHTMLparser_db
}

//RTE processing rules for bodytext column of tt_content table
//Erase settings from other extensions

RTE.config.tt_content.bodytext >
RTE.config.tt_content.table >

//Make sure we use ts_css transformation

RTE.config.tt_content.bodytext.proc.overruleMode = ts_css
RTE.config.tt_content.bodytext.types.text.proc.overruleMode = ts_css
RTE.config.tt_content.bodytext.types.textpic.proc.overruleMode = ts_css

In Page Template Setup there are settings:

page.config.doctype = xhtml_trans
page.config.xmlprologue = none
page.config.xhtmlDoctype = xhtml_trans
page.config.xhtml_cleaning = all

lib.parseFunc{
  allowTags (
    p, div, table, thead, tfoot, tbody, col, colgroup, tr, td, th,
    blockquote, ol, ul, li, dl, dt, dd, img, hr, br, span, strong,
    em, object, param, script, a, pre, h1, h2, h3, h4, h5, h6, i, b,
    sub, sup, u, abbr, address, area, map, code, cite, del, dfn, q,
    samp, ins, kbd, caption
   )
  denyTags = *
  
}
lib.parseFunc_RTE {
  allowTags < lib.parseFunc.allowTags
  denyTags < lib.parseFunc.denyTags
  
  //processing <table>, <blockquote>, <div>, <ol>
  //<ul> and <dl> blocks separately
  externalBlocks = table, blockquote, ol, ul, dl, div
  externalBlocks {
    //blockquote processing settings
    blockquote.stripNL = 0
    blockquote.callRecursive = 1
    blockquote.callRecursive.tagStdWrap.HTMLparser = 1
  
  blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs 
>
    
    ol.stripNL = 1
    ol.fixAttrib.start.unset = 0
    ol.allowedAttribs = start, class
    ol.stdWrap.ParseFunc =< lib.parseFunc
    
    ul.stripNL = 1
    ul.allowedAttribs = start, class
    ul.stdWrap.ParseFunc =< lib.parseFunc
    
    dl.stripNL = 1
    dl.allowedAttribs = start, class
    dl.stdWrap.ParseFunc =< lib.parseFunc
    
    table.stripNL = 1
    table.stdWrap.HTMLparser = 1
    table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
      always = 0
      list >
    }
    
    table.stdWrap.HTMLparser.tags{
      col = 1
      col.AllowedAttribs = class
    }
    
    table.stdWrap.HTMLparser.keepNonMatchedTags = 1
    table.HTMLtableCells {
      default.callRecursive = 1
      addChr10BetweenParagraphs = 1
    }
    
    nonTypoTagStdWrap.encapsLines {
      encapsTagList = div, col, p, pre, h1, h2, h3, h4, h5, h6
      remapTag.DIV >
      nonWrappedTag = P
      innerStdWrap_all.ifBlank = &nbsp;
      //addAttributes.P.class >
      addAttributes.COL.class = column
    }
  
    nonTypoTagStdWrap.HTMLparser = 1
    nonTypoTagStdWrap.HTMLparser {
      keepNonMatchedTags = 1
      htmlSpecialChars = 2
      xhtml_cleaning = 1
    }
  }
  
  entryHTMLparser_db = 1
  entryHTMLparser_db {

    //Tags allowed
    //Always use the same list of allowed tags.
    allowTags =< lib.parseFunc.allowTags

    //Tags denied
    //Make sure we can set rules on any tag listed in allowTags.
    denyTags = tbody

    //Avoid content being HSC'ed Twice
    htmlSpecialChars = 0

    tags {

      //Clean attributes for the following tags
      span.fixAttrib.style.unset = 0

      //Allow following attributes for the following tags
      p.fixAttrib.align.unset >
      div.fixAttrib.align.unset >
      p.allowedAttribs = class, style, align, id
      ol.allowedAttribs = class, start
      ul.allowedAttribs = class
      li.allowedAttribs = class, value
      br.allowedAttribs = class
      hr.allowedAttribs = class
      col.allowedAttribs = class, width
    }

    //REMOVE OPEN OFFICE META DATA TAGS AND DEPRECATED HTML TAGS
    //We use this rule instead of the denyTags rule so that we can
    //protect custom tags without protecting these unwanted tags.
   removeTags = center, font, o:p, sdfield, strike, u, sub, sup, tbody
   removeTags := removeFromList(col)
  
    //PROTECT CUSTOM TAGS
    keepNonMatchedTags = 1
    
    xhtml_cleaning = 1
  }

  exitHTMLparser_db = 1
  exitHTMLparser_db {

    // KEEP ALL TAGS
    // Unwanted tags were removed on entry.
    // Without this rule, the parser will remove all tags!
    //Presumably, this rule will be more efficient than repeating the 
allowTags rule

    allowTags =< lib.parseFunc.allowTags
    keepNonMatchedTags = 1
  
    //AVOID CONTENT BEING HSC'ed TWICE
    htmlSpecialChars = 0
  
    //remapping of i and b tags
    tags{
      //i.remap = em
      //b.remap = strong
      span.rmTagIfNoAttrib = 1
    }

  }
}

tt_content.table.20.innerStdWrap.parseFunc =< lib.ParseFunc

What I'm doing wrong? Could you be so kind to help me? Thanks a lot  in 
advance.

Caterina
Hello to everyone!

I have such a problem: when I'm pasting a table (its pure html code) 
into tinyRTE html source editor and press "Update", it stripes all tags 
"col" from this table. And these tags are needed there!! I'm using TYPO3 
4.2.1 with  tinyRTE 1.6.6 and CSS Styled Content 0.4.0.  In the site 
root page TS Config there are settings:

page.config.doctype = xhtml_trans
page.config.xmlprologue = none
page.config.xhtml_cleaning = all

//Default RTE processing rules

RTE.default.addParam {
   cleanup = true
   extended_valid_elements = 
"form[method|action],input[type|name],select[name],option[value|selected],hr[class|width|size|noshade],help,col[class|width],colgroup[class]"
   doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
   verify_html = true
   cleanup_on_startup = true
   apply_source_formatting = true
}


RTE.default.proc {

  //TRANSFORMATION METHOD - CSS Styled Content is used.
  overruleMode = ts_css
  //DO NOT CONVERT BR TAGS INTO LINEBREAKS
  dontConvBRtoParagraph = 1

  //preserve div sections - do not remap them to p
  preserveDIVSections = 1

  //tags allowed outside p and div

  allowTagsOutside = hr, address, ul, ol, li, img

  // tags allowed
  // Added to the default internal list:
  // But, for the sake of clarity, we use a complete list in alphabetic 
order.
  // center, font, strike, sdfield and  u will be removed on entry (see 
below).
  // b and i will be remapped on exit (see below).
  // Note that the link accessibility feature of htmlArea RTE does 
insert img tags.

  allowTags (

      p, div, table, thead, tfoot, tbody, col, colgroup, tr, td, th,
      blockquote, ol, ul, li, dl, dt, dd, img, hr, br, span, strong,
      em, object, param, script, a, pre, h1, h2, h3, h4, h5, h6, i, b,
      sub, sup, u, abbr, address, area, map, code, cite, del, dfn, q,
      samp, ins, kbd, caption

  )

  // tags denied
  // Make sure we can set rules on any tag listed in allowTags.

  denyTags >

  //allowed P & DIV attributes
  //Attributes class and align are always preserved
  //Align attribute will be unset on entry (see below)
  //This is a list of additional attributes to keep

  keepPDIVattribs = id, title, dir, lang, xml:lang

  //allow to write about HTML
  dontUndoHSC_db = 1
  dontHSC_rte = 1

  //Tags allowed outside p and div
  //Adding img tag to the default list

  proc.allowTagsOutside := addToList(img)

  //Do not remove img and col tags

  proc.entryHTMLparser_db.tags.img >
  proc.entryHTMLparser_db.tags.col >

  //CONTENT TO DATABASE Transformation Settings

  entryHTMLparser_db = 1
  entryHTMLparser_db {

    //Tags allowed
    //Always use the same list of allowed tags.
    allowTags < RTE.default.proc.allowTags

    //Tags denied
    //Make sure we can set rules on any tag listed in allowTags.
    denyTags >

    //Avoid content being HSC'ed Twice
    htmlSpecialChars = 0

    tags {

      //Clean attributes for the following tags
      //span.fixAttrib.style.unset = 1

      //Allow following attributes for the following tags
      p.fixAttrib.align.unset >
      div.fixAttrib.align.unset >
      p.allowedAttribs = class, style, align, id
      ol.allowedAttribs = class, start
      ol.fixAttrib.start.unset >
      ul.allowedAttribs = class
      li.allowedAttribs = class, value
      br.allowedAttribs = class
      hr.allowedAttribs = class
      col.allowedAttribs = class, width
    }

    //REMOVE OPEN OFFICE META DATA TAGS AND DEPRECATED HTML TAGS
    //We use this rule instead of the denyTags rule so that we can
    //protect custom tags without protecting these unwanted tags.
   removeTags = center, font, o:p, sdfield, strike, u, sub, sup
   removeTags := removeFromList(col)

    //PROTECT CUSTOM TAGS
    keepNonMatchedTags = 1
  
    xhtml_cleaning = 1
  }

  exitHTMLparser_db = 1
  exitHTMLparser_db {

    // KEEP ALL TAGS
    // Unwanted tags were removed on entry.
    // Without this rule, the parser will remove all tags!
    //Presumably, this rule will be more efficient than repeating the 
allowTags rule

    allowTags < RTE.default.proc.allowTags
    keepNonMatchedTags = 1

    //AVOID CONTENT BEING HSC'ed TWICE
    htmlSpecialChars = 0

    //remapping of i and b tags
    //tags{
    //  i.remap = em
     // b.remap = strong
      //span.rmTagIfNoAttrib = 1
   // }

  }

  entryHTMLparser_rte >
  entryHTMLparser_rte < entryHTMLparser_db

  exitHTMLparser_rte >
  exitHTMLparser_rte < exitHTMLparser_db
}

//RTE processing rules for bodytext column of tt_content table
//Erase settings from other extensions

RTE.config.tt_content.bodytext >
RTE.config.tt_content.table >

//Make sure we use ts_css transformation

RTE.config.tt_content.bodytext.proc.overruleMode = ts_css
RTE.config.tt_content.bodytext.types.text.proc.overruleMode = ts_css
RTE.config.tt_content.bodytext.types.textpic.proc.overruleMode = ts_css

In Page Template Setup there are settings:

page.config.doctype = xhtml_trans
page.config.xmlprologue = none
page.config.xhtmlDoctype = xhtml_trans
page.config.xhtml_cleaning = all

lib.parseFunc{
  allowTags (
    p, div, table, thead, tfoot, tbody, col, colgroup, tr, td, th,
    blockquote, ol, ul, li, dl, dt, dd, img, hr, br, span, strong,
    em, object, param, script, a, pre, h1, h2, h3, h4, h5, h6, i, b,
    sub, sup, u, abbr, address, area, map, code, cite, del, dfn, q,
    samp, ins, kbd, caption
   )
  denyTags = *
  
}
lib.parseFunc_RTE {
  allowTags < lib.parseFunc.allowTags
  denyTags < lib.parseFunc.denyTags
  
  //processing <table>, <blockquote>, <div>, <ol>
  //<ul> and <dl> blocks separately
  externalBlocks = table, blockquote, ol, ul, dl, div
  externalBlocks {
    //blockquote processing settings
    blockquote.stripNL = 0
    blockquote.callRecursive = 1
    blockquote.callRecursive.tagStdWrap.HTMLparser = 1
  
  blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs 
>
    
    ol.stripNL = 1
    ol.fixAttrib.start.unset = 0
    ol.allowedAttribs = start, class
    ol.stdWrap.ParseFunc =< lib.parseFunc
    
    ul.stripNL = 1
    ul.allowedAttribs = start, class
    ul.stdWrap.ParseFunc =< lib.parseFunc
    
    dl.stripNL = 1
    dl.allowedAttribs = start, class
    dl.stdWrap.ParseFunc =< lib.parseFunc
    
    table.stripNL = 1
    table.stdWrap.HTMLparser = 1
    table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
      always = 0
      list >
    }
    
    table.stdWrap.HTMLparser.tags{
      col = 1
      col.AllowedAttribs = class
    }
    
    table.stdWrap.HTMLparser.keepNonMatchedTags = 1
    table.HTMLtableCells {
      default.callRecursive = 1
      addChr10BetweenParagraphs = 1
    }
    
    nonTypoTagStdWrap.encapsLines {
      encapsTagList = div, col, p, pre, h1, h2, h3, h4, h5, h6
      remapTag.DIV >
      nonWrappedTag = P
      innerStdWrap_all.ifBlank = &nbsp;
      //addAttributes.P.class >
      addAttributes.COL.class = column
    }
  
    nonTypoTagStdWrap.HTMLparser = 1
    nonTypoTagStdWrap.HTMLparser {
      keepNonMatchedTags = 1
      htmlSpecialChars = 2
      xhtml_cleaning = 1
    }
  }
  
  entryHTMLparser_db = 1
  entryHTMLparser_db {

    //Tags allowed
    //Always use the same list of allowed tags.
    allowTags =< lib.parseFunc.allowTags

    //Tags denied
    //Make sure we can set rules on any tag listed in allowTags.
    denyTags = tbody

    //Avoid content being HSC'ed Twice
    htmlSpecialChars = 0

    tags {

      //Clean attributes for the following tags
      span.fixAttrib.style.unset = 0

      //Allow following attributes for the following tags
      p.fixAttrib.align.unset >
      div.fixAttrib.align.unset >
      p.allowedAttribs = class, style, align, id
      ol.allowedAttribs = class, start
      ul.allowedAttribs = class
      li.allowedAttribs = class, value
      br.allowedAttribs = class
      hr.allowedAttribs = class
      col.allowedAttribs = class, width
    }

    //REMOVE OPEN OFFICE META DATA TAGS AND DEPRECATED HTML TAGS
    //We use this rule instead of the denyTags rule so that we can
    //protect custom tags without protecting these unwanted tags.
   removeTags = center, font, o:p, sdfield, strike, u, sub, sup, tbody
   removeTags := removeFromList(col)
  
    //PROTECT CUSTOM TAGS
    keepNonMatchedTags = 1
    
    xhtml_cleaning = 1
  }

  exitHTMLparser_db = 1
  exitHTMLparser_db {

    // KEEP ALL TAGS
    // Unwanted tags were removed on entry.
    // Without this rule, the parser will remove all tags!
    //Presumably, this rule will be more efficient than repeating the 
allowTags rule

    allowTags =< lib.parseFunc.allowTags
    keepNonMatchedTags = 1
  
    //AVOID CONTENT BEING HSC'ed TWICE
    htmlSpecialChars = 0
  
    //remapping of i and b tags
    tags{
      //i.remap = em
      //b.remap = strong
      span.rmTagIfNoAttrib = 1
    }

  }
}

tt_content.table.20.innerStdWrap.parseFunc =< lib.ParseFunc

What I'm doing wrong? Please, could you be so kind to help me? Thanks a lot  in 
advance.

Caterina


      __________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html


More information about the TYPO3-english mailing list