Example #1
0
 private function printView()
 {
     $value = "";
     if ($this->tag["type"] == "chapter") {
         $part = getPart($this->tag["book_id"]);
         $value .= "<h3>Chapter " . $this->tag["book_id"] . ": " . $this->tag["name"] . "</h3>";
         $value .= "<p>This tag corresponds to <a href='" . href("chapter/" . $this->tag["book_id"]) . "'>Chapter " . $this->tag["book_id"] . ": " . parseAccents($this->tag["name"]) . "</a> of <a href='" . href("browse#" . partToIdentifier($part)) . "'>" . parseAccents($part) . "</a>, and contains no further text. To view the contents of the first section in this chapter, go to the next tag.</p>";
         $value .= "<p>This chapter contains the following tags</p>";
         $value .= "<div id='control'>";
         $value .= "<p><a href='#'><img src='" . href("js/jquery-treeview/images/minus.gif") . "'> Collapse all</a>";
         $value .= " ";
         $value .= "<a href='#'><img src='" . href("js/jquery-treeview/images/plus.gif") . "'> Expand all</a>";
         $value .= "</div>";
         $value .= "<div id='treeview'>";
         $value .= "<a href='" . href("tag/" . $this->tag["tag"]) . "'>Tag " . $this->tag["tag"] . "</a> points to Chapter " . $this->tag["book_id"] . ": " . parseAccents($this->tag["name"]);
         $value .= printToC($this->tag["book_id"]);
         $value .= "</div>";
         $value .= "<script type='text/javascript' src='" . href("js/chapter.js") . "'></script>";
     } else {
         // only display for non-chapters
         $value .= "<p id='code-link' class='toggle'><a href='#code'>code</a></p>";
         $value .= "<blockquote class='rendered'>";
         $value .= convertLaTeX($this->tag["tag"], $this->tag["file"], $this->tag["value"]);
         // handle footnotes
         global $footnotes;
         $value .= "<div class='footnotes'>";
         $value .= "<ol>";
         foreach ($footnotes as $i => $footnote) {
             $value .= "<li class='footnote' id='fn:" . $i . "'>" . $footnote . "<a href='#fnref:" . $i . "' title='return to main text'> &uarr;</a>";
         }
         $value .= "</ol>";
         $value .= "</div>";
         $value .= "</blockquote>";
     }
     // only display for non-chapters
     if ($this->tag["type"] != "chapter") {
         $value .= "<p id='rendered-link' class='toggle'><a href='#rendered'>view</a></p>";
         $value .= "<div id='code'>";
         $value .= "<p>The code snippet corresponding to this tag is a part of the file <a href='https://github.com/stacks/stacks-project/blob/master/" . $this->tag["file"] . ".tex'><var>" . $this->tag["file"] . ".tex</var></a> and is located in <a href='https://github.com/stacks/stacks-project/blob/master/" . $this->tag["file"] . ".tex#L" . $this->tag["begin"] . "-" . $this->tag["end"] . "'>lines " . $this->tag["begin"] . "&ndash;" . $this->tag["end"] . "</a> (see <a href='" . href("tags#stacks-epoch") . "'>updates</a> for more information).";
         $value .= "<pre><code>";
         $code = preprocessCode($this->tag["value"]);
         // link labels to the corresponding tag
         $count = preg_match_all('/\\\\label{([\\w-\\*]+)}/', $code, $references);
         for ($i = 0; $i < $count; ++$i) {
             $code = str_replace($references[0][$i], "\\label{<a href='" . href("tag/" . getTagWithLabel($this->tag["file"] . "-" . $references[1][$i])) . "'>" . $references[1][$i] . "</a>}", $code);
         }
         $value .= $code;
         $value .= "</code></pre>";
         $value .= "</div>";
     }
     $value .= $this->printNavigation();
     return $value;
 }
Example #2
0
 private function printPart($part)
 {
     $value = "";
     $value .= "<tr id='" . partToIdentifier($part) . "'>";
     $value .= "<td colspan='2'>" . parseAccents($part) . "</td>";
     $value .= "<td></td>";
     $value .= "<td></td>";
     $value .= "<td></td>";
     $value .= "</tr>";
     return $value;
 }