mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-22 00:33:59 +01:00
base_xenforoforum: Adding date, words & kwords per chapter metadata.
This commit is contained in:
parent
ffee4aa495
commit
f1e66f247e
4 changed files with 48 additions and 4 deletions
|
|
@ -675,6 +675,22 @@ always_use_forumtags:false
|
|||
## be included in the word count if not also threadmarked.
|
||||
use_threadmark_wordcounts:true
|
||||
|
||||
## base_xenforoforum stories with threadmarks have a few additional
|
||||
## pieces of metadata available that most adapters don't. 'date';
|
||||
## 'words'--word count as number only: "12104"; and kwords--the
|
||||
## threadmark human-readable string for word count with parens:
|
||||
## "(12.1k)" These can be used with custom output (see
|
||||
## https://github.com/JimmXinu/FanFicFare/wiki/CustomOutput ) or with
|
||||
## chapter_title_*_pattern settings.
|
||||
## Example:
|
||||
#tocpage_entry:
|
||||
# <a href="#section${index}">${chapter}</a> ${date} ${kwords}<br />
|
||||
|
||||
## The 'date' value for chapters mentioned above can be formated with
|
||||
## datethreadmark_format. Otherwise it will default to
|
||||
## dateCreated_format
|
||||
#datethreadmark_format:%%Y-%%m-%%d %%H:%%M
|
||||
|
||||
[base_xenforoforum:epub]
|
||||
|
||||
## See remove_spoilers above for more about 'spoilers'. This example
|
||||
|
|
|
|||
|
|
@ -266,14 +266,20 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
|
|||
date = self.make_date(atag.find_next_sibling('div',{'class':'extra'}))
|
||||
if atag.parent.has_attr('data-words'):
|
||||
words = int(atag.parent['data-words'])
|
||||
if "(" in atag.next_sibling:
|
||||
kwords = atag.next_sibling.strip()
|
||||
# logger.debug("%s"%kwords)
|
||||
else:
|
||||
words = None
|
||||
words = ""
|
||||
kwords = ""
|
||||
threadmarks.append({"tmcat_name":tmcat_name,
|
||||
"tmcat_num":tmcat_num,
|
||||
"tmcat_index":tmcat_index,
|
||||
"title":name,
|
||||
"url":self.getURLPrefix()+"/"+url,"date":date,
|
||||
"words":words})
|
||||
"url":self.getURLPrefix()+"/"+url,
|
||||
"date":date,
|
||||
"words":words,
|
||||
"kwords":kwords})
|
||||
|
||||
return threadmarks
|
||||
|
||||
|
|
@ -350,7 +356,12 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
|
|||
if 'tmcat_num' in tm and 'tmcat_index' in tm:
|
||||
self.threadmarks_for_reader[self.normalize_chapterurl(tm['url'])] = (tm['tmcat_num'],tm['tmcat_index'])
|
||||
|
||||
added = self.add_chapter(prepend+tm['title'],tm['url'])
|
||||
## threadmark date, words available for chapter custom output
|
||||
## date formate from datethreadmark_format or dateCreated_format
|
||||
## then a basic default.
|
||||
added = self.add_chapter(prepend+tm['title'],tm['url'],{'date':tm['date'].strftime(self.getConfig("datethreadmark_format",self.getConfig("dateCreated_format","%Y-%m-%d %H:%M:%S"))),
|
||||
'words':tm['words'],
|
||||
'kwords':tm['kwords']})
|
||||
if added and tm.get('words',None):
|
||||
words = words + tm['words']
|
||||
|
||||
|
|
|
|||
|
|
@ -457,6 +457,7 @@ def get_valid_keywords():
|
|||
'internalize_text_links',
|
||||
'replace_failed_smilies_with_alt_text',
|
||||
'use_threadmark_wordcounts',
|
||||
'datethreadmark_format',
|
||||
'fix_pseudo_html',
|
||||
'fix_excess_space',
|
||||
'ignore_chapter_url_list',
|
||||
|
|
|
|||
|
|
@ -702,6 +702,22 @@ always_use_forumtags:false
|
|||
## be included in the word count if not also threadmarked.
|
||||
use_threadmark_wordcounts:true
|
||||
|
||||
## base_xenforoforum stories with threadmarks have a few additional
|
||||
## pieces of metadata available that most adapters don't. 'date';
|
||||
## 'words'--word count as number only: "12104"; and kwords--the
|
||||
## threadmark human-readable string for word count with parens:
|
||||
## "(12.1k)" These can be used with custom output (see
|
||||
## https://github.com/JimmXinu/FanFicFare/wiki/CustomOutput ) or with
|
||||
## chapter_title_*_pattern settings.
|
||||
## Example:
|
||||
#tocpage_entry:
|
||||
# <a href="#section${index}">${chapter}</a> ${date} ${kwords}<br />
|
||||
|
||||
## The 'date' value for chapters mentioned above can be formated with
|
||||
## datethreadmark_format. Otherwise it will default to
|
||||
## dateCreated_format
|
||||
#datethreadmark_format:%%Y-%%m-%%d %%H:%%M
|
||||
|
||||
[base_xenforoforum:epub]
|
||||
|
||||
## See remove_spoilers above for more about 'spoilers'. This example
|
||||
|
|
|
|||
Loading…
Reference in a new issue