Skip to content

Commit

Permalink
Remove ReaderKeeper from Index
Browse files Browse the repository at this point in the history
  • Loading branch information
haszi committed May 22, 2024
1 parent 8625d10 commit 5aa31b8
Showing 1 changed file with 48 additions and 19 deletions.
67 changes: 48 additions & 19 deletions phpdotnet/phd/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class Index extends Format
'phpdoc' => 'PI_PHPDOCHandler',
);

private bool $inLdesc = false;
private bool $inSdesc = false;
private string $currentLdesc = "";
private string $currentSdesc = "";
private $currentchunk;
private $ids = array();
private $currentid;
Expand All @@ -93,6 +97,7 @@ class Index extends Format
private $previousId = "";
private $inChangelog = false;
private $currentChangelog = array();
private string $currentChangeLogString = "";
private $changelog = array();
private $currentMembership = null;
private $commit = array();
Expand All @@ -107,12 +112,30 @@ public function __construct(IndexRepository $indexRepository) {
public function transformFromMap($open, $tag, $name, $attrs, $props) {
}
public function TEXT($value) {
if ($this->inLdesc) {
$this->currentLdesc .= $value;
}
if ($this->inSdesc) {
$this->currentSdesc .= $value;
}
if ($this->inChangelog) {
$this->currentChangeLogString .= $value;
}
}
public function CDATA($value) {
}
public function createLink($for, &$desc = null, $type = Format::SDESC) {
}
public function appendData($data) {
if ($this->inLdesc && is_string($data) && trim($data) === "") {
$this->currentLdesc .= $data;
}
if ($this->inSdesc && is_string($data) && trim($data) === "") {
$this->currentSdesc .= $data;
}
if ($this->inChangelog && is_string($data) && trim($data) === "") {
$this->currentChangeLogString .= $data;
}
}

public function update($event, $value = null)
Expand Down Expand Up @@ -323,26 +346,31 @@ public function format_chunk($open, $name, $attrs, $props) {

public function format_ldesc($open, $name, $attrs, $props) {
if ($open) {
if (empty($this->nfo[$this->currentid]["ldesc"])) {
/* FIXME: How can I mark that node with "reparse" flag? */
$s = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT, "UTF-8");
$this->nfo[$this->currentid]["ldesc"] = $s;
}
$this->inLdesc = true;
$this->currentLdesc = "";
return;
}
$this->inLdesc = false;
if (empty($this->nfo[$this->currentid]["ldesc"])) {
$this->nfo[$this->currentid]["ldesc"] = htmlentities(trim($this->currentLdesc), ENT_COMPAT, "UTF-8");
}
}
public function format_sdesc($open, $name, $attrs, $props) {
if ($open) {
$s = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT, "UTF-8");
if (empty($this->nfo[$this->currentid]["sdesc"])) {
/* FIXME: How can I mark that node with "reparse" flag? */
$this->nfo[$this->currentid]["sdesc"] = $s;
} else {
if (!is_array($this->nfo[$this->currentid]["sdesc"])) {
$this->nfo[$this->currentid]["sdesc"] = (array)$this->nfo[$this->currentid]["sdesc"];
}
//In the beginning of the array to stay compatible with 0.4
array_unshift($this->nfo[$this->currentid]["sdesc"], $s);
$this->inSdesc = true;
$this->currentSdesc = "";
return;
}
$this->inSdesc = false;
$s = htmlentities(trim($this->currentSdesc), ENT_COMPAT, "UTF-8");
if (empty($this->nfo[$this->currentid]["sdesc"])) {
$this->nfo[$this->currentid]["sdesc"] = $s;
} else {
if (!is_array($this->nfo[$this->currentid]["sdesc"])) {
$this->nfo[$this->currentid]["sdesc"] = (array)$this->nfo[$this->currentid]["sdesc"];
}
//In the beginning of the array to stay compatible with 0.4
array_unshift($this->nfo[$this->currentid]["sdesc"], $s);
}
}

Expand Down Expand Up @@ -380,10 +408,11 @@ public function format_refsect1($open, $name, $attrs, $props) {

public function format_entry($open, $name, $attrs, $props) {
if ($open) {
if ($this->inChangelog) {
/* FIXME: How can I mark that node with "reparse" flag? */
$this->currentChangelog[] = htmlentities(trim(ReaderKeeper::getReader()->readContent()), ENT_COMPAT, "UTF-8");
}
$this->currentChangeLogString = "";
return;
}
if ($this->inChangelog) {
$this->currentChangelog[] = htmlentities(trim($this->currentChangeLogString), ENT_COMPAT, "UTF-8");
}
}
public function format_row($open, $name, $attrs, $props) {
Expand Down

0 comments on commit 5aa31b8

Please sign in to comment.