Kohana v3.3.5
This commit is contained in:
37
modules/userguide/.travis.yml
Normal file
37
modules/userguide/.travis.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
# Only build the main develop/master branches - feature branches will be covered by PRs
|
||||
branches:
|
||||
only:
|
||||
- /^[0-9\.]+\/(develop|master)$/
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- vendor
|
||||
- $HOME/.composer/cache
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- hhvm
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.3
|
||||
env: 'COMPOSER_PHPUNIT="lowest"'
|
||||
|
||||
before_script:
|
||||
- composer install --prefer-dist
|
||||
- if [ "$COMPOSER_PHPUNIT" = "lowest" ]; then composer update --prefer-lowest --with-dependencies phpunit/phpunit; fi;
|
||||
- vendor/bin/koharness
|
||||
|
||||
script:
|
||||
- cd /tmp/koharness && ./vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php
|
||||
|
||||
notifications:
|
||||
email: false
|
@@ -1,3 +1,10 @@
|
||||
# Kohana - userguide module
|
||||
|
||||
| ver | Stable | Develop |
|
||||
|-------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| 3.3.x | [](https://travis-ci.org/kohana/userguide) | [](https://travis-ci.org/kohana/userguide) |
|
||||
| 3.4.x | [](https://travis-ci.org/kohana/userguide) | [](https://travis-ci.org/kohana/userguide) |
|
||||
|
||||
## What needs to be done?
|
||||
|
||||
Most articles are stubs, with a couple links to pages to be used as a reference when writing the page. The idea is to use the information on those links to help write the new ones. Some of the old userguide pages can probably be mostly copied, with a few improvements, others will be better to be completely rewritten. If you ever have questions, please feel free to jump in the kohana irc channel.
|
||||
@@ -66,4 +73,4 @@ If you want to have parameters, only put the brackets around the class and funct
|
||||
|
||||
You may include a view by putting the name of the view in double curly brackets. **If the view is not found, no exception or error will be shown!** The curly brackets and view will simply be shown an the page as is.
|
||||
|
||||
{{some/view}}
|
||||
{{some/view}}
|
||||
|
@@ -3,8 +3,10 @@
|
||||
* Kohana user guide and api browser.
|
||||
*
|
||||
* @package Kohana/Userguide
|
||||
* @category Controllers
|
||||
* @category Controller
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
abstract class Kohana_Controller_Userguide extends Controller_Template {
|
||||
|
||||
@@ -76,7 +78,7 @@ abstract class Kohana_Controller_Userguide extends Controller_Template {
|
||||
);
|
||||
}
|
||||
// If we are in the api browser, show the menu and show the api browser in the breadcrumbs
|
||||
else if (Route::name($this->request->route()) == 'docs/api')
|
||||
elseif (Route::name($this->request->route()) == 'docs/api')
|
||||
{
|
||||
$this->template->menu = Kodoc::menu();
|
||||
|
||||
@@ -116,13 +118,13 @@ abstract class Kohana_Controller_Userguide extends Controller_Template {
|
||||
}
|
||||
|
||||
// Prevent "guide/module" and "guide/module/index" from having duplicate content
|
||||
if ( $page == 'index')
|
||||
if ($page == 'index')
|
||||
{
|
||||
return $this->error('Userguide page not found');
|
||||
}
|
||||
|
||||
// If a module is set, but no page was provided in the url, show the index page
|
||||
if ( ! $page )
|
||||
if ( ! $page)
|
||||
{
|
||||
$page = 'index';
|
||||
}
|
||||
@@ -141,12 +143,14 @@ abstract class Kohana_Controller_Userguide extends Controller_Template {
|
||||
Kodoc_Markdown::$image_url = URL::site($this->media->uri()).'/'.$module.'/';
|
||||
|
||||
// Set the page title
|
||||
$this->template->title = $page == 'index' ? Kohana::$config->load('userguide.modules.'.$module.'.name') : $this->title($page);
|
||||
$this->template->title = ($page == 'index')
|
||||
? Kohana::$config->load('userguide.modules.'.$module.'.name')
|
||||
: $this->title($page);
|
||||
|
||||
// Parse the page contents into the template
|
||||
Kodoc_Markdown::$show_toc = true;
|
||||
Kodoc_Markdown::$show_toc = TRUE;
|
||||
$this->template->content = Kodoc_Markdown::markdown(file_get_contents($file));
|
||||
Kodoc_Markdown::$show_toc = false;
|
||||
Kodoc_Markdown::$show_toc = FALSE;
|
||||
|
||||
// Attach this module's menu to the template
|
||||
$this->template->menu = Kodoc_Markdown::markdown($this->_get_all_menu_markdown());
|
||||
@@ -358,11 +362,7 @@ abstract class Kohana_Controller_Userguide extends Controller_Template {
|
||||
if ($file AND $text = file_get_contents($file))
|
||||
{
|
||||
// Add spans around non-link categories. This is a terrible hack.
|
||||
//echo Debug::vars($text);
|
||||
|
||||
//$text = preg_replace('/(\s*[\-\*\+]\s*)(.*)/','$1<span>$2</span>',$text);
|
||||
$text = preg_replace('/^(\s*[\-\*\+]\s*)([^\[\]]+)$/m','$1<span>$2</span>',$text);
|
||||
//echo Debug::vars($text);
|
||||
$markdown .= $text;
|
||||
}
|
||||
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc {
|
||||
|
||||
@@ -34,6 +34,10 @@ class Kohana_Kodoc {
|
||||
{
|
||||
$member = '#property:'.substr($matches[3], 1);
|
||||
}
|
||||
elseif (preg_match('/^[A-Z_\x7f-\xff][A-Z0-9_\x7f-\xff]*$/', $matches[3]))
|
||||
{
|
||||
$member = '#constant:'.substr($matches[3],0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$member = '#'.$matches[3];
|
||||
@@ -275,7 +279,7 @@ class Kohana_Kodoc {
|
||||
* @param string $text Content of the tag
|
||||
* @return void
|
||||
*/
|
||||
$add_tag = function($tag, $text) use ($html, &$tags)
|
||||
$add_tag = function ($tag, $text) use ($html, & $tags)
|
||||
{
|
||||
// Don't show @access lines, they are shown elsewhere
|
||||
if ($tag !== 'access')
|
||||
@@ -290,7 +294,7 @@ class Kohana_Kodoc {
|
||||
}
|
||||
};
|
||||
|
||||
$comment = $tag = null;
|
||||
$comment = $tag = NULL;
|
||||
$end = count($lines[1]) - 1;
|
||||
|
||||
foreach ($lines[1] as $i => $line)
|
||||
@@ -415,12 +419,12 @@ class Kohana_Kodoc {
|
||||
*
|
||||
* Module developers can therefore add their own transparent extension
|
||||
* namespaces and exclude them from the userguide.
|
||||
*
|
||||
* @param string $class The name of the class to check for transparency
|
||||
* @param array $classes An optional list of all defined classes
|
||||
* @return false If this is not a transparent extension class
|
||||
* @return string The name of the class that extends this (in the case provided)
|
||||
* @throws InvalidArgumentException If the $classes array is provided and the $class variable is not lowercase
|
||||
*
|
||||
* @param string $class The name of the class to check for transparency
|
||||
* @param array $classes An optional list of all defined classes
|
||||
* @return false If this is not a transparent extension class
|
||||
* @return string The name of the class that extends this (in the case provided)
|
||||
* @throws InvalidArgumentException If the $classes array is provided and the $class variable is not lowercase
|
||||
*/
|
||||
public static function is_transparent($class, $classes = NULL)
|
||||
{
|
||||
@@ -447,11 +451,11 @@ class Kohana_Kodoc {
|
||||
// Cater for Foo extends Module_Foo naming
|
||||
$child_class = $segments[1];
|
||||
}
|
||||
|
||||
|
||||
// It is only a transparent class if the unprefixed class also exists
|
||||
if ($classes AND ! isset($classes[$child_class]))
|
||||
return FALSE;
|
||||
|
||||
|
||||
// Return the name of the child class
|
||||
return $child_class;
|
||||
}
|
||||
@@ -462,5 +466,4 @@ class Kohana_Kodoc {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // End Kodoc
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
@@ -45,7 +45,7 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
* the class. Reads the class modifiers, constants and comment. Parses the
|
||||
* comment to find the description and tags.
|
||||
*
|
||||
* @param string class name
|
||||
* @param string Class name
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($class)
|
||||
@@ -59,7 +59,7 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
$this->constants = $this->class->getConstants();
|
||||
|
||||
// If ReflectionClass::getParentClass() won't work if the class in
|
||||
// If ReflectionClass::getParentClass() won't work if the class in
|
||||
// question is an interface
|
||||
if ($this->class->isInterface())
|
||||
{
|
||||
@@ -154,7 +154,7 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
return $props;
|
||||
}
|
||||
|
||||
|
||||
protected function _prop_sort($a, $b)
|
||||
{
|
||||
// If one property is public, and the other is not, it goes on top
|
||||
@@ -162,13 +162,13 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
return -1;
|
||||
if ($b->isPublic() AND ( ! $a->isPublic()))
|
||||
return 1;
|
||||
|
||||
|
||||
// If one property is protected and the other is private, it goes on top
|
||||
if ($a->isProtected() AND $b->isPrivate())
|
||||
return -1;
|
||||
if ($b->isProtected() AND $a->isPrivate())
|
||||
return 1;
|
||||
|
||||
|
||||
// Otherwise just do alphabetical
|
||||
return strcmp($a->name, $b->name);
|
||||
}
|
||||
@@ -191,14 +191,15 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
return $methods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sort methods based on their visibility and declaring class based on:
|
||||
* - methods will be sorted public, protected, then private.
|
||||
* - methods that are declared by an ancestor will be after classes
|
||||
*
|
||||
* * methods will be sorted public, protected, then private.
|
||||
* * methods that are declared by an ancestor will be after classes
|
||||
* declared by the current class
|
||||
* - lastly, they will be sorted alphabetically
|
||||
*
|
||||
* * lastly, they will be sorted alphabetically
|
||||
*
|
||||
*/
|
||||
protected function _method_sort($a, $b)
|
||||
{
|
||||
@@ -207,16 +208,16 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
return -1;
|
||||
if ($b->isPublic() AND ( ! $a->isPublic()))
|
||||
return 1;
|
||||
|
||||
|
||||
// If one method is protected and the other is private, it goes on top
|
||||
if ($a->isProtected() AND $b->isPrivate())
|
||||
return -1;
|
||||
if ($b->isProtected() AND $a->isPrivate())
|
||||
return 1;
|
||||
|
||||
|
||||
// The methods have the same visibility, so check the declaring class depth:
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
echo Debug::vars('a is '.$a->class.'::'.$a->name,'b is '.$b->class.'::'.$b->name,
|
||||
'are the classes the same?', $a->class == $b->class,'if they are, the result is:',strcmp($a->name, $b->name),
|
||||
@@ -276,4 +277,5 @@ class Kohana_Kodoc_Class extends Kodoc {
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
} // End Kodoc_Class
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
|
||||
@@ -21,9 +21,10 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
public static $image_url = '';
|
||||
|
||||
/**
|
||||
* Currently defined heading ids.
|
||||
* Currently defined heading ids.
|
||||
* Used to prevent creating multiple headings with same id.
|
||||
* @var array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_heading_ids = array();
|
||||
|
||||
@@ -36,7 +37,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
* Slightly less terrible way to make it so the TOC only shows up when we
|
||||
* want it to. set this to true to show the toc.
|
||||
*/
|
||||
public static $show_toc = false;
|
||||
public static $show_toc = FALSE;
|
||||
|
||||
/**
|
||||
* Transform some text using [Kodoc_Markdown]
|
||||
@@ -78,8 +79,8 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
// Show table of contents for userguide pages
|
||||
$this->document_gamut['doTOC'] = 100;
|
||||
|
||||
// PHP4 makes me sad.
|
||||
parent::MarkdownExtra_Parser();
|
||||
// Call parent constructor.
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,25 +89,27 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
* Heading 1
|
||||
* =========
|
||||
*
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
*/
|
||||
function _doHeaders_callback_setext($matches)
|
||||
function _doHeaders_callback_setext($matches)
|
||||
{
|
||||
if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
|
||||
if ($matches[3] == '-' AND preg_match('{^- }', $matches[1]))
|
||||
return $matches[0];
|
||||
$level = $matches[3]{0} == '=' ? 1 : 2;
|
||||
$level = ($matches[3]{0} == '=') ? 1 : 2;
|
||||
$attr = $this->_doHeaders_attr($id =& $matches[2]);
|
||||
|
||||
// Only auto-generate id if one doesn't exist
|
||||
if(empty($attr))
|
||||
if (empty($attr))
|
||||
{
|
||||
$attr = ' id="'.$this->make_heading_id($matches[1]).'"';
|
||||
}
|
||||
|
||||
// Add this header to the page toc
|
||||
$this->_add_to_toc($level,$matches[1],$this->make_heading_id($matches[1]));
|
||||
|
||||
$block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";
|
||||
return "\n" . $this->hashBlock($block) . "\n\n";
|
||||
return "\n".$this->hashBlock($block)."\n\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,23 +117,25 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* # Heading 1
|
||||
*
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
* @param array Matches from regex call
|
||||
* @return string Generated html
|
||||
*/
|
||||
function _doHeaders_callback_atx($matches)
|
||||
function _doHeaders_callback_atx($matches)
|
||||
{
|
||||
$level = strlen($matches[1]);
|
||||
$attr = $this->_doHeaders_attr($id =& $matches[3]);
|
||||
|
||||
// Only auto-generate id if one doesn't exist
|
||||
if(empty($attr))
|
||||
if (empty($attr))
|
||||
{
|
||||
$attr = ' id="'.$this->make_heading_id($matches[2]).'"';
|
||||
}
|
||||
|
||||
// Add this header to the page toc
|
||||
$this->_add_to_toc($level, $matches[2], $this->make_heading_id(empty($matches[3]) ? $matches[2] : $matches[3]));
|
||||
|
||||
$block = "<h$level$attr>".$this->runSpanGamut($matches[2])."</h$level>";
|
||||
return "\n" . $this->hashBlock($block) . "\n\n";
|
||||
return "\n".$this->hashBlock($block)."\n\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -138,14 +143,14 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
* Makes a heading id from the heading text
|
||||
* If any heading share the same name then subsequent headings will have an integer appended
|
||||
*
|
||||
* @param string The heading text
|
||||
* @return string ID for the heading
|
||||
* @param string The heading text
|
||||
* @return string ID for the heading
|
||||
*/
|
||||
function make_heading_id($heading)
|
||||
{
|
||||
$id = url::title($heading, '-', TRUE);
|
||||
|
||||
if(isset($this->_heading_ids[$id]))
|
||||
if (isset($this->_heading_ids[$id]))
|
||||
{
|
||||
$id .= '-';
|
||||
|
||||
@@ -155,8 +160,8 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
{
|
||||
$id .= $count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
@@ -166,8 +171,6 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
{
|
||||
$replace = array();
|
||||
|
||||
$replace = array();
|
||||
|
||||
foreach ($matches as $set)
|
||||
{
|
||||
list($search, $view) = $set;
|
||||
@@ -203,7 +206,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* [filesystem](about.filesystem "Optional title")
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doBaseURL($text)
|
||||
@@ -217,7 +220,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* 
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doImageURL($text)
|
||||
@@ -231,7 +234,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* [Class_Name], [Class::method] or [Class::$property]
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doAPI($text)
|
||||
@@ -244,7 +247,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
*
|
||||
* [!!] Remember the milk!
|
||||
*
|
||||
* @param string span text
|
||||
* @param string Span text
|
||||
* @return string
|
||||
*/
|
||||
public function doNotes($text)
|
||||
@@ -264,7 +267,7 @@ class Kohana_Kodoc_Markdown extends MarkdownExtra_Parser {
|
||||
'name' => $name,
|
||||
'id' => $id);
|
||||
}
|
||||
|
||||
|
||||
public function doTOC($text)
|
||||
{
|
||||
// Only add the toc do userguide pages, not api since they already have one
|
||||
|
@@ -5,28 +5,28 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Method extends Kodoc {
|
||||
|
||||
/**
|
||||
* @var ReflectionMethod The ReflectionMethod for this class
|
||||
* @var ReflectionMethod The ReflectionMethod for this class
|
||||
*/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* @var array array of Kodoc_Method_Param
|
||||
* @var array Array of Kodoc_Method_Param
|
||||
*/
|
||||
public $params;
|
||||
|
||||
/**
|
||||
* @var array the things this function can return
|
||||
* @var array The things this function can return
|
||||
*/
|
||||
public $return = array();
|
||||
|
||||
/**
|
||||
* @var string the source code for this function
|
||||
* @var string The source code for this function
|
||||
*/
|
||||
public $source;
|
||||
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Method_Param extends Kodoc {
|
||||
|
||||
|
@@ -7,6 +7,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Undocumented
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
* @since 3.0.7
|
||||
*/
|
||||
abstract class Kohana_Kodoc_Missing {
|
||||
|
@@ -5,8 +5,8 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Base
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2009-2012 Kohana Team
|
||||
* @license http://kohanaphp.com/license
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_Kodoc_Property extends Kodoc {
|
||||
|
||||
|
@@ -24,10 +24,18 @@
|
||||
"kohana/core": ">=3.3",
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"kohana/core": "3.3.*@dev",
|
||||
"kohana/unittest": "3.3.*@dev",
|
||||
"kohana/koharness": "*@dev"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-3.3/develop": "3.3.x-dev",
|
||||
"dev-3.4/develop": "3.4.x-dev"
|
||||
}
|
||||
},
|
||||
"installer-paths": {
|
||||
"vendor/{$vendor}/{$name}": ["type:kohana-module"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,16 +20,16 @@ return array
|
||||
|
||||
// Whether this modules userguide pages should be shown
|
||||
'enabled' => TRUE,
|
||||
|
||||
|
||||
// The name that should show up on the userguide index page
|
||||
'name' => 'Userguide',
|
||||
|
||||
// A short description of this module, shown on the index page
|
||||
'description' => 'Documentation viewer and api generation.',
|
||||
|
||||
|
||||
// Copyright message, shown in the footer for this module
|
||||
'copyright' => '© 2008–2012 Kohana Team',
|
||||
)
|
||||
'copyright' => '© 2008–2014 Kohana Team',
|
||||
)
|
||||
),
|
||||
|
||||
// Set transparent class name segments
|
||||
|
@@ -1,38 +1,42 @@
|
||||
# Adding your module to the userguide
|
||||
# Adding your module
|
||||
|
||||
Making your module work with the userguide is simple.
|
||||
Making your module work with the User Guide is simple.
|
||||
|
||||
First, copy this config and place in it `<module>/config/userguide.php`, replacing anything in `<>` with the appropriate things:
|
||||
First, copy this config and place in it `<module>/config/userguide.php`, replacing anything in `<>` with the appropriate values:
|
||||
|
||||
return array
|
||||
(
|
||||
// Leave this alone
|
||||
'modules' => array(
|
||||
|
||||
// This should be the path to this modules userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename'
|
||||
|
||||
/*
|
||||
* The path to this module's userguide pages, without the 'guide/'.
|
||||
*
|
||||
* For example, '/guide/modulename/' would be 'modulename'
|
||||
*/
|
||||
'<modulename>' => array(
|
||||
|
||||
// Whether this modules userguide pages should be shown
|
||||
|
||||
// Whether this module's user guide pages should be shown
|
||||
'enabled' => TRUE,
|
||||
|
||||
// The name that should show up on the userguide index page
|
||||
|
||||
// The name that should show up on the user guide index page
|
||||
'name' => '<Module Name>',
|
||||
|
||||
|
||||
// A short description of this module, shown on the index page
|
||||
'description' => '<Description goes here.>',
|
||||
|
||||
'description' => '<Description goes here>',
|
||||
|
||||
// Copyright message, shown in the footer for this module
|
||||
'copyright' => '© 2010–2011 <Your Name>',
|
||||
)
|
||||
'copyright' => '© 2012 <Your Name>',
|
||||
)
|
||||
),
|
||||
|
||||
/*
|
||||
* If you use transparent extension outside the Kohana_ namespace,
|
||||
* If you use transparent extensions outside the Kohana_ namespace,
|
||||
* add your class prefix here. Both common Kohana naming conventions are
|
||||
* excluded:
|
||||
* excluded:
|
||||
* - Modulename extends Modulename_Core
|
||||
* - Foo extends Modulename_Foo
|
||||
*
|
||||
*
|
||||
* For example, if you use Modulename_<class_name> for your base classes
|
||||
* then you would define:
|
||||
*/
|
||||
@@ -41,7 +45,11 @@ First, copy this config and place in it `<module>/config/userguide.php`, replaci
|
||||
)
|
||||
);
|
||||
|
||||
Next, create a folder in your module directory called `guide/<modulename>` and create `index.md` and `menu.md`. All userguide pages use [Markdown](markdown). The index page is what is shown on the index of your module, the menu is what shows up in the side column. The menu should be formatted like this:
|
||||
Next, create a folder in your module directory called `guide/<modulename>` and create `index.md` and `menu.md`. The contents of `index.md` is what is shown on the index page of your module.
|
||||
|
||||
## Creating the side menu
|
||||
|
||||
The contents of the `menu.md` file is what shows up in the side column and should be formatted like this:
|
||||
|
||||
## [Module Name]()
|
||||
- [Page name](page-path)
|
||||
@@ -52,4 +60,16 @@ Next, create a folder in your module directory called `guide/<modulename>` and c
|
||||
- Categories do not have to be a link to a page
|
||||
- [Etcetera](etc)
|
||||
|
||||
Page paths are relative to `guide/<modulename>`. So `[Page name](path-path)` would look for `guide/<modulename>/page-name.md` and `[Another](category/another)` would look for `guide/<modulename>/page-name.md`. The guide pages can be named or arranged any way you want within that folder (with the exception of `menu.md` and `index.md`). The breadcrumbs and page titles are pulled from the `menu.md file`, not the file names or paths. You can have items that are not pages (a category that doesn't have a corresponding page). To link to the `index.md` page, you should have an empty link, e.g. `[Module Name]()`. Do not include `.md` in your links.
|
||||
You can have items that are not linked pages (a category that doesn't have a corresponding page).
|
||||
|
||||
Guide pages can be named or arranged any way you want within that folder (with the exception of `index.md` and `menu.md` which must appear directly below the `guide/` folder).
|
||||
|
||||
## Formatting page titles and links
|
||||
|
||||
Page paths are relative to `guide/<modulename>`. So `[Page name](page-name)` would look for `guide/<modulename>/page-name.md` and `[Another](category/another)` would look for `guide/<modulename>/category/another.md`.
|
||||
|
||||
The breadcrumbs and page titles are pulled from the `menu.md` file, not the filenames or paths.
|
||||
|
||||
To link to the `index.md` page, you should have an empty link, e.g. `[Module Name]()`. Do not include `.md` in your links.
|
||||
|
||||
All user guide pages use [Markdown](markdown).
|
@@ -1,7 +1,10 @@
|
||||
## [Userguide]()
|
||||
- [Using the Userguide](using)
|
||||
- [How userguide works](works)
|
||||
- [Contributing](contributing)
|
||||
- [Markdown Syntax](markdown)
|
||||
- [Configuration](config)
|
||||
- [Adding your module](adding)
|
||||
|
||||
- Getting Started
|
||||
- [Using the Userguide](using)
|
||||
- [How the Userguide works](works)
|
||||
- [Configuration](config)
|
||||
- Learning More
|
||||
- [Contributing](contributing)
|
||||
- [Markdown Syntax](markdown)
|
||||
- [Adding your module](adding)
|
8
modules/userguide/koharness.php
Normal file
8
modules/userguide/koharness.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
// Configuration for koharness - builds a standalone skeleton Kohana app for running unit tests
|
||||
return array(
|
||||
'modules' => array(
|
||||
'userguide' => __DIR__,
|
||||
'unittest' => __DIR__ . '/vendor/kohana/unittest'
|
||||
),
|
||||
);
|
@@ -99,7 +99,7 @@ h6:hover a.permalink {
|
||||
#kodoc-content,
|
||||
#kodoc-footer { float: left; clear: both; width: 100%; }
|
||||
|
||||
#kodoc-header { padding: 58px 0 2em; background: #77c244 url(../img/header.png) center top repeat-x; }
|
||||
#kodoc-header { padding: 20px 0 2em; background: #77c244 url(../img/header.png) center top repeat-x; }
|
||||
#kodoc-logo { display: block; float: left; }
|
||||
#kodoc-menu { float: right; margin-top: 12px; background: #113c32; -moz-border-radius: 5px; -webkit-border-radius: 5px; }
|
||||
#kodoc-menu ul { float: left; margin: 0; padding: 0 0.5em 0 0; }
|
||||
@@ -125,11 +125,23 @@ h6:hover a.permalink {
|
||||
|
||||
#kodoc-topics { }
|
||||
#kodoc-topics ul,
|
||||
#kodoc-topics ol { list-style-type:none; margin: 0; padding: 0;}
|
||||
#kodoc-topics ol { list-style-type:none; margin: 0 0 0 0; padding: 0;}
|
||||
#kodoc-topics ul li,
|
||||
#kodoc-topics ol li { margin:0; padding: 0; margin-left: 1em; }
|
||||
#kodoc-topics ul li a.current,
|
||||
#kodoc-topics ol li a.current { font-weight: bold; }
|
||||
|
||||
#kodoc-topics > ul > li {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#kodoc-topics > ul > li > a,
|
||||
#kodoc-topics > ul > li > span {
|
||||
font-weight: bold;
|
||||
color: #EE8C0E;
|
||||
}
|
||||
|
||||
|
||||
#kodoc-topics span,
|
||||
#kodoc-topics a { display: block; padding: 0; margin: 0; }
|
||||
#kodoc-topics span { cursor: pointer; }
|
||||
|
@@ -32,41 +32,6 @@ $(document).ready(function()
|
||||
});
|
||||
});
|
||||
|
||||
// Collapsing menus
|
||||
$('#kodoc-topics li:has(li)').each(function()
|
||||
{
|
||||
var $this = $(this);
|
||||
var toggle = $('<span class="toggle"></span>');
|
||||
var menu = $this.find('>ul,>ol');
|
||||
|
||||
toggle.click(function()
|
||||
{
|
||||
if (menu.is(':visible'))
|
||||
{
|
||||
menu.stop(true, true).slideUp('fast');
|
||||
toggle.html('+');
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.stop(true, true).slideDown('fast');
|
||||
toggle.html('–');
|
||||
}
|
||||
});
|
||||
|
||||
$this.find('>span').click(function()
|
||||
{
|
||||
// Menu without a link
|
||||
toggle.click();
|
||||
});
|
||||
|
||||
if ( ! $this.is(':has(a.current)'))
|
||||
{
|
||||
menu.hide();
|
||||
}
|
||||
|
||||
toggle.html(menu.is(':visible') ? '–' : '+').prependTo($this);
|
||||
});
|
||||
|
||||
// Show source links
|
||||
|
||||
$('#kodoc-main .method-source').each(function()
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* @package Kohana/Userguide
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2012 Kohana Team
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Kohana_KodocTest extends PHPUnit_Framework_TestCase
|
||||
@@ -88,7 +88,7 @@ COMMENT
|
||||
array(
|
||||
<<<'COMMENT'
|
||||
/**
|
||||
* @trailingspace
|
||||
* @trailingspace
|
||||
*/
|
||||
COMMENT
|
||||
,
|
||||
@@ -162,11 +162,11 @@ COMMENT
|
||||
array(
|
||||
<<<'COMMENT'
|
||||
/**
|
||||
* @copyright (c) 2012 Kohana Team
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
*/
|
||||
COMMENT
|
||||
,
|
||||
array('', array('copyright' => array('© 2012 Kohana Team'))),
|
||||
array('', array('copyright' => array('© 2008-2013 Kohana Team'))),
|
||||
),
|
||||
array(
|
||||
<<<'COMMENT'
|
||||
@@ -328,7 +328,7 @@ COMMENT
|
||||
{
|
||||
$this->assertSame($expected, Kodoc::parse($comment));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provides test data for test_transparent_classes
|
||||
* @return array
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* @package Kohana/Userguide
|
||||
* @category Tests
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2008-2012 Kohana Team
|
||||
* @copyright (c) 2008-2013 Kohana Team
|
||||
* @license http://kohanaframework.org/license
|
||||
*/
|
||||
class Userguide_ControllerTest extends Unittest_TestCase
|
||||
@@ -28,8 +28,8 @@ class Userguide_ControllerTest extends Unittest_TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider provider_file_finds_markdown_files
|
||||
* @param string $page Page name passed in the URL
|
||||
* @param string $expected_file Expected result from Controller_Userguide::file
|
||||
* @param string $page Page name passed in the URL
|
||||
* @param string $expected_file Expected result from Controller_Userguide::file
|
||||
*/
|
||||
public function test_file_finds_markdown_files($page, $expected_file)
|
||||
{
|
||||
@@ -42,4 +42,5 @@ class Userguide_ControllerTest extends Unittest_TestCase
|
||||
|
||||
$this->assertEquals($expected_file, $file);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -239,7 +239,7 @@ class Markdown_Parser {
|
||||
var $predef_titles = array();
|
||||
|
||||
|
||||
function Markdown_Parser() {
|
||||
function __construct() {
|
||||
#
|
||||
# Constructor function. Initialize appropriate member variables.
|
||||
#
|
||||
@@ -1669,7 +1669,7 @@ class MarkdownExtra_Parser extends Markdown_Parser {
|
||||
var $predef_abbr = array();
|
||||
|
||||
|
||||
function MarkdownExtra_Parser() {
|
||||
function __construct() {
|
||||
#
|
||||
# Constructor function. Initialize the parser object.
|
||||
#
|
||||
@@ -1695,7 +1695,7 @@ class MarkdownExtra_Parser extends Markdown_Parser {
|
||||
"doAbbreviations" => 70,
|
||||
);
|
||||
|
||||
parent::Markdown_Parser();
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
@@ -2906,4 +2906,4 @@ negligence or otherwise) arising in any way out of the use of this
|
||||
software, even if advised of the possibility of such damage.
|
||||
|
||||
*/
|
||||
?>
|
||||
?>
|
||||
|
@@ -38,6 +38,7 @@
|
||||
<div id="kodoc-content">
|
||||
<div class="wrapper">
|
||||
<div class="container">
|
||||
<?php if (count($breadcrumb) > 1): ?>
|
||||
<div class="span-22 prefix-1 suffix-1">
|
||||
<ul id="kodoc-breadcrumb">
|
||||
<?php foreach ($breadcrumb as $link => $title): ?>
|
||||
@@ -49,6 +50,7 @@
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="span-6 prefix-1">
|
||||
<div id="kodoc-topics">
|
||||
<?php echo $menu ?>
|
||||
|
Reference in New Issue
Block a user