class.Listing.php

Go to the documentation of this file.
00001 <?php
00002   /*
00003    This  file is part  of WikiConverter.   WikiConverter is  a program
00004    that  converts   text/wiki  into   other  formats  (like   html  or
00005    xml/docbook).
00006 
00007    Copyright (c) 2005 Dashamir Hoxha, dhoxha@inima.al
00008 
00009    WikiConverter  is free  software;  you can  redistribute it  and/or
00010    modify  it under the  terms of  the GNU  General Public  License as
00011    published by the Free Software  Foundation; either version 2 of the
00012    License, or (at your option) any later version.
00013 
00014    WikiConverter is  distributed in the  hope that it will  be useful,
00015    but  WITHOUT ANY  WARRANTY; without  even the  implied  warranty of
00016    MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
00017    General Public License for more details.
00018 
00019    You should have  received a copy of the  GNU General Public License
00020    along  with  WikiConverter; if  not,  write  to  the Free  Software
00021    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022    USA
00023   */
00024 
00029 class Listing extends Tpl
00030 {
00031   var $indent;
00032   var $bullet;
00033 
00034   function Listing($indent ='', $bullet ='*')
00035   {
00036     static $id = 'Listing_01';
00037                 
00038     Tpl::Tpl('Listing');
00039     $this->id = $id++;
00040     $this->indent = $indent;
00041     $this->bullet = $bullet;
00042   }
00043 
00044   function to_html($indent, $class)
00045   {
00046     //get the tag and the type of the list
00047     $b = $this->bullet;
00048     if ($b=='*')
00049       {
00050         $tag = 'ul';
00051         $type = '';
00052       }
00053     else
00054       {
00055         $tag = 'ol';
00056         $t = substr($b, 0, 1);
00057         $type = "type='$t'";
00058       }
00059 
00060     $html = ("\n$indent<$tag $type $class>"
00061              . Tpl::to_html($indent, $class)
00062              . "$indent</$tag>\n");
00063     return $html;
00064   }
00065 
00066   function to_xml($indent)
00067   {
00068     //get the tag and the type of the list
00069     $b = $this->bullet;
00070     if ($b=='*')
00071       {
00072         $tag = 'itemizedlist';
00073         $type = '';
00074       }
00075     else
00076       {
00077         $tag = 'orderedlist';
00078         switch ($b)
00079           {
00080           case '1.':
00081             $numeration = 'numeration="arabic"';
00082             break;
00083           case 'a.':
00084             $numeration = 'numeration="loweralpha"';
00085             break;
00086           case 'i.':
00087             $numeration = 'numeration="lowerroman"';
00088             break;
00089           case 'A.':
00090             $numeration = 'numeration="upperalpha"';
00091             break;
00092           case 'I.':
00093             $numeration = 'numeration="upperroman"';
00094             break;
00095           }
00096       }
00097 
00098     $html = ("\n$indent<$tag $numeration>"
00099              . Tpl::to_xml($indent)
00100              . "$indent</$tag>\n");
00101     return $html;
00102   }
00103 }
00104 ?>

Generated on Wed Jan 9 08:27:32 2008 for DokBookWiki by  doxygen 1.5.2