00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00029 class Paragraph extends Tpl
00030 {
00031 function Paragraph()
00032 {
00033 static $id = 'Paragraph_01';
00034
00035 Tpl::Tpl('Paragraph');
00036 $this->id = $id++;
00037 }
00038
00039 function to_html($indent, $class)
00040 {
00041 $html = ("\n$indent<p $class>"
00042 . Tpl::to_html($indent, $class)
00043 . "</p>\n");
00044 return $html;
00045 }
00046
00047 function to_xml($indent)
00048 {
00049 $pattern1 = '#^(\\s*<comment>\\d+</comment>\\s*)+$#';
00050 $contents = implode("\n", $this->contents);
00051 if (preg_match($pattern1, $contents))
00052 {
00053
00054 $xml = "\n$indent" . Tpl::to_xml($indent) . "\n";
00055 }
00056 else
00057 {
00058 $xml = ("\n$indent<para>"
00059 . Tpl::to_xml($indent)
00060 . "</para>\n");
00061 }
00062
00063 return $xml;
00064 }
00065 }
00066 ?>