SVN
| Revision 1490,
1.4 KB
checked in by anatoo, 10 months ago
(diff) |
|
0.2ブランチのリビジョン1489,1488の変更をtrunkに取り込んだ
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package HatenaSyntax |
|---|
| 4 | * @author anatoo<anatoo@nequal.jp> |
|---|
| 5 | * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|---|
| 6 | * @version $Id: HatenaSyntax.php 1159 2009-09-06 09:43:29Z anatoo $ |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | include_once 'PEG.php'; |
|---|
| 10 | include_once dirname(__FILE__) . '/HatenaSyntax/Node.php'; |
|---|
| 11 | include_once dirname(__FILE__) . '/HatenaSyntax/Locator.php'; |
|---|
| 12 | include_once dirname(__FILE__) . '/HatenaSyntax/Factory.php'; |
|---|
| 13 | include_once dirname(__FILE__) . '/HatenaSyntax/NodeCreater.php'; |
|---|
| 14 | include_once dirname(__FILE__) . '/HatenaSyntax/Renderer.php'; |
|---|
| 15 | include_once dirname(__FILE__) . '/HatenaSyntax/TOCRenderer.php'; |
|---|
| 16 | include_once dirname(__FILE__) . '/HatenaSyntax/Util.php'; |
|---|
| 17 | include_once dirname(__FILE__) . '/HatenaSyntax/TreeRenderer.php'; |
|---|
| 18 | include_once dirname(__FILE__) . '/HatenaSyntax/Tree.php'; |
|---|
| 19 | include_once dirname(__FILE__) . '/HatenaSyntax/Tree/INode.php'; |
|---|
| 20 | include_once dirname(__FILE__) . '/HatenaSyntax/Tree/Node.php'; |
|---|
| 21 | include_once dirname(__FILE__) . '/HatenaSyntax/Tree/Root.php'; |
|---|
| 22 | include_once dirname(__FILE__) . '/HatenaSyntax/Tree/Leaf.php'; |
|---|
| 23 | |
|---|
| 24 | class HatenaSyntax |
|---|
| 25 | { |
|---|
| 26 | static function parse($str) |
|---|
| 27 | { |
|---|
| 28 | return HatenaSyntax_Locator::it()->parser->parse(PEG::context($str)); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | static function render($str, $config = array()) |
|---|
| 32 | { |
|---|
| 33 | $node = self::parse($str); |
|---|
| 34 | $renderer = new HatenaSyntax_Renderer($config); |
|---|
| 35 | return $renderer->render($node); |
|---|
| 36 | } |
|---|
| 37 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.