diff --git a/lib/pico.php b/lib/pico.php index d2230bd39b075b1a6dfc8dee80809191cd3f6f48..5c18694975e528167ec7aec5f3767620c088e1ff 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -164,6 +164,18 @@ class Pico { } if($headers['date']) $headers['date_formatted'] = date($config['date_format'], strtotime($headers['date'])); + + if(empty($headers['title'])){ + preg_match('/^(.+?)[ ]*\n(=+|-+)[ ]*\n+/imu',$content,$matches); + if(count($matches) > 0){ + $headers['title'] = $matches[1]; + }else{ + preg_match('/^\#{1}([^\#].*)$/imu',$content,$matches); + if(count($matches) > 0){ + $headers['title'] = $matches[1]; + } + } + } return $headers; } @@ -336,4 +348,4 @@ class Pico { } -?> \ No newline at end of file +?>