diff --git a/phpdotnet/phd/Index.php b/phpdotnet/phd/Index.php index e377ed09..8b3a6d36 100644 --- a/phpdotnet/phd/Index.php +++ b/phpdotnet/phd/Index.php @@ -330,7 +330,7 @@ public function format_chunk($open, $name, $attrs, $props) { } elseif (isset($attrs[Reader::XMLNS_DOCBOOK]['annotations'])) { $this->isChunk[] = !str_contains($attrs[Reader::XMLNS_DOCBOOK]['annotations'], 'chunk:false'); } else { - $this->isChunk[] = true; + $this->isChunk[] = ($name !== 'preface'); } if (end($this->isChunk)) { diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index 878afb83..fce9f6f7 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -935,7 +935,7 @@ public function format_enumidentifier_text($value, $tag) { /*Chunk Functions*/ - private function isChunkedByAttributes(array $attributes): bool { + private function isChunkedByAttributes(array $attributes, string $name = ''): bool { /* Legacy way to mark chunks */ if (isset($attributes[Reader::XMLNS_PHD]['chunk'])) { return $attributes[Reader::XMLNS_PHD]['chunk'] != 'false'; @@ -943,8 +943,8 @@ private function isChunkedByAttributes(array $attributes): bool { /** Annotations attribute is a standard DocBook attribute and could be used for various things */ return !str_contains($attributes[Reader::XMLNS_DOCBOOK]['annotations'], 'chunk:false'); } else { - /* Chunked by default */ - return true; + /* Chunked by default, except preface */ + return $name !== 'preface'; } } @@ -953,7 +953,7 @@ public function format_container_chunk($open, $name, $attrs, $props) { $this->CURRENT_CHUNK = $this->CURRENT_ID = $id = $attrs[Reader::XMLNS_XML]["id"] ?? ''; - if ($this->isChunkedByAttributes($attrs)) { + if ($this->isChunkedByAttributes($attrs, $name)) { $this->cchunk = $this->dchunk; } @@ -1063,7 +1063,7 @@ public function format_chunk($open, $name, $attrs, $props) { } $this->CURRENT_CHUNK = $this->CURRENT_ID = $id; - if ($this->isChunkedByAttributes($attrs)) { + if ($this->isChunkedByAttributes($attrs, $name)) { $this->cchunk = $this->dchunk; $this->notify(Render::CHUNK, Render::OPEN); } @@ -1078,7 +1078,7 @@ public function format_chunk($open, $name, $attrs, $props) { } return '