Permalink
Browse files

Restore old TOC links

  • Loading branch information...
1 parent 12a449b commit 3ffa491ee8d4e23901d5055044fbd487d74ff58f @raiju committed Jan 20, 2013
Showing with 3 additions and 3 deletions.
  1. +3 −3 MOBIClass/MOBIFile.php
View
@@ -30,7 +30,6 @@ public function getTextData(){
if($this->settings["toc"]) {
$toc = $this->generateTOC($entries); //Generate TOC to get the right length
$toc = $this->generateTOC($entries, strlen($prefix)+strlen($toc)+strlen($title)); //Generate the real TOC
- $toc .= '<mbp:pagebreak/>';
}
$suffix = "</body></html>";
@@ -83,9 +82,10 @@ public function generateTOC($entries, $base = 0){
$toc .= "<blockquote><table summary='Table of Contents'><col/><tbody>";
for($i = 0, $len = sizeof($entries); $i < $len; $i++){
$entry = $entries[$i];
- $toc .= "<tr><td><a href='#".$entry["id"]."'>".$entry["title"]."</a></td></tr>";
+ $pos = str_pad($entry["position"]+$base, 10, "0", STR_PAD_LEFT);
+ $toc .= "<tr><td><a href='#".$entry["id"]."' filepos='".$pos."'>".$entry["title"]."</a></td></tr>";
}
- return $toc."</tbody></b></table></blockquote>";
+ return $toc."</tbody></b></table></blockquote><mbp:pagebreak/>";
}
/**

0 comments on commit 3ffa491

Please sign in to comment.