mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-05 11:00:47 +02:00
Add base_xenforo2forum feature skip_sticky_first_posts(on by default).
This commit is contained in:
parent
908da5744b
commit
7e81930a56
4 changed files with 25 additions and 1 deletions
|
|
@ -847,6 +847,13 @@ use_threadmarks_status:true
|
|||
## be used to fill in the cover image. Set true by default.
|
||||
use_threadmarks_cover:true
|
||||
|
||||
## Sometimes there's a sticky post first (often a Staff Post?) rather
|
||||
## than the true first post by the Original Poster, AKA author. By
|
||||
## default, base_xenforo2forum will skip up to two sticky first posts.
|
||||
## Configurable due to the extremely small sample size available when
|
||||
## this was implemented.
|
||||
skip_sticky_first_posts:true
|
||||
|
||||
[epub]
|
||||
|
||||
## Each output format has a section that overrides [defaults]
|
||||
|
|
|
|||
|
|
@ -159,7 +159,15 @@ class BaseXenForo2ForumAdapter(BaseXenForoForumAdapter):
|
|||
self.post_cache[post['data-content']] = post
|
||||
|
||||
def get_first_post(self,topsoup):
|
||||
return topsoup.find('article',{'class':'message--post'})
|
||||
# limit=3 is an arbitrary assumption.
|
||||
posts = topsoup.find_all('article',{'class':'message--post'},limit=3)
|
||||
if self.getConfig("skip_sticky_first_posts",True):
|
||||
# don't use sticky first post (assumed to be Staff Post)
|
||||
for p in posts:
|
||||
if 'sticky-container' not in p['class']:
|
||||
return p
|
||||
logger.warn("First X posts all sticky? Using first-first post.")
|
||||
return posts[0]
|
||||
|
||||
def get_first_post_body(self,topsoup):
|
||||
return self.get_post_body(self.get_first_post(topsoup))
|
||||
|
|
|
|||
|
|
@ -271,6 +271,7 @@ def get_valid_set_options():
|
|||
'use_threadmarks_description':(base_xenforo2_list,None,boollist),
|
||||
'use_threadmarks_status':(base_xenforo2_list,None,boollist),
|
||||
'use_threadmarks_cover':(base_xenforo2_list,None,boollist),
|
||||
'skip_sticky_first_posts':(base_xenforo2_list,None,boollist),
|
||||
'fix_pseudo_html': (['webnovel.com'], None, boollist),
|
||||
'fix_excess_space': (['novelonlinefull.com', 'novelall.com'], ['epub', 'html'], boollist)
|
||||
}
|
||||
|
|
@ -486,6 +487,7 @@ def get_valid_keywords():
|
|||
'use_threadmarks_description',
|
||||
'use_threadmarks_status',
|
||||
'use_threadmarks_cover',
|
||||
'skip_sticky_first_posts',
|
||||
'datethreadmark_format',
|
||||
'fix_pseudo_html',
|
||||
'fix_excess_space',
|
||||
|
|
|
|||
|
|
@ -874,6 +874,13 @@ use_threadmarks_status:true
|
|||
## be used to fill in the cover image. Set true by default.
|
||||
use_threadmarks_cover:true
|
||||
|
||||
## Sometimes there's a sticky post first (often a Staff Post?) rather
|
||||
## than the true first post by the Original Poster, AKA author. By
|
||||
## default, base_xenforo2forum will skip up to two sticky first posts.
|
||||
## Configurable due to the extremely small sample size available when
|
||||
## this was implemented.
|
||||
skip_sticky_first_posts:true
|
||||
|
||||
[epub]
|
||||
|
||||
## Each output format has a section that overrides [defaults]
|
||||
|
|
|
|||
Loading…
Reference in a new issue