Jeps... Men selvfølgelig slap jeg ikke så let!
Prøv lige at se her:
www.ovrkll.com/developmentDer kommer nogle store grimme vertikale mellemrum. Årsagen er, at mit script til fjernelse af linjeskift lige før og efter div-tags ikke fungerer. Koden er som følger:
public static $Patterns = array
(
"h1" => "#\[h1\](.+)\[/h1\]#",
"h2" => "#\[h2\](.+)\[/h2\]#",
"h3" => "#\[h3\](.+)\[/h3\]#",
"b" => "#\[b\](.+)\[/b\]#",
"i" => "#\[i\](.+)\[/i\]#",
"u" => "#\[u\](.+)\[/u\]#",
"il1" => "#\[il\]([0-9a-z_-]+)\[/il\]#e",
"il2" => "#\[il=([0-9a-z_-]+)\](.+?)\[/il\]#e",
"el1" => "#\[el\]([0-9a-z_-]+)\.([a-z]{2,4})\[/el\]#",
"el2" => "#\[el\]([0-9a-z_-]+)\.([a-z]{2,4})/(.+)\[/el\]#",
"el3" => "#\[el=([0-9a-z_-]+)\.([a-z]{2,4})\](.+)\[/el\]#",
"el4" => "#\[el=([0-9a-z_-]+)\.([a-z]{2,4})/(.+)\](.+)\[/el\]#",
"m1" => "#\[m\]([0-9a-zA-Z_-]+)@([0-9a-z_-]+)\.([a-z]{2,4})\[/m\]#",
"m2" => "#\[m=([0-9a-zA-Z_-]+)@([0-9a-z_-]+)\.([a-z]{2,4})\](.+)\[/m\]#",
"s" => "#\[s=(.+)\](((.+) )+?.+)\[/s\]#e",
"n1" => "#(((\n)|(<br>))*?)<div(.*?)>(.*?)</div>(((\n)|(<br>))*?)#",
"n2" => "#\n#"
);
public static $Replacements = array
(
"h1" => "<h1>$1</h1>",
"h2" => "<h2>$1</h2>",
"h3" => "<h3>$1</h3>",
"b" => "<b>$1</b>",
"i" => "<i>$1</i>",
"u" => "<u>$1</u>",
"il1" => '\'<a title="\'.Page::GetPage($1, true)->Title.\'" href="?location=$1">\'.Page::$LastPage->Title.\'</a>\'',
"il2" => '\'<a title="\'.Page::GetPage($1)->Title.\'" href="?location=$1">$2</a>\'',
"el1" => "<a title=\"www.$1.$2\" href=\"
http://www.$1.$2/\" target=\"_blank\">$1.$2</a>",
"el2" => "<a title=\"www.$1.$2/$3\" href=\"
http://www.$1.$2/$3\" target=\"_blank\">$1.$2/$3</a>",
"el3" => "<a title=\"www.$1.$2\" href=\"
http://www.$1.$2/\" target=\"_blank\">$3</a>",
"el4" => "<a title=\"www.$1.$2/$3\" href=\"
http://www.$1.$2/$3\" target=\"_blank\">$4</a>",
"m1" => "<a title=\"$1@$2.$3\" href=\"mailto:$1@$2.$3\">$1@$2.$3</a>",
"m2" => "<a title=\"$1@$2.$3\" href=\"mailto:$1@$2.$3\">$4</a>",
"s" => '\'<div class="screenshots">$1</div><div>\'.Formatting::ArrangeScreenshots($2, $1).\'</div>\'',
"n1" => "<div$1>$2</div>",
"n2" => "<br>"
);
public static function Convert($string)
{
return preg_replace(self::$Patterns, self::$Replacements, $string);
}
Kildekoden bliver:
<div class="content"><div>Welcome to OVKRLL.com!</div><div>Toke Skovbo Krainert's official portfolio</div><div>On OVRKLL.com you will find most of my work with mapping, modding and programming as well as frequently updated news and information about me and my site.</div><h1>News: OVRKLL.com V2 is online!</h1>
<br>Finally, the second edition of my homepage is online!
<br>The last one was quite retro so I though of this concept as a stylish change to the layout and theme.
<br>
<br><h1>Introduction</h1>
<br>Hello and welcome to OVRKLL.com, my official online portfolio!<div class="details">Page edited on December 31, 23:04:27 UTC</div></div>
Foruden de manglende sletninger af linjeskift undrer det mig også, at der kommer skift i kildekoden - disse skulle jo netop erstattes med br-tags!