mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Merge branch 'patch-link' into 'master'
don't link non-link links See merge request chicken-riders/rcgcdb!12
This commit is contained in:
commit
97817daf9b
|
@ -34,7 +34,6 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c
|
||||||
author_url = link_formatter(create_article_path("User:{user}".format(user=change["user"]), WIKI_ARTICLE_PATH))
|
author_url = link_formatter(create_article_path("User:{user}".format(user=change["user"]), WIKI_ARTICLE_PATH))
|
||||||
author = change["user"]
|
author = change["user"]
|
||||||
parsed_comment = "" if parsed_comment is None else " *("+parsed_comment+")*"
|
parsed_comment = "" if parsed_comment is None else " *("+parsed_comment+")*"
|
||||||
parsed_comment = re.sub(r"([^<]|\A)(http(s)://.*?)( |\Z)", "\\1<\\2>\\4", parsed_comment) # see #97
|
|
||||||
if action in ["edit", "new"]:
|
if action in ["edit", "new"]:
|
||||||
edit_link = link_formatter("{wiki}index.php?title={article}&curid={pageid}&diff={diff}&oldid={oldrev}".format(
|
edit_link = link_formatter("{wiki}index.php?title={article}&curid={pageid}&diff={diff}&oldid={oldrev}".format(
|
||||||
wiki=WIKI_SCRIPT_PATH, pageid=change["pageid"], diff=change["revid"], oldrev=change["old_revid"],
|
wiki=WIKI_SCRIPT_PATH, pageid=change["pageid"], diff=change["revid"], oldrev=change["old_revid"],
|
||||||
|
|
|
@ -39,13 +39,13 @@ class LinkParser(HTMLParser):
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
if self.recent_href:
|
if self.recent_href:
|
||||||
self.new_string = self.new_string + "[{}](<{}>)".format(data, self.recent_href)
|
self.new_string = self.new_string + "[{}](<{}>)".format(data.replace("//", "/\\/"), self.recent_href)
|
||||||
self.recent_href = ""
|
self.recent_href = ""
|
||||||
else:
|
else:
|
||||||
self.new_string = self.new_string + data
|
self.new_string = self.new_string + data.replace("//", "/\\/")
|
||||||
|
|
||||||
def handle_comment(self, data):
|
def handle_comment(self, data):
|
||||||
self.new_string = self.new_string + data
|
self.new_string = self.new_string + data.replace("//", "/\\/")
|
||||||
|
|
||||||
def handle_endtag(self, tag):
|
def handle_endtag(self, tag):
|
||||||
# logger.debug(self.new_string)
|
# logger.debug(self.new_string)
|
||||||
|
|
Loading…
Reference in a new issue