Skip to content

Commit

Permalink
adding support for INI files
Browse files Browse the repository at this point in the history
  • Loading branch information
ccampbell committed Sep 16, 2010
1 parent 1643719 commit 60f3250
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/Language/Ini.php
@@ -0,0 +1,26 @@
<?php
namespace Nijikodo\Language;

/**
* Ini code processor
*
* @package Language
* @subpackage Ini
* @author Craig Campbell <iamcraigcampbell@gmail.com>
*/
class Ini extends Generic
{
/**
* regex rules for ini files
*
* @return void
*/
protected function _preProcess()
{
parent::_addStringPattern();
parent::_addMathPattern();
parent::_addNumberPattern();
$this->_addPattern('/(\[.*\])/', '<span class="' . $this->_css_prefix . 'method">$1</span>');
$this->_addPattern('/\[(.*\s?\:\s?)(.*)\]/', '[$1<em>$2</em>]');
}
}
4 changes: 4 additions & 0 deletions lib/Nijikodo.php
Expand Up @@ -62,6 +62,10 @@ public static function toHtml($code, $language = null, $height = null)
require_once 'Language/Apache.php';
$code = new Nijikodo\Language\Apache($code);
break;
case 'ini':
require_once 'Language/Ini.php';
$code = new Nijikodo\Language\Ini($code);
break;
default:
$code = new Nijikodo\Language\Generic($code);
break;
Expand Down

0 comments on commit 60f3250

Please sign in to comment.