Explorar o código

Merge dee3ec7cfe945f0977174749d207f9168d77c545 into 69d67b2b7198d2e1483d7f44d5d4320a63903572

Roberts %!s(int64=12) %!d(string=hai) anos
pai
achega
6c9dffb996
Modificáronse 1 ficheiros con 12 adicións e 0 borrados
  1. 12 0
      lib/pico.php

+ 12 - 0
lib/pico.php

@@ -167,6 +167,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;
 	}