From c3518f67a1134e20a497dbfc3161353b650e279d Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 27 Jun 2019 23:27:17 +0200 Subject: [PATCH] nieuws: inline code to format article overviews No distinct callers remain, only the placement page which is included instead. --- nieuws.inc.php | 50 ----------------------------------------------- nieuws.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 50 deletions(-) diff --git a/nieuws.inc.php b/nieuws.inc.php index 34b565a..c6f3be9 100644 --- a/nieuws.inc.php +++ b/nieuws.inc.php @@ -120,53 +120,3 @@ class ArchiveArticle ); } } - -function shownews($input, $limit = 1000) -{ - if (!is_array($input)) $input = glob("$input/*.html"); - foreach (array_reverse($input) as $filename) { - $article = new ArchiveArticle($filename); - print '
'; - if ($article->thumb) { - $imgattr = ' class="left"'; - if (preg_match('{ (\s alt="[^"]+") }x', $article->img, $img)) { - $imgattr .= $img[0]; # preserve alt value - } - printf('', $article->thumb, $imgattr); - } - print '
'; - printf( - '

%s %s

', - $article->link, $article->title, $article->date - ); - print $article->body; - print '
'; - print "
\n\n"; - - if (--$limit <= 0) break; - } -} - -function printtoc($input, $class = FALSE) -{ - if (!is_array($input)) $input = glob("$input/*.html"); - print ''; - foreach (array_reverse($input) as $page) { - $article = new ArchiveArticle($page); - $html = $article->safetitle; - $dateparts = $article->dateparts; - if ($class) { - $dateparts[0] = NULL; # omit year - } - $html .= sprintf(' %s', showdate($dateparts)); - if ($class == 'gallery' and $article->img) { - $html = "
$html
"; - $html = sprintf('', $article->thumb(200)) . $html; - } - $html = sprintf('%s', $article->link, $html); - print "
  • $html
  • \n"; - } - print "\n"; -} diff --git a/nieuws.php b/nieuws.php index 338a6b6..2514438 100644 --- a/nieuws.php +++ b/nieuws.php @@ -1,5 +1,58 @@ '; + if ($article->thumb) { + $imgattr = ' class="left"'; + if (preg_match('{ (\s alt="[^"]+") }x', $article->img, $img)) { + $imgattr .= $img[0]; # preserve alt value + } + printf('', $article->thumb, $imgattr); + } + print '
    '; + printf( + '

    %s %s

    ', + $article->link, $article->title, $article->date + ); + print $article->body; + print '
    '; + print "\n\n"; + + if (--$limit <= 0) break; + } +} + +function printtoc($input, $class = FALSE) +{ + if (!is_array($input)) $input = glob("$input/*.html"); + print ''; + foreach (array_reverse($input) as $page) { + $article = new ArchiveArticle($page); + $html = $article->safetitle; + $dateparts = $article->dateparts; + if ($class) { + $dateparts[0] = NULL; # omit year + } + $html .= sprintf(' %s', showdate($dateparts)); + if ($class == 'gallery' and $article->img) { + $html = "
    $html
    "; + $html = sprintf('', $article->thumb(200)) . $html; + } + $html = sprintf('%s', $article->link, $html); + print "
  • $html
  • \n"; + } + print "\n"; +} +} + $articles = (ltrim($Args, '/') ?: 'nieuws'); if (strpos($articles, '/') === FALSE) { if (@$Place['view'] === 'toc') { -- 2.30.0