X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/1428caff970f73f026f1467c7741798ca7c9272c..f46f7a3b080b947af711ab35601c26f6423cbe8b:/nieuws.inc.php diff --git a/nieuws.inc.php b/nieuws.inc.php index 40313e4..cafd4ec 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -86,6 +86,13 @@ class ArchiveArticle return $rest; } + function teaser() + { + if (preg_match('{

(.*?)

}s', $this->body, $bodyp)) { + return $bodyp[1]; + } + } + function img() { $this->body; @@ -113,9 +120,11 @@ function shownews($input, $limit = 1000) $article = new ArchiveArticle($filename); print '
'; if ($article->thumb) { - $img = preg_replace('{(?<= \b src="/) [^"]* }x', $article->thumb, $article->img); - $img = preg_replace('{(?= />$)}', ' class="left"', $img); - print $img; + $imgattr = ' class="left"'; + if (preg_match('{ (\s alt="[^"]+") }x', $article->img, $img)) { + $imgattr .= $img[0]; # preserve alt value + } + printf('', $article->thumb, $imgattr); } print '
'; printf(