1
0
mirror of https://github.com/suk-ws/ph-Bookshelf.git synced 2025-02-24 23:20:52 +08:00
ph-Bookshelf/src/Data/PageData.php
Eyre_S f79060f32f
add support for md front matter & open page unlisted
- support page config define in front matter
  - support `title`, which can set HTML title.
    - if `title` is not set, then HTML title will try find page title defined in book.xml
	- if `title` is set but <h1> title not set, it will generated a <h1> title using the value of `title`
  - support `configurations` which can set page level configs here.
- now can open page that has .md file but not defined in book.xml (must in a book defined)
- old.title.gen is not supported yet.
2023-03-25 20:11:10 +08:00

28 lines
562 B
PHP

<?php
namespace SukWs\Bookshelf\Data;
readonly class PageData {
public string $page_html;
public ?string $title;
public bool $gen_title;
public array $configurations;
public function __construct (
string $page_html, array $configurations = array(),
string $title = null, bool $gen_title = false
) {
$this->page_html = $page_html;
$this->configurations = $configurations;
$this->title = $title;
$this->gen_title = $gen_title;
}
public function getConfiguration (string $key): ?string {
return @$this->configurations[$key];
}
}