basexf: Add XF categorized tags into: category, genre, characters, contenttags and formattags

This commit is contained in:
Jim Miller 2024-04-09 10:19:15 -05:00
parent ba3676d73f
commit e1cec84075
3 changed files with 30 additions and 4 deletions

View file

@ -749,7 +749,7 @@ author_avatar_cover:false
strip_chapter_numbers:false
## Copy title to tagsfromtitle for parsing tags.
add_to_extra_valid_entries:,tagsfromtitledetect,tagsfromtitle,forumtags,parentforums
add_to_extra_valid_entries:,tagsfromtitledetect,tagsfromtitle,forumtags,contenttags,formattags,parentforums
## '.NOREPL' tells the system to *not* apply title's
## in/exclude/replace_metadata -- Only works on include_in_ lines.
@ -758,6 +758,11 @@ include_in_tagsfromtitle:tagsfromtitledetect
tagsfromtitle_label:Tags from Title
forumtags_label:Tags from Forum
## Note that forumtags also contains tags populated into category,
## genre, characters, contenttags and formattags
contenttags_label:Content Tags from Forum
formattags_label:Format Tags from Forum
parentforums_label:Parent Forums
keep_in_order_parentforums:true
@ -816,7 +821,8 @@ add_to_extra_titlepage_entries:,tagsfromtitle,forumtags
## XenForo tags are all lowercase everywhere that I've seen. This
## makes the first letter of each word uppercase. Applied before
## replace_metadata.
## replace_metadata. Also applies to category, genre, characters,
## contenttags and formattags collected from site tags.
capitalize_forumtags:true
## Add forumtags to standard entry genre and tagsfromtitle to

View file

@ -585,10 +585,24 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
if use_threadmark_chaps or self.getConfig('always_use_forumtags'):
## only use tags if threadmarks for chapters or always_use_forumtags is on.
tagmap = {
'Setting':'category',
'Genre':'genre',
'Character':'characters',
'Content':'contenttags',
'Format':'formattags',
}
for tag in self.get_forumtags(topsoup):
tagcat = tag.select_one("i")
tstr = stripHTML(tag)
if self.getConfig('capitalize_forumtags'):
tstr = title(tstr)
if tagcat:
tagname = tagmap[tagcat['title']]
logger.debug("Forum Tag(%s) Cat(%s) list(%s)"%(stripHTML(tag),tagcat['title'],tagname))
self.story.addToList(tagname,tstr)
else:
logger.debug("Forum Tag(%s) Uncategorized"%stripHTML(tag))
self.story.addToList('forumtags',tstr)
# author moved down here to take from post URLs.

View file

@ -741,7 +741,7 @@ author_avatar_cover:false
strip_chapter_numbers:false
## Copy title to tagsfromtitle for parsing tags.
add_to_extra_valid_entries:,tagsfromtitledetect,tagsfromtitle,forumtags,parentforums
add_to_extra_valid_entries:,tagsfromtitledetect,tagsfromtitle,forumtags,contenttags,formattags,parentforums
## '.NOREPL' tells the system to *not* apply title's
## in/exclude/replace_metadata -- Only works on include_in_ lines.
@ -750,6 +750,11 @@ include_in_tagsfromtitle:tagsfromtitledetect
tagsfromtitle_label:Tags from Title
forumtags_label:Tags from Forum
## Note that forumtags also contains tags populated into category,
## genre, characters, contenttags and formattags
contenttags_label:Content Tags from Forum
formattags_label:Format Tags from Forum
parentforums_label:Parent Forums
keep_in_order_parentforums:true
@ -808,7 +813,8 @@ add_to_extra_titlepage_entries:,tagsfromtitle,forumtags
## XenForo tags are all lowercase everywhere that I've seen. This
## makes the first letter of each word uppercase. Applied before
## replace_metadata.
## replace_metadata. Also applies to category, genre, characters,
## contenttags and formattags collected from site tags.
capitalize_forumtags:true
## Add forumtags to standard entry genre and tagsfromtitle to