fix [entry] tag targets

This commit is contained in:
mappu 2017-04-23 18:42:09 +12:00
parent 378dbec981
commit 6c21f36d77
2 changed files with 7 additions and 1 deletions

View File

@ -83,6 +83,13 @@ class CProject {
if (preg_match('~Tags: ([^\\n]+)~', $this->longdesc, $matches)) {
$this->tags = array_map('trim', explode(',', $matches[1]));
}
// Find `entry` tags
$this->longdesc = preg_replace(
'~\\[entry=([^\\]]+?)\\](.+?)\\[/entry\\]~m',
'[url='.BASEURL.'\\1/]\\2[/url]', // hesc still hasn't happened, transform bbcode->bbcode
$this->longdesc
);
// Extract short description
$parts = explode("\n", $this->longdesc);

View File

@ -138,7 +138,6 @@ function text2html($sz) {
$base = preg_replace('~\\[b\\](.+?)\\[/b\\]~m', '<strong>\\1</strong>', $base);
$base = preg_replace('~\\[i\\](.+?)\\[/i\\]~m', '<i>\\1</i>', $base);
$base = preg_replace('~\\[spoiler\\](.+?)\\[/spoiler\\]~m', '<span class="spoiler">\\1</span>', $base);
$base = preg_replace('~\\[entry=([^\\]]+?)\\](.+?)\\[/entry\\]~m', '<a href="\\1.html">\\2</a>', $base);
$base = preg_replace('~\n- ~ms', "\n&bull; ", $base);
$btparts = explode('`', $base);