mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-01-03 22:53:24 +01:00
Add include_dice_rolls option
This commit is contained in:
parent
c7e716eaa0
commit
d97c4607a1
4 changed files with 45 additions and 5 deletions
|
|
@ -903,7 +903,7 @@ use_threadmark_wordcounts:true
|
|||
|
||||
[base_xenforo2forum]
|
||||
## [base_xenforoforum] also applied, but [base_xenforo2forum] takes
|
||||
## precedence. SV & SB only as of Oct 2019.
|
||||
## precedence.
|
||||
|
||||
## Some additional 'thread' metadata entries.
|
||||
add_to_extra_valid_entries:,threadmarks_title,threadmarks_description,threadmarks_status
|
||||
|
|
@ -940,6 +940,19 @@ use_threadmarks_cover:true
|
|||
## this was implemented.
|
||||
skip_sticky_first_posts:true
|
||||
|
||||
## SV/SB sites include a dice roller that can attach dice roll results
|
||||
## to a post. These are outside the actual post text. Setting
|
||||
## include_dice_rolls:true will include a text version of those rolls
|
||||
## in the FFF chapter that should be usable for all ebook readers.
|
||||
## Setting include_dice_rolls:svg will keep the inline <svg> images of
|
||||
## the rolls. It is the user's responsibility to also add
|
||||
## add_to_keep_html_attrs and add_to_output_css settings to make them
|
||||
## appear correctly. (include_dice_rolls:svg did *not* work in most
|
||||
## ebook readers I tested with, even with appropriate attributes and
|
||||
## css.)
|
||||
## NOTE: SV requires login (always_login:true) to see dice rolls.
|
||||
#include_dice_rolls:false
|
||||
|
||||
[epub]
|
||||
|
||||
## Each output format has a section that overrides [defaults]
|
||||
|
|
|
|||
|
|
@ -177,7 +177,19 @@ class BaseXenForo2ForumAdapter(BaseXenForoForumAdapter):
|
|||
return self.get_post_body(self.get_first_post(topsoup))
|
||||
|
||||
def get_post_body(self,souptag):
|
||||
return souptag.find('article',{'class':'message-body'}).find('div',{'class':'bbWrapper'})
|
||||
body = souptag.find('article',{'class':'message-body'}).find('div',{'class':'bbWrapper'})
|
||||
fieldset = body.find_next_sibling('fieldset',class_='dice_container')
|
||||
if fieldset and self.getConfig('include_dice_rolls',False):
|
||||
body.append(fieldset.extract())
|
||||
## If include_dice_rolls:svg, keep the <svg>
|
||||
## up to the user to include
|
||||
## add_to_keep_html_attrs:,style,xmlns,height,width,d,x,y,transform,text-anchor,cx,cy,r
|
||||
if self.getConfig('include_dice_rolls') != 'svg':
|
||||
for d in fieldset.find_all('svg'):
|
||||
result = d.select_one('title').extract()
|
||||
result.name='span'
|
||||
d.replace_with(result)
|
||||
return body
|
||||
|
||||
def get_post_created_date(self,souptag):
|
||||
return self.make_date(souptag.find('div', {'class':'message-date'}))
|
||||
|
|
|
|||
|
|
@ -154,11 +154,11 @@ def get_valid_list_entries():
|
|||
boollist=['true','false']
|
||||
base_xenforo2_list=['base_xenforo2forum',
|
||||
'forums.sufficientvelocity.com',
|
||||
'forums.spacebattles.com',
|
||||
'www.alternatehistory.com',
|
||||
]
|
||||
base_xenforo_list=base_xenforo2_list+['base_xenforoforum',
|
||||
'forums.spacebattles.com',
|
||||
'forum.questionablequesting.com',
|
||||
'www.alternatehistory.com',
|
||||
]
|
||||
def get_valid_set_options():
|
||||
'''
|
||||
|
|
@ -282,6 +282,7 @@ def get_valid_set_options():
|
|||
'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),
|
||||
'include_dice_rolls':(base_xenforo2_list,None,boollist+['svg']),
|
||||
'fix_pseudo_html': (['webnovel.com'], None, boollist),
|
||||
'fix_excess_space': (['novelonlinefull.com', 'novelall.com'], ['epub', 'html'], boollist),
|
||||
'dedup_order_chapter_list': (['wuxiaworld.co', 'novelupdates.cc'], None, boollist),
|
||||
|
|
@ -514,6 +515,7 @@ def get_valid_keywords():
|
|||
'use_threadmarks_status',
|
||||
'use_threadmarks_cover',
|
||||
'skip_sticky_first_posts',
|
||||
'include_dice_rolls',
|
||||
'datethreadmark_format',
|
||||
'fix_pseudo_html',
|
||||
'fix_excess_space',
|
||||
|
|
|
|||
|
|
@ -921,7 +921,7 @@ use_threadmark_wordcounts:true
|
|||
|
||||
[base_xenforo2forum]
|
||||
## [base_xenforoforum] also applied, but [base_xenforo2forum] takes
|
||||
## precedence. SV & SB only as of Oct 2019.
|
||||
## precedence.
|
||||
|
||||
## Some additional 'thread' metadata entries.
|
||||
add_to_extra_valid_entries:,threadmarks_title,threadmarks_description,threadmarks_status
|
||||
|
|
@ -958,6 +958,19 @@ use_threadmarks_cover:true
|
|||
## this was implemented.
|
||||
skip_sticky_first_posts:true
|
||||
|
||||
## SV/SB sites include a dice roller that can attach dice roll results
|
||||
## to a post. These are outside the actual post text. Setting
|
||||
## include_dice_rolls:true will include a text version of those rolls
|
||||
## in the FFF chapter that should be usable for all ebook readers.
|
||||
## Setting include_dice_rolls:svg will keep the inline <svg> images of
|
||||
## the rolls. It is the user's responsibility to also add
|
||||
## add_to_keep_html_attrs and add_to_output_css settings to make them
|
||||
## appear correctly. (include_dice_rolls:svg did *not* work in most
|
||||
## ebook readers I tested with, even with appropriate attributes and
|
||||
## css.)
|
||||
## NOTE: SV requires login (always_login:true) to see dice rolls.
|
||||
#include_dice_rolls:false
|
||||
|
||||
[epub]
|
||||
|
||||
## Each output format has a section that overrides [defaults]
|
||||
|
|
|
|||
Loading…
Reference in a new issue