View Single Post
Old 09-25-2010, 09:49 AM   #1
JohnsonZA
Member
JohnsonZA began at the beginning.
 
Posts: 10
Karma: 12
Join Date: Sep 2010
Device: Kindle 3 3G+Wifi
keeping or removing a div with multiple classes

I'm using keep_only_tags and remove_tags in a recipe for a site using divs with multiple classes like so:
Code:
<div class="article right">blah</div>
I'm struggling to keep the div based on its "article" class.

This is what I've tried, but it doesn't work:
Code:
keep_only_tags = [
    dict(name='div', attrs={'class':['article']})
]
It only works if I put the both class names like so:
Code:
keep_only_tags = [
    dict(name='div', attrs={'class':['article right']})
]
I've tried wildcards ('article.*'), but that doesn't seem to work either.

Any one have ideas?
JohnsonZA is offline   Reply With Quote