Add capitalize_forumtags feature to base_xenforoforum and include forumtags by default.

This commit is contained in:
Jim Miller
2015-10-07 11:17:43 -05:00
parent 801e14e028
commit f3af754c71
3 changed files with 26 additions and 9 deletions
+11 -4
View File
@@ -406,19 +406,26 @@ add_to_replace_metadata:
# change (spaces)slash(or semicolon)(spaces) to comma
tagsfromtitle=> *[/;] *=>,
tagsfromtitle=> [xX] =>,
# remove [] or () blocks and leading/trailing spaces/dashes/colons
title=>[-: ]*[\(\[]([^\]\)]+)[\)\]][-: ]*=>
# remove 'Thread' and the next word, usually "Thread 2", "Thread
# four", "Thread iv", "Story Thread", etc
title,tagsfromtitle=>[-: ]*(Story *)?[Tt]hread [^ ]+[-: ]*=>
# Normalize 'fanfiction/fanfic/fan-fiction' a little.
forumtags=>[Ff]an-?[Ff]ic(tion)?=>FanFiction
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.
capitalize_forumtags:true
## Add both title tags and forumtags to standard (subject) tags.
## '.SPLIT' tells the system to split by ','
add_to_include_subject_tags:,tagsfromtitle.SPLIT
## Or to also include forumtags add this to personal.ini:
#add_to_include_subject_tags:,forumtags
add_to_include_subject_tags:,tagsfromtitle.SPLIT,forumtags
## base_xenforoforum reads Published and Updated datetimes from
## Threadmarks if used, or from the posted & updated times of the
@@ -177,7 +177,10 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
## only use tags if threadmarks for chapters.
## a bit arbitrary, but likely.
for tag in soup.findAll('a',{'class':'tag'}):
self.story.addToList('forumtags',stripHTML(tag))
tstr = stripHTML(tag)
if self.getConfig('capitalize_forumtags'):
tstr = tstr.title()
self.story.addToList('forumtags',tstr)
soup = soup.find('li',{'class':'message'}) # limit first post for date stuff below. ('#' posts above)
+11 -4
View File
@@ -405,19 +405,26 @@ add_to_replace_metadata:
# change (spaces)slash(or semicolon)(spaces) to comma
tagsfromtitle=> *[/;] *=>,
tagsfromtitle=> [xX] =>,
# remove [] or () blocks and leading/trailing spaces/dashes/colons
title=>[-: ]*[\(\[]([^\]\)]+)[\)\]][-: ]*=>
# remove 'Thread' and the next word, usually "Thread 2", "Thread
# four", "Thread iv", "Story Thread", etc
title,tagsfromtitle=>[-: ]*(Story *)?[Tt]hread [^ ]+[-: ]*=>
# Normalize 'fanfiction/fanfic/fan-fiction' a little.
forumtags=>[Ff]an-?[Ff]ic(tion)?=>FanFiction
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.
capitalize_forumtags:true
## Add both title tags and forumtags to standard (subject) tags.
## '.SPLIT' tells the system to split by ','
add_to_include_subject_tags:,tagsfromtitle.SPLIT
## Or to also include forumtags add this to personal.ini:
#add_to_include_subject_tags:,forumtags
add_to_include_subject_tags:,tagsfromtitle.SPLIT,forumtags
## base_xenforoforum reads Published and Updated datetimes from
## Threadmarks if used, or from the posted & updated times of the