DAT-4041 empty portable infobox will be supported

This commit is contained in:
idradm 2016-04-01 16:43:41 +02:00
parent 7976e3be75
commit c15314dd7b

View file

@ -51,9 +51,9 @@ class PortableInfoboxTemplatesHelper {
* @param $title
* @return array of strings (infobox markups)
*/
public function getMarkup($title) {
$content = $this->fetchContent($title);
return $this->getInfoboxes($content);
public function getMarkup( $title ) {
$content = $this->fetchContent( $title );
return $this->getInfoboxes( $content );
}
/**
@ -114,8 +114,9 @@ class PortableInfoboxTemplatesHelper {
* @return array of striped infoboxes ready to parse
*/
protected function getInfoboxes( $text ) {
preg_match_all( "/<infobox.*\\/>/sU", $text, $empty );
preg_match_all( "/<infobox.+<\/infobox>/sU", $text, $result );
return $result[ 0 ];
return array_merge( $empty[ 0 ], $result[ 0 ] );
}
}