X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/58445e7f5d88512e4b558fc1b9658e9ce49e273a..f46f7a3b080b947af711ab35601c26f6423cbe8b:/nieuws.inc.php diff --git a/nieuws.inc.php b/nieuws.inc.php index 1565c63..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( @@ -130,14 +139,24 @@ function shownews($input, $limit = 1000) } } -function printtoc($input) +function printtoc($input, $class = FALSE) { if (!is_array($input)) $input = glob("$input/*.html"); - print '