-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store IDs of non-chunked elements. Closes #98. --------- Co-authored-by: haszi <[email protected]>
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
namespace phpdotnet\phd; | ||
|
||
class TestIndex extends Index { | ||
public function getNfo(): array { | ||
return $this->nfo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--TEST-- | ||
Bug GH-98 - Non-chunked section is not linked | ||
--FILE-- | ||
<?php | ||
namespace phpdotnet\phd; | ||
|
||
require_once __DIR__ . "/../setup.php"; | ||
|
||
$xml_file = __DIR__ . "/data/bug_GH-98.xml"; | ||
|
||
Config::init([ | ||
"force_index" => true, | ||
"xml_file" => $xml_file, | ||
]); | ||
|
||
$index = new TestIndex; | ||
$render = new TestRender(new Reader, new Config, null, $index); | ||
|
||
$render->run(); | ||
|
||
$indexes = array_keys($index->getNfo()); | ||
|
||
echo "Indexes stored:\n"; | ||
|
||
var_dump(in_array("non-chunked.element.id", $indexes)); | ||
var_dump(in_array("another.non-chunked.element.id", $indexes)); | ||
var_dump(in_array("chunked.element.id", $indexes)); | ||
var_dump(in_array("another.chunked.element.id", $indexes)); | ||
var_dump(in_array("bug-GH-98", $indexes)); | ||
?> | ||
--EXPECT-- | ||
Indexes stored: | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<chapter xml:id="bug-GH-98"> | ||
|
||
<sect1 xmlns="http://docbook.org/ns/docbook" annotations="chunk:false" xml:id="non-chunked.element.id"> | ||
<para> | ||
Content to ensure this elements is indexed | ||
</para> | ||
</sect1> | ||
|
||
<section xmlns="http://docbook.org/ns/docbook" annotations="chunk:false" xml:id="another.non-chunked.element.id"> | ||
<para> | ||
Content to ensure this elements is indexed too | ||
</para> | ||
</section> | ||
|
||
<sect1 xmlns="http://docbook.org/ns/docbook" xml:id="chunked.element.id"> | ||
<para> | ||
Content to ensure this elements is indexed as well | ||
</para> | ||
</sect1> | ||
|
||
<section xmlns="http://docbook.org/ns/docbook" xml:id="another.chunked.element.id"> | ||
<para> | ||
Content to ensure this elements is also indexed | ||
</para> | ||
</section> | ||
|
||
</chapter> |