mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 10:02:02 -04:00
Use the se:is-a-collection metadata element to decide if we search the ToC
This commit is contained in:
parent
86ae801f84
commit
70fbce410c
1 changed files with 3 additions and 5 deletions
|
@ -57,7 +57,7 @@ class Ebook{
|
||||||
public $ModifiedTimestamp;
|
public $ModifiedTimestamp;
|
||||||
public $TextUrl;
|
public $TextUrl;
|
||||||
public $TextSinglePageUrl;
|
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){
|
public function __construct(string $wwwFilesystemPath){
|
||||||
// First, construct a source repo path from our WWW filesystem path.
|
// First, construct a source repo path from our WWW filesystem path.
|
||||||
|
@ -198,11 +198,9 @@ class Ebook{
|
||||||
$includeToc = false;
|
$includeToc = false;
|
||||||
foreach($xml->xpath('/package/metadata/meta[@property="se:subject"]') ?: [] as $tag){
|
foreach($xml->xpath('/package/metadata/meta[@property="se:subject"]') ?: [] as $tag){
|
||||||
$this->Tags[] = new Tag($tag);
|
$this->Tags[] = new Tag($tag);
|
||||||
|
}
|
||||||
|
|
||||||
if($tag == 'Shorts' || $tag == 'Poetry'){
|
$includeToc = sizeof($xml->xpath('/package/metadata/meta[@property="se:is-a-collection"]') ?: []) > 0;
|
||||||
$includeToc = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill the ToC if necessary
|
// Fill the ToC if necessary
|
||||||
if($includeToc){
|
if($includeToc){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue