Skip to content

Commit

Permalink
Merge pull request #7 from extrasec/patch-1
Browse files Browse the repository at this point in the history
Update action.php for preventing alignments of table cells from alte…
  • Loading branch information
NetaliDev authored Feb 1, 2023
2 parents a655a96 + 7c99a9b commit c6c5ded
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions action.php
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,17 @@ private function insert_ignore_tags($text): string {
$text = preg_replace('/\{\{([\s\S]*?)(\?[\s\S]*?)?((\|)([\s\S]*?))?}}/', '<ignore>{{${1}${2}${4}</ignore>${5}<ignore>}}</ignore>', $text);

// prevent deepl from messing with tables
$text = str_replace(" ^ ", "<ignore> ^ </ignore>", $text);
$text = str_replace(" ^ ", "<ignore> ^ </ignore>", $text);
$text = str_replace(" ^ ", "<ignore> ^ </ignore>", $text);
$text = str_replace("^ ", "<ignore>^ </ignore>", $text);
$text = str_replace(" ^", "<ignore> ^</ignore>", $text);
$text = str_replace("^", "<ignore>^</ignore>", $text);
$text = str_replace(" | ", "<ignore> | </ignore>", $text);
$text = str_replace(" | ", "<ignore> | </ignore>", $text);
$text = str_replace(" | ", "<ignore> | </ignore>", $text);
$text = str_replace("| ", "<ignore>| </ignore>", $text);
$text = str_replace(" |", "<ignore> |</ignore>", $text);
$text = str_replace("|", "<ignore>|</ignore>", $text);

// prevent deepl from doing strange things with dokuwiki syntax
Expand Down Expand Up @@ -893,7 +903,17 @@ private function remove_ignore_tags($text): string {

// prevent deepl from messing with tables
$text = str_replace("<ignore>^</ignore>", "^", $text);
$text = str_replace("<ignore>^ </ignore>", "^ ", $text);
$text = str_replace("<ignore> ^</ignore>", " ^", $text);
$text = str_replace("<ignore> ^ </ignore>", " ^ ", $text);
$text = str_replace("<ignore> ^ </ignore>", " ^ ", $text);
$text = str_replace("<ignore> ^ </ignore>", " ^ ", $text);
$text = str_replace("<ignore>|</ignore>", "|", $text);
$text = str_replace("<ignore>| </ignore>", "| ", $text);
$text = str_replace("<ignore> |</ignore>", " |", $text);
$text = str_replace("<ignore> | </ignore>", " | ", $text);
$text = str_replace("<ignore> | </ignore>", " | ", $text);
$text = str_replace("<ignore> | </ignore>", " | ", $text);

$text = str_replace("<ignore><ignore>''</ignore></ignore>", "''", $text);
$text = str_replace("<ignore><ignore>//</ignore></ignore>", "//", $text);
Expand Down

0 comments on commit c6c5ded

Please sign in to comment.