take 50 first words as short description (Itch)
This commit is contained in:
parent
5904318c2b
commit
b6199572e7
|
@ -102,7 +102,7 @@ class Itch extends Source {
|
|||
}
|
||||
});
|
||||
$date = $this->dom->filter('td abbr');
|
||||
if ($date) {
|
||||
if ($date->count() > 0) {
|
||||
$date = $date->first()->attr('title');
|
||||
$date = str_replace('@', '', $date);
|
||||
$game->date = new \DateTime($date);
|
||||
|
@ -112,8 +112,13 @@ class Itch extends Source {
|
|||
$game->description = trim($desc->first()->html());
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
// $converter = new Pandoc();
|
||||
// $game->description = $converter->convert($game->description, 'html', 'mediawiki');
|
||||
if (empty($game->short_description)) {
|
||||
$converter = new Pandoc();
|
||||
$description = $converter->convert($game->description, 'html', 'mediawiki');
|
||||
$description = explode(' ',$description);
|
||||
// 50 first words
|
||||
$game->short_description = implode(' ', array_slice($description, 0, 50));
|
||||
}
|
||||
return $game;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue