Fixed/added documentation and Travis file; getting ready for release.
Этот коммит содержится в:
родитель
6d5914049a
Коммит
32b1f93d14
5
.travis.yml
Обычный файл
5
.travis.yml
Обычный файл
@ -0,0 +1,5 @@
|
|||||||
|
language: php
|
||||||
|
php:
|
||||||
|
- 5.4
|
||||||
|
before_script:
|
||||||
|
- composer install --dev
|
@ -1,6 +1,6 @@
|
|||||||
# ChangeLog - PHP TOC
|
# ChangeLog - PHP TableOfContents (TOC)
|
||||||
All notable changes to this project are documented in this file.
|
All notable changes to this project are documented in this file.
|
||||||
|
|
||||||
## 1.0 - 2014-12-30
|
## 1.0 - 2014-12-30
|
||||||
### Added
|
### Added
|
||||||
- Initial Version
|
- Initial Version
|
||||||
|
4
LICENSE
4
LICENSE
@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014 Casey McLaughlin
|
Copyright (c) 2013-2014 Casey McLaughlin
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"knplabs/knp-menu": "~2.0"
|
"knplabs/knp-menu": "~2.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"twig/twig": "~1.13"
|
"twig/twig": "~1.13",
|
||||||
|
"phpunit/phpunit": "~4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,24 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by PhpStorm.
|
* PHP TableOfContents Library
|
||||||
* User: casey
|
*
|
||||||
* Date: 12/30/14
|
* @license http://opensource.org/licenses/MIT
|
||||||
* Time: 12:32 PM
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interprets header tags
|
* Trait that interprets HTML Header tags from a list of integers
|
||||||
*
|
*
|
||||||
* @package TOC
|
* @package TOC
|
||||||
*/
|
*/
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by PhpStorm.
|
* PHP TableOfContents Library
|
||||||
* User: casey
|
*
|
||||||
* Date: 12/30/14
|
* @license http://opensource.org/licenses/MIT
|
||||||
* Time: 12:20 PM
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
@ -1,7 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Header here
|
/**
|
||||||
// ---------------------------------------------------------------
|
* PHP TableOfContents Library
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/MIT
|
||||||
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
|
||||||
@ -14,7 +26,7 @@ use Sunra\PhpSimple\HtmlDomParser;
|
|||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TocGenerator
|
* Table Of Contents Generator generates TOCs from HTML Markup
|
||||||
*
|
*
|
||||||
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
@ -1,11 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP TableOfContents Library
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/MIT
|
||||||
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
|
||||||
use Twig_Extension;
|
use Twig_Extension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class TocTwigExtension
|
* Table of Contents Twig Extension Integrates with Twig
|
||||||
|
*
|
||||||
|
* Adds filter:
|
||||||
|
* - add_anchors
|
||||||
|
*
|
||||||
|
* Adds functions:
|
||||||
|
* - toc (returns HTML list)
|
||||||
|
* - toc_items (returns KnpMenu iterator)
|
||||||
*
|
*
|
||||||
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
*/
|
*/
|
||||||
@ -37,6 +59,9 @@ class TocTwigExtension extends Twig_Extension
|
|||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public function getFilters()
|
public function getFilters()
|
||||||
{
|
{
|
||||||
$filters = parent::getFilters();
|
$filters = parent::getFilters();
|
||||||
@ -50,16 +75,17 @@ class TocTwigExtension extends Twig_Extension
|
|||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public function getFunctions()
|
public function getFunctions()
|
||||||
{
|
{
|
||||||
$functions = parent::getFunctions();
|
$functions = parent::getFunctions();
|
||||||
|
|
||||||
// ~~~
|
// ~~~
|
||||||
|
|
||||||
$functions[] = new \Twig_SimpleFunction('toc', function($markup, $top = 1, $depth = 2, $titleTemplate = null) {
|
$functions[] = new \Twig_SimpleFunction('toc', function($markup, $top = 1, $depth = 2) {
|
||||||
return ($titleTemplate)
|
return $this->generator->getHtmlMenu($markup, $top, $depth);
|
||||||
? $this->generator->getHtmlMenu($markup, $top, $depth, $titleTemplate)
|
|
||||||
: $this->generator->getHtmlMenu($markup, $top, $depth);
|
|
||||||
}, ['is_safe' => ['html']]);
|
}, ['is_safe' => ['html']]);
|
||||||
|
|
||||||
// ~~~
|
// ~~~
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Created by PhpStorm.
|
*
|
||||||
* User: casey
|
* PHP TableOfContents Library
|
||||||
* Date: 12/30/14
|
*
|
||||||
* Time: 12:48 PM
|
* @license http://opensource.org/licenses/MIT
|
||||||
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
|
||||||
use Cocur\Slugify\Slugify;
|
use Cocur\Slugify\Slugify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UniqueSluggifier creates slugs text without repeating the same string twice per instance
|
* UniqueSluggifier creates slugs from text without repeating the same slug twice per instance
|
||||||
*
|
*
|
||||||
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
@ -1,13 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP TableOfContents Library
|
||||||
|
*
|
||||||
|
* @license http://opensource.org/licenses/MIT
|
||||||
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: casey
|
|
||||||
* Date: 12/30/14
|
|
||||||
* Time: 1:24 PM
|
|
||||||
*/
|
|
||||||
|
|
||||||
class MarkupFixerTest extends \PHPUnit_Framework_TestCase
|
class MarkupFixerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by PhpStorm.
|
* PHP TableOfContents Library
|
||||||
* User: casey
|
*
|
||||||
* Date: 12/30/14
|
* @license http://opensource.org/licenses/MIT
|
||||||
* Time: 12:39 PM
|
* @link https://github.com/caseyamcl/toc
|
||||||
|
* @version 1.0
|
||||||
|
* @package caseyamcl/toc
|
||||||
|
* @author Casey McLaughlin <caseyamcl@gmail.com>
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace TOC;
|
namespace TOC;
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user