#include <LUGO.style>

<page name="News">

<h3>Nachrichten der LUGO und zu GNU/Linux</h3>

<div style="padding-top: 10px"></div>
<:
    $limit = 5;
    $head = '<div class="news"><div class="newsbody"><h3 class="newstitle">%s</h3><div class="newscontent">';
    $foot = '</div></div></div>';
    @month = ('dummy','Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember');

    if (opendir (NEWS, ".")) {
	@news = reverse (sort (grep (/^news-.*\.txt$/,readdir (NEWS))));
        closedir (NEWS);
    }

    for ($i=0; $i < $limit && $i < $#news; $i++) {
        $needp = 0;  # 0 = init, 1 = <p> need, 2 = no <p> needed
        $news[$i] =~ /news-(\d+)-(\d+)-(\d+).txt/;
	$date = sprintf ("%d. %s %04d", $3, $month[$2], $1);
	if (open (NEWS, $news[$i])) {
	    printf $head."\n", $date;
	    while (<NEWS>) {
	        if (/\\$/) {
		    s,\\$,,;
		    chomp;
		}

		if ($needp == 0) {
		  if (substr($_, 0, 3) eq "<p>") {
		    $needp = 2;
		  } else {
		    $needp = 1;
		    print "<p>";
		  }
		}

	        print;
	    }
	    close (NEWS);
	    print "</p>" if ($needp == 1);
	    print $foot;
	}
    }

    print "<p><a href=\"olds.html\">Ältere Nachrichten</a>" if ($i < $#news);
:>

</page>

# Local variables:
# mode: indented-text
# mode: auto-fill
# end:
