Skip to content

Commit

Permalink
Added dir attributes to the epub3toc (if writing direction is rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
Grandt committed Mar 8, 2016
1 parent 69431b9 commit 877fdb9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/PHPePub/Core/Structure/NCX/NavPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,25 @@ function finalizeEPub3(&$nav = "", &$playOrder = 0, $level = 0, $subLevelClass =
if ($this->id == null) {
$this->id = "navpoint-" . $playOrder;
}
$indent = str_repeat("\t", $level) . "\t\t\t\t";

$nav .= $indent . "<li id=\"" . $this->id . "\"";
$dir = "";
if (isset($this->writingDirection)) {
$nav .= " dir=\"" . $this->writingDirection . "\"";
$dir .= " dir=\"" . $this->writingDirection . "\"";
}
$nav .= ">\n";
$indent = str_repeat("\t", $level) . "\t\t\t\t";

$nav .= $indent . "<li id=\"" . $this->id . "\"" . $dir . ">\n";

if (isset($this->contentSrc)) {
$nav .= $indent . "\t<a href=\"" . $this->contentSrc . "\">" . $this->label . "</a>\n";
$nav .= $indent . "\t<a href=\"" . $this->contentSrc . "\"" . $dir . ">" . $this->label . "</a>\n";
} else {
$nav .= $indent . "\t<span>" . $this->label . "</span>\n";
$nav .= $indent . "\t<span" . $dir . ">" . $this->label . "</span>\n";
}

if (sizeof($this->navPoints) > 0) {
$maxLevel++;

$nav .= $indent . "\t<ol epub:type=\"list\"";
$nav .= $indent . "\t<ol epub:type=\"list\"" . $dir;
if (isset($subLevelClass)) {
$nav .= " class=\"" . $subLevelClass . "\"";
}
Expand Down

0 comments on commit 877fdb9

Please sign in to comment.