Fixes for poor '\' escapes that give SyntaxWarning

This commit is contained in:
Jim Miller 2023-10-13 17:51:52 -05:00
parent 91f2f84c10
commit b1b2451fa6
4 changed files with 5 additions and 5 deletions

View file

@ -1100,7 +1100,7 @@ class FanFicFarePlugin(InterfaceAction):
## Changed Sep 2021, adapter_fanfictionnet is keeping title in
## storyURL now, but if the story title changes, the Jan
## solution wasn't finding the existing story.
if "\.fanfiction\.net" in regexp:
if r"\.fanfiction\.net" in regexp:
regexp = re.sub(r"^(?P<keep>.*net/s/\d+/\d+/)(?P<urltitle>[^\$]*)?",
r"\g<keep>(.*)",regexp)
# logger.debug(regexp)

View file

@ -95,7 +95,7 @@ class IniHighlighter(QSyntaxHighlighter):
if sections:
# *known* sections
resections = r'('+(r'|'.join(sections))+r')'
resections = resections.replace('.','\.') #escape dots.
resections = resections.replace('.',r'\.') #escape dots.
self.highlightingRules.append( HighlightingRule( r"^\["+resections+r"\]\s*$", colors['knownsections'], QFontBold, blocknum=2 ) )
# test story sections

View file

@ -499,9 +499,9 @@ class StoriesOnlineNetAdapter(BaseSiteAdapter):
def getMoreText(self, html):
try:
story_id = int(re.compile('var story_id=(\d+)').findall(html)[0])
story_id = int(re.compile(r'var story_id=(\d+)').findall(html)[0])
try:
pid = re.compile('var pid=(\d+)').findall(html)[0]
pid = re.compile(r'var pid=(\d+)').findall(html)[0]
except:
pid = 'undefined'
ci = re.compile("var ci='([^']+)'").findall(html)[0]

View file

@ -638,7 +638,7 @@ chireads_html_chapter_return = """
//]]></script>
<script type='text/javascript' src='https://chireads.com/wp-content/plugins/disqus-comment-system/public/js/comment_count.js?ver=3.0.17'></script>
<script type='text/javascript'>//<![CDATA[
var embedVars={"disqusConfig":{"integration":"wordpress 3.0.17"},"disqusIdentifier":"21111 https:\/\/www.chireads.com\/2020\/02\/08\/chapitre-1-ombre-mysterieuse\/","disqusShortname":"chireads","disqusTitle":"Chapitre 1 \u2013 Ombre myst\u00e9rieuse","disqusUrl":"https:\/\/chireads.com\/translatedtales\/chapitre-1-ombre-mysterieuse\/2020\/02\/08\/","postId":"21111"};
var embedVars={"disqusConfig":{"integration":"wordpress 3.0.17"},"disqusIdentifier":"21111 https://www.chireads.com/2020/02/08/chapitre-1-ombre-mysterieuse/","disqusShortname":"chireads","disqusTitle":"Chapitre 1 \u2013 Ombre myst\u00e9rieuse","disqusUrl":"https://chireads.com/translatedtales/chapitre-1-ombre-mysterieuse/2020/02/08/","postId":"21111"};
//]]></script>
<script type='text/javascript'>//<![CDATA[
var disqus_url=embedVars.disqusUrl;var disqus_identifier=embedVars.disqusIdentifier;var disqus_container_id='disqus_thread';var disqus_shortname=embedVars.disqusShortname;var disqus_title=embedVars.disqusTitle;var disqus_config_custom=window.disqus_config;var disqus_config=function(){var dsqConfig=embedVars.disqusConfig;this.page.integration=dsqConfig.integration;this.page.remote_auth_s3=dsqConfig.remote_auth_s3;this.page.api_key=dsqConfig.api_key;this.sso=dsqConfig.sso;this.language=dsqConfig.language;if(disqus_config_custom)disqus_config_custom.call(this);};(function(){var dsq=document.createElement('script');dsq.type='text/javascript';dsq.async=true;dsq.src='https://'+disqus_shortname+'.disqus.com/embed.js';(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(dsq);})();