12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- require_once __DIR__.'/libraries/markdown.php';
- function doc_root()
- {
- return path('sys').'documentation/';
- }
- function document($page)
- {
- return Markdown(file_get_contents(doc_root().$page.'.md'));
- }
- function document_exists($page)
- {
- return file_exists(doc_root().$page.'.md');
- }
- View::composer('docs::template', function($view)
- {
- $view->with('sidebar', document('contents'));
- });
- Route::get('(:bundle)', function()
- {
- return View::make('docs::page')->with('content', document('home'));
- });
- Route::get('(:bundle)/(:any)/(:any?)', function($section, $page = null)
- {
- $file = rtrim(implode('/', func_get_args()), '/');
-
-
-
- if (is_null($page) and document_exists($file.'/home'))
- {
- $file .= '/home';
- }
- if (document_exists($file))
- {
- return View::make('docs::page')->with('content', document($file));
- }
- else
- {
- return Response::error('404');
- }
- });
|