From 70fbce410c05a11ba508e1bbd21ab8792abb4e2b Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Sat, 25 Jun 2022 14:55:31 -0500 Subject: [PATCH] Use the se:is-a-collection metadata element to decide if we search the ToC --- lib/Ebook.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Ebook.php b/lib/Ebook.php index 6c57d4ff..111b3254 100644 --- a/lib/Ebook.php +++ b/lib/Ebook.php @@ -57,7 +57,7 @@ class Ebook{ public $ModifiedTimestamp; public $TextUrl; public $TextSinglePageUrl; - public $TocEntries = null; // A list of non-Roman ToC entries ONLY IF the work has the 'shorts' or 'poetry' tag, null otherwise + public $TocEntries = null; // A list of non-Roman ToC entries ONLY IF the work has the 'se:is-a-collection' metadata element, null otherwise public function __construct(string $wwwFilesystemPath){ // First, construct a source repo path from our WWW filesystem path. @@ -198,12 +198,10 @@ class Ebook{ $includeToc = false; foreach($xml->xpath('/package/metadata/meta[@property="se:subject"]') ?: [] as $tag){ $this->Tags[] = new Tag($tag); - - if($tag == 'Shorts' || $tag == 'Poetry'){ - $includeToc = true; - } } + $includeToc = sizeof($xml->xpath('/package/metadata/meta[@property="se:is-a-collection"]') ?: []) > 0; + // Fill the ToC if necessary if($includeToc){ $this->TocEntries = [];