OSDN Git Service

lastオブジェクトの初期化チェック
[pukiwiki/pukiwiki.git] / convert_html.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: convert_html.php,v 1.7 2003/01/31 09:49:03 panda Exp $
6 //
7
8 function &convert_html(&$lines)
9 {
10         global $script,$vars,$digest;
11         static $contents_id = 0;
12
13         $digest = md5(join('',get_source($vars['page'])));
14
15         $contents = new Contents(++$contents_id);
16
17         $body = new Body();
18         $last =& $body;
19
20         foreach ($lines as $line) {
21                 if (substr($line,0,2) == '//') { //¥³¥á¥ó¥È¤Ï½èÍý¤·¤Ê¤¤
22                         continue;
23                 }
24                 
25                 $line = rtrim($line);
26                 
27                 $align = '';
28                 if (preg_match('/^(LEFT|CENTER|RIGHT):(.*)$/',$line,$matches)) {
29                         $last =& $last->add(new Align(strtolower($matches[1]))); // <div style="text-align:...">
30                         if ($matches[2] == '') {
31                                 continue;
32                         }
33                         $line = $matches[2];
34                 }
35                 
36                 // ¹ÔƬʸ»ú
37                 $head = substr($line,0,1);
38                 
39                 if ($line == '') { // ¶õ¹Ô
40                         $last =& $body;
41                 }
42                 else if (substr($line,0,4) == '----') { // HRule
43                         $last =& $body->insert(new HRule());
44                 }
45                 else if ($head == ' ' or $head == "\t") { // Pre
46                         $last =& $last->add(new Pre($line));
47                 }
48                 else if ($head == '*') { // Heading
49                         $last =& $body->insert(new Heading($line, $contents));
50                 }
51                 else {
52                         if (substr($line,-1) == '~') {
53                                 $line .= "\r";
54                         }
55                         if      ($head == '-') { // UList
56                                 $last =& $last->add(new UList($line));
57                         }
58                         else if ($head == '+') { // OList
59                                 $last =& $last->add(new OList($line));
60                         }
61                         else if ($head == ':') { // DList
62                                 $last =& $last->add(new DList($line));
63                         }
64                         else if ($head == '|') { // Table
65                                 $last =& $last->add(new Table($line));
66                         }
67                         else if ($head == ',') { // Table(YukiWiki¸ß´¹)
68                                 $last =& $last->add(new YTable($line));
69                         }
70                         else if ($head == '>') { // BrockQuote
71                                 $last =& $last->add(new BQuote($line));
72                         }
73                         else if ($head == '<') { // BlockQuote end
74                                 $last =& bq_end($last, $line);
75                         }
76                         else if ($head == '#') { // Div
77                                 $last =& $last->add(new Div($line));
78                         }
79                         else { // Ä̾ïʸ»úÎó
80                                 $last =& $last->add(new Inline($line));
81                         }
82                 }
83         }
84         $ret = $body->toString();
85         
86         // #contents
87         $ret = preg_replace("/<p>#contents<\/p>/",$contents->getContents(),$ret);
88         
89         // ´ØÏ¢¤¹¤ë¥Ú¡¼¥¸
90         $ret = preg_replace('/#related/e','make_related($vars[\'page\'],TRUE)',$ret);
91         
92         return $ret;
93 }
94
95 class Element
96 {
97         var $parent;
98         
99         function setParent(&$parent)
100         {
101                 $this->parent =& $parent;
102         }
103 }
104
105 class Inline extends Element
106 { // ¥¤¥ó¥é¥¤¥óÍ×ÁÇ
107         var $text;
108         
109         function Inline($text)
110         {
111                 if (substr($text,0,1) == '~') { // ¹ÔƬ~¡£¥Ñ¥é¥°¥é¥Õ³«»Ï
112                         $parent =& $this->parent;
113                         $this = new Paragraph(substr($text,1));
114                         $this->setParent($parent);
115                 }
116                 else {
117                         $this->text = (substr($text,0,1) == "\n") ? $text : inline2(inline($text));
118                 }
119         }
120         function &add(&$obj)
121         {
122                 return $this->insert($obj);
123         }
124         function &insert(&$obj)
125         {
126                 return $this->parent->add($obj);
127         }
128         function toString()
129         {
130                 return $this->text;
131         }
132         function toPara($class = '')
133         {
134                 $obj = new Paragraph('',$class);
135                 $obj->insert($this);
136                 $this->setParent($obj);
137                 return $obj;
138         }
139 }
140 class Block extends Element
141 { // ¥Ö¥í¥Ã¥¯Í×ÁÇ
142         var $elements; // Í×ÁǤÎÇÛÎó
143         
144         function Block() {
145                 $this->elements = array();
146         }
147         
148         function &add(&$obj) // ¥¨¥ì¥á¥ó¥È¤òÄɲÃ
149         {
150                 if ($this->canContain($obj)) {
151                         return $this->insert($obj);
152                 }
153                 return $this->parent->add($obj);
154         }
155         function &insert(&$obj)
156         {
157                 $obj->setParent($this);
158                 $this->elements[] =& $obj;
159                 if (isset($obj->last) and is_object($obj->last)) {
160                         return $obj->last;
161                 }
162                 return $obj;
163         }
164         function canContain($obj)
165         {
166                 return TRUE;
167         }
168         function toString()
169         {
170                 $ret = '';
171                 if (isset($this->elements) and count($this->elements) > 0) {
172                         foreach ($this->elements as $obj) {
173                                 $ret .= $obj->toString();
174                         }
175                 }
176                 return $ret;
177         }
178         function wrap($string, $tag, $param = '')
179         {
180                 return  ($string == '') ? '' : "\n<$tag$param>$string</$tag>\n";
181         }
182 }
183 class Body extends Block
184 { // Body
185         
186         function &insert(&$obj)
187         {
188                 if (is_a($obj,'Inline')) {
189                         $obj =& $obj->toPara();
190                 }
191                 return parent::insert($obj);
192         }
193 }
194 class Paragraph extends Block
195 { // ÃÊÍî
196         var $class;
197         
198         function Paragraph($text, $class = '')
199         {
200                 parent::Block();
201                 $this->class = $class;
202                 if ($text == '') {
203                         return;
204                 }
205                 if (substr($text,0,1) == '~') {
206                         $text = substr($text,1);
207                 }
208                 $this->elements[] =& new Inline($text);
209         }
210         function canContain($obj)
211         {
212                 return is_a($obj,'Inline');
213         }
214         function toString()
215         {
216                 return $this->wrap(parent::toString(), 'p', $this->class);
217         }
218 }
219
220 class Heading extends Block
221 { // *
222         var $level;
223         function Heading($text, &$contents)
224         {
225                 parent::Block();
226                 preg_match("/^(\*{1,3})\s*(.*)$/",$text,$out) or die("Heading");
227                 $this->level = strlen($out[1]) + 1;
228                 list($this->text,$this->contents_str) = $contents->getAnchor($out[2], $this->level);
229         }
230         function canContain(&$obj)
231         {
232                 return FALSE;
233         }
234         function toString()
235         {
236                 return $this->wrap($this->text,'h'.$this->level, $this->contents_str);
237         }
238 }
239 class HRule extends Block
240 { // ----
241         function canContain(&$obj)
242         {
243                 return FALSE;
244         }
245         function toString()
246         {
247                 global $hr;
248                 
249                 return $hr;
250         }
251 }
252 class _List extends Block
253 {
254         var $level;
255         var $step, $margin, $left_margin;
256         
257         function _List($tag, $tag2, $level, $text)
258         {
259                 parent::Block();
260                 //¥Þ¡¼¥¸¥ó¤ò¼èÆÀ
261                 $var_margin = "_{$tag}_margin";
262                 $var_left_margin = "_{$tag}_left_margin";
263                 global $$var_margin, $$var_left_margin;
264                 $this->margin = $$var_margin;
265                 $this->left_margin = $$var_left_margin;
266
267                 //½é´ü²½
268                 $this->tag = $tag;
269                 $this->tag2 = $tag2;
270                 $this->level = $level;
271                 
272                 if ($text != '') {
273                         $this->insert(new Inline($text));
274                 }
275         }
276
277         function canContain(&$obj)
278         {
279                 return is_a($obj, '_List') ? ($this->tag == $obj->tag and $this->level == $obj->level) : TRUE;
280         }
281         function setParent(&$parent)
282         {
283                 parent::setParent($parent);
284                 $this->step = $this->level;
285                 if (isset($parent->parent) and is_a($parent->parent,'_List')) {
286                         $this->step -= $parent->parent->level; 
287                 }
288         }
289         function &insert(&$obj)
290         {
291                 if (is_a($obj, get_class($this))) {
292                         for ($n = 0; $n < count($obj->elements); $n++) {
293                                 $this->last =& parent::insert($obj->elements[$n]);
294                         }
295                         return $this->last;
296                 }
297                 $obj =& new ListElement($obj, $this->level, $this->tag2); // wrap
298                 $this->last =& $obj;
299                 return parent::insert($obj);
300         }
301         function toString($param='')
302         {
303                 global $_list_left_margin, $_list_margin, $_list_pad_str;
304                 
305                 $margin = $_list_margin * $this->step;
306                 if ($this->level == $this->step) {
307                         $margin += $_list_left_margin;
308                 }
309                 $style = sprintf($_list_pad_str,$this->level,$margin,$margin);
310                 return $this->wrap(Block::toString(),$this->tag,$style.$param);
311         }
312 }
313 class ListElement extends Block
314 {
315         function ListElement(&$obj,$level,$head)
316         {
317                 parent::Block();
318                 $this->level = $level;
319                 $this->head = $head;
320                 $this->insert($obj);
321                 $this->last = NULL;
322                 if (isset($obj->last) and is_object($obj->last)) {
323                         $this->last =& $obj->last;
324                 }
325         }
326         function canContain(&$obj)
327         {
328                 return !(is_a($obj, '_List') and ($obj->level <= $this->level));
329         }
330         function toString()
331         {
332                 return $this->wrap(parent::toString(), $this->head);
333         }
334 }
335 class UList extends _List
336 { // -
337         function UList($text)
338         {
339                 preg_match("/^(\-{1,3})([\n]?.*)$/",$text,$out) or die("UList $text");
340                 parent::_List('ul', 'li', strlen($out[1]), $out[2]);
341         }
342 }
343 class OList extends _List
344 { // +
345         function OList($text)
346         {
347                 preg_match("/^(\+{1,3})(.*)$/",$text,$out) or die("OList");
348                 parent::_List('ol', 'li', strlen($out[1]), $out[2]);
349         }
350 }
351 class DList extends _List
352 { // :
353         function DList($text)
354         {
355                 if (!preg_match("/^(:{1,3})(.*)\|(.*)$/",$text,$out)) {
356                         $this = new Inline($text);
357                         return;
358                 }
359                 parent::_List('dl', 'dd', strlen($out[1]), $out[3]);
360                 if ($out[2] != '') {
361                         array_unshift($this->elements,new Inline("\n<dt>".inline2(inline($out[2]))."</dt>\n"));
362                 }
363         }
364 }
365 class BQuote extends Block
366 { // >
367         var $level;
368         
369         function BQuote($text)
370         {
371                 parent::Block();
372                 preg_match("/^(\>{1,3})(.*)$/",$text,$out) or die("BQuote");
373                 $this->level = strlen($out[1]);
374                 $this->text = $out[2];
375                 $this->last =& $this->insert(new Paragraph($this->text, ' class="quotation"'));
376         }
377         function canContain(&$obj)
378         {
379                 if (!is_a($obj, get_class($this))) {
380                         return TRUE;
381                 }
382                 return ($this->level <= $obj->level);
383         }
384         function &insert(&$obj)
385         {
386                 if (is_a($obj, 'BQuote') and $obj->level == $this->level) {
387                         if (is_a($this->last,'Paragraph')) {
388                                 $this->last->insert($obj->elements[0]->elements[0]);
389                         } else {
390                                 $this->last =& $this->insert($obj->elements[0]);
391                         }
392                         return $this->last;
393                 }
394                 $this->last =& $obj;
395                 return parent::insert($obj);
396         }
397         function toString()
398         {
399                 return $this->wrap(parent::toString(),'blockquote');
400         }
401 }
402 function &bq_end(&$last, $text)
403 {
404         preg_match("/^(\<{1,3})(.*)$/",$text,$out) or die("bq_end");
405         $level = strlen($out[1]);
406         $parent =& $last;
407         while (is_object($parent)) {
408                 if (is_a($parent,'BQuote') and $parent->level == $level) {
409                         return $parent->parent->insert(new Inline($out[2]));
410                 }
411                 $parent =& $parent->parent;
412         }
413         return $last->insert(new Inline($text));
414 }
415 class Table extends Block
416 { // |
417         var $col,$head,$foot;
418         var $level;
419         
420         function Table($text)
421         {
422                 parent::Block();
423                 if (!preg_match("/^\|(.+)\|([hHfFcC]?)$/",$text,$out)) {
424                         $this = new Inline($text);
425                         return;
426                 }
427                 $this->elements = array();
428                 $cells = explode('|',$out[1]);
429                 $this->level = count($cells);
430                 $char = strtolower($out[2]);
431                 if ($char == 'c') {
432                         $this->col =& new Col($cells);
433                 }
434                 else {
435                         $this->insert(new Row($cells,($char == 'h' ? 0 : ($char == 'f' ? 1 : 2))));
436                 }
437         }
438         function canContain(&$obj)
439         {
440                 return is_a($obj, 'Table') and $obj->level == $this->level;
441         }
442         function &insert(&$obj)
443         {
444                 if (is_a($obj, 'Table')) {
445                         if (isset($obj->col) and is_object($obj->col)) {
446                                 $this->col = $obj->col;
447                                 return $this;
448                         }
449                         $obj =& $obj->elements[0];
450                         $last = count($this->elements) - 1;
451                         for ($n = 0; $n < count($obj->elements); $n++) {
452                                 if ($obj->elements[$n] != '~') {
453                                         continue;
454                                 }
455                                 $obj->type = $this->elements[$last]->type;
456                                 for ($m = $last; $m >= 0; $m--) {
457                                         if ($this->elements[$m]->elements[$n] == '~') {
458                                                 continue;
459                                         }
460                                         $this->elements[$m]->row[$n]++;
461                                         break;
462                                 }
463                         }
464                 }
465                 $this->elements[] = $obj;
466                 return $this;
467         }
468         function toString()
469         {
470                 $col = NULL;
471                 if (isset($this->col) and is_object($this->col)) {
472                         $col =& $this->col;
473                 }
474                 $string = $col ? $this->col->toString() : '';
475                 $part = array(0=>'thead',1=>'tfoot',2=>'tbody');
476                 foreach ($part as $type=>$str) {
477                         $tmp = '';
478                         foreach ($this->elements as $row) {
479                                 if ($row->type != $type) {
480                                         continue;
481                                 }
482                                 $tmp .= $row->toString($col);
483                         }
484                         if ($tmp != '') {
485                                 $string .= $this->wrap($tmp,$str);
486                         }
487                 }
488                 if ($string != '') {
489                         $string = <<<EOD
490
491 <div class="ie5">
492  <table class="style_table" cellspacing="1" border="0">
493   $string
494  </table>
495 </div>
496 EOD;
497                 }
498                 return $string;
499         }
500 }
501 class Row extends Block
502 {
503         var $col,$row,$type;
504         
505         function Row($cells,$type='')
506         {
507                 parent::Block();
508                 $this->elements = $cells;
509                 $this->type = $type;
510                 $span = 1;
511                 for ($n = 0; $n < count($cells); $n++) {
512                         $this->row[$n] = 1;
513                         if ($cells[$n] == '>') {
514                                 $this->col[$n] = 0;
515                                 $span++;
516                         }
517                         else {
518                                 $this->col[$n] = $span;
519                                 $span = 1;
520                         }
521                 }
522         }
523         function toString($obj)
524         {
525                 $cells = '';
526                 for ($n = 0; $n < count($this->elements); $n++) {
527                         $cell = $this->elements[$n];
528                         if ($cell == '>' or $cell == '~') {
529                                 continue;
530                         }
531                         $row = $col = '';
532                         if ($this->row[$n] > 1) {
533                                 $row = " rowspan=\"{$this->row[$n]}\"";
534                         }
535                         if ($this->col[$n] > 1) {
536                                 $col = " colspan=\"{$this->col[$n]}\"";
537                         }
538                         $align = $width = '';
539                         if (is_object($obj)) {
540                                 $align = $obj->align[$n];
541                                 if ($this->col[$n] == 1) {
542                                         $width = $obj->width[$n];
543                                 }
544                         }
545                         if (preg_match("/^(LEFT|CENTER|RIGHT):(.*)$/",$cell,$out)) {
546                                 $align = strtolower($out[1]);
547                                 $cell = $out[2];
548                         }
549                         if (preg_match('/^~(.+)$/',$cell,$matches)) {
550                                 $tag = 'th'; $cell = $matches[1];
551                         }
552                         else {
553                                 $tag = 'td';
554                         }
555                         $style = $width == '' ? '' : 'width:'.$width.'px;';
556                         $style.= $align == '' ? '' : 'text-align:'.$align.';';
557                         $style = $style == '' ? '' : ' style="'.$style.'"';
558                         $cells .= "\n<$tag class=\"style_$tag\"$style$row$col>".inline2(inline($cell))."</$tag>\n";
559                 }
560                 return $this->wrap($cells,'tr');
561         }
562 }
563 class Col extends Row
564 {
565         var $width,$align;
566         
567         function Col($cells)
568         {
569                 parent::Row($cells);
570                 $align = $width = '';
571                 for ($n = count($this->elements) - 1; $n >= 0; $n--) {
572                         if ($cells[$n] == '') {
573                                 $align = $width = '';
574                         }
575                         else if ($cells[$n] != '>') {
576                                 if (preg_match("/^(LEFT|CENTER|RIGHT):(.*)$/",$cells[$n],$out)) {
577                                         $align = strtolower($out[1]);
578                                         $width = htmlspecialchars($out[2]);
579                                 }
580                         }
581                         $this->align[$n] = $align;
582                         $this->width[$n] = $width;
583                 }
584         }
585         function toString()
586         {
587                 $cells = '';
588                 for ($n = 0; $n < count($this->elements); $n++) {
589                         $cell = $this->elements[$n];
590                         if ($cell == '>') {
591                                 continue;
592                         }
593                         $span = " span=\"{$this->col[$n]}\"";
594                         $align = $this->align[$n] == '' ? '' : ' align="'.$this->align[$n].'"';
595                         $width = $this->width[$n] == '' ? '' : ' width="'.$this->width[$n].'"';
596                         $cells .= "\n<colgroup$span$align$width></colgroup>\n";
597                 }
598                 return $cells;
599         }
600 }
601 class YTable extends Block
602 { // ,
603         var $col;
604         
605         function YTable($text)
606         {
607                 parent::Block();
608                 if (!preg_match_all('/("[^"]*(?:""[^"]*)*"|[^,]*),/',"$text,",$out)) {
609                         $this = new Inline($text);
610                         return;
611                 }
612                 array_shift($out[1]);
613                 $_value = array();
614                 foreach ($out[1] as $val) {
615                         $_value[] = preg_match('/^"(.*)"$/',$val,$matches) ? str_replace('""','"',$matches[1]) : $val;
616                 }
617                 $align = array();
618                 $value = array();
619                 foreach($_value as $val) {
620                         if (preg_match('/^(\s+)?(.+?)(\s+)?$/',$val,$matches)) {
621                                 $align[] =($matches[1] != '') ?
622                                         ((array_key_exists(3,$matches) and $matches[3] != '') ? ' style="text-align:center"' : ' style="text-align:right"') : '';
623                                 $value[] = $matches[2];
624                         }
625                         else {
626                                 $align[] = '';
627                                 $value[] = $val;
628                         }
629                 }
630                 $this->col = count($value);
631                 $colspan = array();
632                 foreach ($value as $val) {
633                         $colspan[] = ($val == '==') ? 0 : 1;
634                 }
635                 $str = '';
636                 for ($i = 0; $i < count($value); $i++) {
637                         if ($colspan[$i]) {
638                                 while ($i + $colspan[$i] < count($value) and $value[$i + $colspan[$i]] == '==') {
639                                         $colspan[$i]++;
640                                 }
641                                 $colspan[$i] = ($colspan[$i] > 1) ? " colspan=\"{$colspan[$i]}\"" : '';
642                                 $str .= "<td class=\"style_td\"{$align[$i]}{$colspan[$i]}>".inline2(inline($value[$i])).'</td>';
643                         }
644                 }
645                 $this->elements[] = $str;
646         }
647         function canContain(&$obj)
648         {
649                 return is_a($obj, 'YTable') and $obj->col == $this->col;
650         }
651         function &insert(&$obj)
652         {
653                 $this->elements[] = $obj->elements[0];
654                 return $this;
655         }
656         function toString()
657         {
658                 $rows = '';
659                 foreach ($this->elements as $str) {
660                         $rows .= "\n<tr class=\"style_tr\">$str</tr>\n";
661                 }
662                 $string = <<<EOD
663
664 <div class="ie5">
665  <table class="style_table" cellspacing="1" border="0">
666   $rows
667  </table>
668 </div>
669
670 EOD;
671                 return $string;
672         }
673 }
674 class Pre extends Block
675 { // ' '
676         
677         function Pre($text)
678         {
679                 parent::Block();
680                 $tab = 8;
681                 while (preg_match('/^([^\t]*)(\t+)(.+)$/',$text,$m)) {
682                         $text = $m[1].str_repeat(' ',strlen($m[2]) * $tab - strlen($m[1]) % $tab).$m[3];
683                 }
684                 $this->elements[] = htmlspecialchars($text,ENT_NOQUOTES);
685         }
686         function canContain(&$obj)
687         {
688                 return is_a($obj, 'Pre');
689         }
690         function &insert(&$obj)
691         {
692                 $this->elements[] = $obj->elements[0];
693                 return $this;
694         }
695         function toString()
696         {
697                 return $this->wrap(join("\n",$this->elements),'pre');
698         }
699 }
700 class Div extends Block
701 { // #
702         var $text;
703         
704         function Div($text)
705         {
706                 parent::Block();
707                 $this->text = $text;
708         }
709         function canContain(&$obj)
710         {
711                 return FALSE;
712         }
713         function toString()
714         {
715                 if (preg_match("/^\#([^\(]+)(.*)$/",$this->text,$out) and exist_plugin_convert($out[1])) {
716                         if ($out[2]) {
717                                 $_plugin = preg_replace("/^\#([^\(]+)\((.*)\)$/ex","do_plugin_convert('$1','$2')",$this->text);
718                         }
719                         else {
720                                 $_plugin = preg_replace("/^\#([^\(]+)$/ex","do_plugin_convert('$1','$2')",$this->text);
721                         }
722                         $text = "\t$_plugin";
723                 }
724                 else {
725                         $text = "\n<p>".htmlspecialchars($this->text)."</p>\n";
726                 }
727                 return $text;
728         }
729 }
730 class Align extends Body
731 { // LEFT:/CENTER:/RIGHT:
732         var $align;
733         
734         function Align($align)
735         {
736                 $this->align = $align;
737         }
738         function toString()
739         {
740                 $string = parent::toString();
741                 if ($string != '') {
742                         if (preg_match('/^(\s*<[^>]+style=")([^"]+)"/',$string,$matches)) {
743                                 $string = $matches[1]."text-align:{$this->align};".$matches[2];
744                         }
745                         else {
746                                 $string = preg_replace('/^(\s*<[a-z]+)/', '$1 style="text-align:'.$this->align.';"',$string);
747                         }
748                 }
749                 return $string;
750         }
751 }
752 //¸«½Ð¤·¤Î°ìÍ÷´Ø·¸
753 class Contents
754 {
755         var $id,$count,$top,$contents,$last;
756         
757         function Contents($id)
758         {
759                 global $top;
760                 
761                 $this->id = $id;
762                 $this->count = 0;
763                 $this->top = "<a href=\"#contents_$id\">$top</a>";
764                 $this->contents =& new Block();
765                 $this->last =& $this->contents;
766         }
767         function getAnchor($text,$level)
768         {
769                 $content_str = "content_{$this->id}_{$this->count}";
770                 $this->last =& $this->last->add(new Contents_UList($text,$this->id,$level,$content_str));
771                 $this->count++;
772                 return array(inline2(inline($text)).$this->top," id=\"{$content_str}\"");
773         }
774         function getContents()
775         {
776                 global $strip_link_wall;
777                 
778                 $contents  = "<a id=\"contents_{$this->id}\"></a>";
779                 $contents .= $this->contents->toString();
780                 if ($strip_link_wall) {
781                         $contents = preg_replace("/\[\[([^\]]+)\]\]/","$1",$contents);
782                 }
783                 return $contents;
784         }
785 }
786 class Contents_UList extends _List
787 { // -
788         var $id;
789         
790         function Contents_UList($text,$id,$level,$content_str)
791         {
792                 $this->id = $id;
793                 // ¥Æ¥­¥¹¥È¤Î¥ê¥Õ¥©¡¼¥à
794                 // ¹ÔƬ\n¤ÇÀ°·ÁºÑ¤ß¤òɽ¤¹ ... X(
795                 $text = "\n<a href=\"#{$content_str}\">".
796                         strip_htmltag(inline2(inline($text,TRUE))).
797                         "</a>\n";
798                 parent::_List('ul', 'li', --$level, $text);
799         }
800 }
801 ?>