mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2026-05-08 04:23:01 +02:00
Fix title casing for base_xenforo feature capitalize_forumtags.
This commit is contained in:
parent
dffb4d3168
commit
741bc126d2
1 changed files with 6 additions and 1 deletions
|
|
@ -467,7 +467,7 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
|
|||
for tag in self.get_forumtags(topsoup):
|
||||
tstr = stripHTML(tag)
|
||||
if self.getConfig('capitalize_forumtags'):
|
||||
tstr = tstr.title()
|
||||
tstr = title(tstr)
|
||||
self.story.addToList('forumtags',tstr)
|
||||
|
||||
# author moved down here to take from post URLs.
|
||||
|
|
@ -720,3 +720,8 @@ class BaseXenForoForumAdapter(BaseSiteAdapter):
|
|||
if img.has_attr('longdesc'):
|
||||
del img['longdesc']
|
||||
return super(BaseXenForoForumAdapter, self)._do_utf8FromSoup(url,soup,fetch,allow_replace_br_with_p)
|
||||
|
||||
# from https://daviseford.com/blog/2017/04/27/python-string-to-title-including-punctuation.html
|
||||
# fixes englisher contractions being title cased incorrectly.
|
||||
def title(title):
|
||||
return re.sub(r"(?<=[a-z])[\']([A-Z])", lambda x: x.group().lower(), title.title())
|
||||
|
|
|
|||
Loading…
Reference in a new issue