From 092f8f0950ca44e6dd809dacca1f829d4d64b325 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 21 Sep 2013 16:52:48 +1200 Subject: [PATCH] cosmetic fix linkification, 'written in' subtitles --- rebuild.php | 16 +++++++++++++--- static/style.css | 7 ++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/rebuild.php b/rebuild.php index 2819c61..11cbe4d 100644 --- a/rebuild.php +++ b/rebuild.php @@ -94,10 +94,10 @@ function hesc($sz) { } function text2html($sz) { - $base = nl2br(hesc($sz)); + $base = hesc($sz); + $base = preg_replace('~(https?://[^ \\r\\n\\t]+)~i', '\\1', $base); - preg_replace('~(https?://.+\b)~i', '\1', $base); - return $base; + return nl2br($base); } /** @@ -108,6 +108,7 @@ class CProject { private $dir; public $projname; public $shortdesc = '(no description)'; + public $subtag = ''; private $longdesc = ''; private $images = array(); private $downloads = array(); @@ -126,6 +127,11 @@ class CProject { if ($file == 'README.txt') { $this->longdesc = file_get_contents($this->dir.'README.txt'); + $matches = array(); + if (preg_match('~Written in ([^\\r\\n]+)~', $this->longdesc, $matches)) { + $this->subtag = rtrim($matches[1], ' .'); + } + $this->shortdesc = array_shift(explode("\n", $this->longdesc)); $this->shortdesc[0] = strtolower($this->shortdesc[0]); // cosmetic lowercase continue; @@ -328,6 +334,10 @@ function buildall() { projname)?>, shortdesc)?> more... + subtag)) { ?> +
+ subtag)?> + diff --git a/static/style.css b/static/style.css index d9ff89d..16c25b0 100644 --- a/static/style.css +++ b/static/style.css @@ -56,6 +56,10 @@ html, body { .projtable td { padding: 4px; } +.projtable small { + color:grey; + font-style:italic; +} .projinfo { position:relative; @@ -74,7 +78,7 @@ html, body { position:absolute; right:0; - width:60px; + width:62px; /* 60px + 2px border */ } /* */ @@ -94,6 +98,7 @@ html, body { height:60px; opacity: 0.8; transition:0.2s opacity; + border:1px solid lightgrey; } .thumbimage:hover { opacity:1.0;