diff --git a/code/DocumentationViewer.php b/code/DocumentationViewer.php index 9e333da..9e9f451 100755 --- a/code/DocumentationViewer.php +++ b/code/DocumentationViewer.php @@ -23,7 +23,7 @@ class DocumentationViewer extends Controller { * * @var array */ - static $ignored_files = array('.', '..', '.DS_Store', '.svn', '.git'); + static $ignored_files = array('.', '..', '.DS_Store', '.svn', '.git', 'assets'); /** * Documentation Home @@ -101,14 +101,12 @@ class DocumentationViewer extends Controller { $class = $request->param('Class'); $module = $request->param('Module'); - if(!stripos($class, '.md')) $class .= '.md'; - $this->writeHeader($class, $module); $base = Director::baseURL(); // find page - $path = BASE_PATH . '/'. $module .'/doc/'; + $path = BASE_PATH . '/'. $module .'/doc'; echo "
"; if($page = $this->findPage($path, $class)) { @@ -120,7 +118,7 @@ class DocumentationViewer extends Controller { echo "
"; - echo ' + echo ' '; @@ -202,18 +200,22 @@ class DocumentationViewer extends Controller { if($handle) { while (false !== ($file = readdir($handle))) { + $newpath = $path .'/'. $file; + if(!in_array($file, self::$ignored_files)) { - if(is_dir($path.$file)) { + + if(is_dir($newpath)) { // keep looking down the tree - return $this->findPage($path.$file, $name); + return $this->findPage($newpath, $name); } - elseif(strtolower($file) == strtolower($name)) { - return $path .'/'. $file; + + elseif(strtolower($this->formatStringForTitle($file)) == strtolower($name)) { + return $newpath; } } } } - + return false; } @@ -251,7 +253,9 @@ class DocumentationViewer extends Controller { } else { - $file = str_ireplace('.md', '', $file); + $offset = (strpos($file,'-') > 0) ? strpos($file,'-') + 1 : 0; + + $file = substr(str_ireplace('.md', '', $file), $offset); echo "
  • ". $this->formatStringForTitle($file) ."
  • "; } @@ -279,7 +283,7 @@ class DocumentationViewer extends Controller { $title = str_ireplace('-', ' ', $title); // remove extension - $title = str_ireplace('.md', ' ', $title); + $title = str_ireplace('.md', '', $title); return $title; } diff --git a/css/DocumentationViewer.css b/css/DocumentationViewer.css index 7993682..fc6aa17 100644 --- a/css/DocumentationViewer.css +++ b/css/DocumentationViewer.css @@ -21,10 +21,11 @@ ul { margin: 8px 16px 20px 20px; } li { font-size: 12px; line-height: 18px; margin-bottom: 8px;} -h1 { font-size: 24px; margin-bottom: 18px; } -h2 { font-size: 18px; margin-bottom: 16px; } -h3 { font-size: 16px; margin-bottom: 16px; } -h4 { font-size: 14px; margin-bottom: 8px; } +h1 { font-size: 30px; margin-bottom: 18px; } +h2 { font-size: 24px; margin-bottom: 16px; } +h3 { font-size: 18px; margin-bottom: 16px; } +h4 { font-size: 16px; margin-bottom: 6px; line-height: 16px;} +h5 { font-size: 14px; line-height: 18px; margin-bottom: 6px;} pre { margin-bottom: 18px; @@ -59,7 +60,7 @@ pre { -moz-border-radius: 4px; -webkit-border-radius: 4px; } - .box h2 { + #Home .box h2 { background: #535360; border: 1px solid #535360; -moz-border-top-radius: 4px; @@ -70,7 +71,7 @@ pre { color: #fff; font-size: 13px; } - .box h2 a { + #Home .box h2 a { background: url(../images/readme.png) no-repeat right center; padding: 2px 20px 0 0; font-size: 11px; @@ -105,4 +106,29 @@ pre { clear: both; padding-top: 10px; font-style: italic; -} \ No newline at end of file +} + +/** + * TOC + */ + +ul#toc { + margin: 0; + padding: 10px; + background: #f4f4f4; + width: 220px; + position: fixed; +} + ul#toc li { + list-style: none; + margin: 0 0 4px 0; + } + ul#toc li.h2 { + margin-left: 10px; + } + ul#toc li.h3 { + margin-left: 20px; + } + ul#toc li.h4 { + margin-right: 30px; + } \ No newline at end of file diff --git a/javascript/DocumentationViewer.js b/javascript/DocumentationViewer.js index 6e1dcae..aab0c74 100644 --- a/javascript/DocumentationViewer.js +++ b/javascript/DocumentationViewer.js @@ -1,7 +1,7 @@ $(document).ready(function() { var toc = '