Skip to content

Commit

Permalink
LOW PRIORITY: <Emphasis Type="Italic"> and such (#1405)
Browse files Browse the repository at this point in the history
  • Loading branch information
GlazerMann committed Mar 5, 2019
1 parent fd7414e commit 658897a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion expandFns.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function wikify_external_text($title) {
}
}
$title = html_entity_decode($title, NULL, "UTF-8");
$title = preg_replace("/\s+/"," ", $title); // Remove all white spaces before
$title = preg_replace("~\s+~"," ", $title); // Remove all white spaces before
if (mb_substr($title, -6) == "&nbsp;") $title = mb_substr($title, 0, -6);
if (mb_substr($title, -1) == ".") {
$last_word = mb_substr($title, mb_strpos($title, ' ') + 1);
Expand All @@ -142,6 +142,14 @@ function wikify_external_text($title) {
$title = preg_replace('~[\*]$~', '', $title);
$title = title_capitalization($title, TRUE);

// The following two do not allow < within the inner match since the end tag is the same :-( and they might nest or who knows what
$title = preg_replace_callback('~(?:<Emphasis Type="Italic">)([^<]+)(?:</Emphasis>)~iu',
function ($matches) {return ("<i>" . $matches[1]. "</i>");},
$title);
$title = preg_replace_callback('~(?:<Emphasis Type="Bold">)([^<]+)(?:</Emphasis>)~iu',
function ($matches) {return ("<b>" . $matches[1]. "</b>");},
$title);

$originalTags = array("<i>","</i>", '<title>', '</title>',"From the Cover: ");
$wikiTags = array("''","''",'','',"");
$htmlBraces = array("&lt;", "&gt;");
Expand Down

0 comments on commit 658897a

Please sign in to comment.