Skip to content

Commit

Permalink
Add back link to original page on sections.
Browse files Browse the repository at this point in the history
  • Loading branch information
csev committed Jan 12, 2025
1 parent 9744156 commit 6418337
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions book/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ function myEdit(me) {
$lines = explode("\n",$contents);
$newcontent = array();
foreach($lines as $line) {
if ( strpos($line, "-------") === 0 ) {
$sofar = count($newcontent);
$sectitle = false;
if ( $sofar > 2 ) {
$sectitle = $newcontent[$sofar-1];
$newcontent[$sofar-1] = '<div style="padding-left: 5px; padding-bottom: 0.5em; float:right;"><a onclick="window.open(\'pages/page_'.$pno.'\');return false;" href="#" id="pg'.($numb+0).'">Page '.($numb+0).'</a></div>'."\n";
$newcontent[] = $sectitle;
}
$newcontent [] = $line;
continue;
}
if ( strpos($line, "[comment]: <> (page") === 0 ) {
$pieces = preg_split("/[\s,(){}]+/", $line);
$page = false;
Expand Down

0 comments on commit 6418337

Please sign in to comment.