From 4397b58fe8d6db5265d858761754bf3a93c6bc7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= <matma.rex@gmail.com>
Date: Sat, 29 Apr 2023 15:04:03 +0200
Subject: [PATCH 2/3] Remove broken link processing for the matched text

These regular expressions only match HTTP links. If no one noticed
that it's not working since we switched to HTTPS in 2015, then this
can't be important.

Change-Id: Ic48b83bf72785cbbd6d01ec763049d7e2a165cb2
---
 includes/DoubleWiki.php | 23 -----------------------
 1 file changed, 23 deletions(-)

diff --git a/includes/DoubleWiki.php b/includes/DoubleWiki.php
index ff632bc..4f33b35 100644
--- a/includes/DoubleWiki.php
+++ b/includes/DoubleWiki.php
@@ -131,29 +131,6 @@ class DoubleWiki implements OutputPageBeforeHTMLHook, BeforePageDisplayHook {
 	 * @return string[] (new text, new translation)
 	 */
 	private function getMangledTextAndTranslation( string $text, string $translation, string $matchLangCode ): array {
-		/**
-		 * first find all links that have no 'class' parameter.
-		 * these links are local so we add '?match=xx' to their url,
-		 * unless it already contains a '?'
-		 */
-		$translation = preg_replace(
-			"/<a href=\"http:\/\/([^\"\?]*)\"(([\s]+)(c(?!lass=)|[^c\>\s])([^\>\s]*))*\>/i",
-			"<a href=\"http://\\1?match={$this->contentLanguage->getCode()}\"\\2>",
-			$translation
-		);
-		// now add class='extiw' to these links
-		$translation = preg_replace(
-			"/<a href=\"http:\/\/([^\"]*)\"(([\s]+)(c(?!lass=)|[^c\>\s])([^\>\s]*))*\>/i",
-			"<a href=\"http://\\1\" class=\"extiw\"\\3>",
-			$translation
-		);
-		// use class='extiw' for images too
-		$translation = preg_replace(
-			"/<a href=\"http:\/\/([^\"]*)\"([^\>]*)class=\"image\"([^\>]*)\>/i",
-			"<a href=\"http://\\1\"\\2class=\"extiw\"\\3>",
-			$translation
-		);
-
 		// add prefixes to internal links, in order to prevent duplicates
 		$translation = preg_replace(
 			"/<a href=\"#(.*?)\"/i",
-- 
2.28.0.windows.1

