================================================================================
-VERSION 0.9.5 24 Jan 2004
+VERSION 0.9.5 07 Apr 2004
New :
- Improve login/exit wrt cookie. -MC
* Docs :
- - use of secure SMTP on a pocket PC -Car
+ - use of secure SMTP on a pocket PC. -Car
* Fiche :
- - A public fiche is now available for visiters. -Car
+ - A public fiche is now available for visitors. -Car
* Money :
- lighter code and support for a PayPal account. -Car
* Profile :
- One can choose precisely which fields appear on his public fiche. -Car
- Accents and special chars in name and first name -Car
- - Spouse name extended to usage name -Car
+ - Spouse name extended to usage name. -Car
* Register :
- Already subscribed members now have a warning. -MC
class XOrgWikiParser
{
- // {{{ properties
-
- var $max_title_level = 3;
- var $enable_img = true;
- var $enable_hr = true;
-
- // }}}
// {{{ constructor
function XOrgWikiParser()
function _analyse(&$line)
{
$types = Array();
- $modes = Array( '>'=>'blockquote', '.'=>'pre', '-'=>'ul', '#'=>'ol');
-
- for ($i = 1; $i <= $this->max_title_level; $i++) {
- $modes[str_pad('!', $i, '!')] = "h$i";
- }
+ $modes = Array( '>'=>'blockquote', '.'=>'pre', '-'=>'ul', '#'=>'ol', '!!' => 'h2', '!' => 'h1');
- /* non - nesting blocks */
- $hre = $this->max_title_level ? str_pad('!', $this->max_title_level * 2 - 1, '!?') : '';
-
- if (preg_match("/^($hre|[.>])/", $line, $m)) {
+ if (preg_match("/^(!!?|[.>])/", $line, $m)) {
$types[] = $modes[$m[1]];
return Array($types, substr($line, strlen($m[1])));
}
- /* hr */
- if ($this->enable_hr && $line == '----') {
- return Array(Array('hr'), '');
- }
-
/* nesting blocks */
$pos = 0;
while ($line{$pos} == '-' || $line{$pos} == '#') {
case '\\':
if ($i + 1 < $len) {
- if (strpos('*/_{}[()', $d = $line{$i+1}) !== false) {
+ if (strpos('*/_{}[', $d = $line{$i+1}) !== false) {
$cur .= $d;
$i += 2;
break;
$i ++;
break;
- case '(':
- if (!$this->enable_img) {
- break;
- }
case '[':
- $re = ( $c=='[' ? ',^\[([^|]*)\|([^]]*)\],' : ',^\(([^|]*)\|([^)]*)\),' );
- if (preg_match($re, substr($line, $i), $m)) {
+ if (preg_match(',^\[([^|]*)\|([^]]*)\],', substr($line, $i), $m)) {
$lexm[] = $cur;
- if ($c == '[') {
- $lexm[] = new XOrgWikiAST('a', Array($m[1]), Array('href'=>$m[2]));
- } else {
- $lexm[] = new XOrgWikiAST('img', Array($m[1]), Array('src'=>$m[2]));
- }
+ $lexm[] = new XOrgWikiAST('a', Array($m[1]), Array('href'=>$m[2]));
$cur = '';
$i += strlen($m[0]);
break;