Update of /cvsroot/phpwebapp/web_app/parser
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20861/parser
Modified Files:
class.Render.php class.Parser.php
Log Message:
handle textarea as preformated tag
Index: class.Render.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/parser/class.Render.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** class.Render.php 23 Jul 2004 09:40:17 -0000 1.15
--- class.Render.php 28 Jul 2004 14:26:55 -0000 1.16
***************
*** 189,199 ****
break;
case "PreTpl":
- $this->render_PreTpl($tpl);
- break;
case "XmpTpl":
- $this->render_XmpTpl($tpl);
- break;
case "ExampleTpl":
! $this->render_ExampleTpl($tpl);
break;
case "IfTpl":
--- 189,196 ----
break;
case "PreTpl":
case "XmpTpl":
case "ExampleTpl":
! case "TextAreaTpl":
! $this->render_preformated_tpl($tpl);
break;
case "IfTpl":
***************
*** 218,242 ****
}
! function render_PreTpl($tpl)
! {
! $attr_list = $tpl->vars['attr_list'];
! $tpl->contents = "<pre$attr_list>".$tpl->contents."</pre>";
! $this->render_tpl_unindented($tpl);
! }
!
! function render_XmpTpl($tpl)
{
$attr_list = $tpl->vars['attr_list'];
! $tpl->contents = "<xmp$attr_list>".$tpl->contents."</xmp>";
$this->render_tpl_unindented($tpl);
}
- function render_ExampleTpl($tpl)
- {
- $attr_list = $tpl->vars['attr_list'];
- $contents = $tpl->contents;
- $this->output("<xmp$attr_list>".$contents."</xmp>");
- }
-
/**
* Renders the given IfTpl, if its $condition evaluates to true.
--- 215,227 ----
}
! function render_preformated_tpl($tpl)
{
+ $tag = substr($tpl->type, 0, -3);
+ $tag = strtolower($tag);
$attr_list = $tpl->vars['attr_list'];
! $tpl->contents = "<$tag$attr_list>".$tpl->contents."</$tag>";
$this->render_tpl_unindented($tpl);
}
/**
* Renders the given IfTpl, if its $condition evaluates to true.
Index: class.Parser.php
===================================================================
RCS file: /cvsroot/phpwebapp/web_app/parser/class.Parser.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** class.Parser.php 22 Jul 2004 16:25:37 -0000 1.17
--- class.Parser.php 28 Jul 2004 14:26:55 -0000 1.18
***************
*** 310,313 ****
--- 310,314 ----
case 'XMP':
case 'EXAMPLE':
+ case 'TEXTAREA':
$start_ELEMENT = 'start_'.$name;
$this->$start_ELEMENT($attribs);
***************
*** 358,361 ****
--- 359,363 ----
case 'PRE':
case 'XMP':
+ case 'TEXTAREA':
$end_ELEMENT = 'end_'.$name;
$this->$end_ELEMENT();
***************
*** 1027,1030 ****
--- 1029,1046 ----
}
+ function start_TEXTAREA($attribs)
+ {
+ static $tpl_id = "TextArea_001";
+ $tpl = new Template($tpl_id++, 'TextAreaTpl');
+ $tpl->addVar('attr_list', $this->get_attr_list($attribs));
+ $this->push_current_tpl($tpl);
+ }
+ function end_TEXTAREA()
+ {
+ //the param 'false' in order not to normalize space
+ $tpl = $this->pop_current_tpl(false);
+ $this->link_template($tpl);
+ }
+
function start_EXAMPLE($attribs)
{
|