mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-09-19 11:08:11 +00:00
75936454cc
Adds logic for locating and splitting text nodes. Adds specific classes to offload tag/content specific logic.
31 lines
579 B
PHP
31 lines
579 B
PHP
<?php
|
|
|
|
namespace BookStack\Entities\Tools;
|
|
|
|
use DOMNode;
|
|
|
|
class PageIncludeTag
|
|
{
|
|
public function __construct(
|
|
public string $tagContent,
|
|
public DOMNode $domNode,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Get the page ID that this tag references.
|
|
*/
|
|
public function getPageId(): int
|
|
{
|
|
return intval(trim(explode('#', $this->tagContent, 2)[0]));
|
|
}
|
|
|
|
/**
|
|
* Get the section ID that this tag references (if any)
|
|
*/
|
|
public function getSectionId(): string
|
|
{
|
|
return trim(explode('#', $this->tagContent, 2)[1] ?? '');
|
|
}
|
|
}
|