Add reveal_invisible_text option to base_xenforoforum_adapter.

This commit is contained in:
Jim Miller 2021-07-21 11:28:23 -05:00
parent 5c3a8931ed
commit 48065e5d83
4 changed files with 16 additions and 0 deletions

View file

@ -892,6 +892,11 @@ use_threadmark_wordcounts:true
## treat both threadmarks *and* first post links as chapter links.
#always_include_first_post_chapters:false
## When reveal_invisible_text is set true, adapter will search for
## <span style="color:transparent"> tags and remove the style
## attribute.
#reveal_invisible_text:false
[base_xenforoforum:epub]
## See remove_spoilers above for more about 'spoilers'. This example

View file

@ -767,6 +767,10 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
div.button.extract()
def _do_utf8FromSoup(self,url,soup,fetch=None,allow_replace_br_with_p=True):
if self.getConfig('reveal_invisible_text'):
## when set, remove style='color:transparent'.
for span in soup.find_all('span',style='color:transparent'):
del span['style']
if self.getConfig('replace_failed_smilies_with_alt_text'):
for img in soup.find_all('img',src=re.compile(r'(^data:image|(failedtoload|clear.png)$)')):
# logger.debug("replace_failed_smilies_with_alt_text img: %s"%img)

View file

@ -281,6 +281,7 @@ def get_valid_set_options():
'use_threadmark_wordcounts':(base_xenforo_list,None,boollist),
'always_include_first_post_chapters':(base_xenforo_list,None,boollist),
'order_threadmarks_by_date':(base_xenforo_list,None,boollist),
'reveal_invisible_text':(base_xenforo_list,None,boollist),
'use_threadmarks_description':(base_xenforo2_list,None,boollist),
'use_threadmarks_status':(base_xenforo2_list,None,boollist),
'use_threadmarks_cover':(base_xenforo2_list,None,boollist),
@ -520,6 +521,7 @@ def get_valid_keywords():
'use_threadmark_wordcounts',
'always_include_first_post_chapters',
'order_threadmarks_by_date',
'reveal_invisible_text',
'use_threadmarks_description',
'use_threadmarks_status',
'use_threadmarks_cover',

View file

@ -910,6 +910,11 @@ use_threadmark_wordcounts:true
## treat both threadmarks *and* first post links as chapter links.
#always_include_first_post_chapters:false
## When reveal_invisible_text is set true, adapter will search for
## <span style="color:transparent"> tags and remove the style
## attribute.
#reveal_invisible_text:false
[base_xenforoforum:epub]
## See remove_spoilers above for more about 'spoilers'. This example