Changeset 452

Show
Ignore:
Timestamp:
Wed Dec 6 14:54:11 2006
Author:
effbot
Message:

ignore declarations and processing instructions

Files:

Legend:

Unmodified
Added
Removed
Modified
  • stuff/sandbox/elementlib/ElementSoup.py

    r433 r452  
    5 5 import BeautifulSoup as BS  
    6 6  
      7 # soup classes that are left out of the tree  
      8 ignorable_soup = BS.Comment, BS.Declaration, BS.ProcessingInstruction  
      9  
    7 10 # slightly silly  
    8 11 try:  
     
    51 54     def emit(soup):  
    52 55         if isinstance(soup, BS.NavigableString):  
    53               if isinstance(soup, BS.Comment):  
      56             if isinstance(soup, ignorable_soup):  
    53 56                 return  
    54 57             bob.data(unescape(soup))