OSDN Git Service

<dt>のテキストにinline2()が不足
[pukiwiki/pukiwiki.git] / convert_html.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: convert_html.php,v 1.5 2003/01/31 05:16:43 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         }
322         function canContain(&$obj)
323         {
324                 return !(is_a($obj, '_List') and ($obj->level <= $this->level));
325         }
326         function toString()
327         {
328                 return $this->wrap(parent::toString(), $this->head);
329         }
330 }
331 class UList extends _List
332 { // -
333         function UList($text)
334         {
335                 preg_match("/^(\-{1,3})([\n]?.*)$/",$text,$out) or die("UList $text");
336                 parent::_List('ul', 'li', strlen($out[1]), $out[2]);
337         }
338 }
339 class OList extends _List
340 { // +
341         function OList($text)
342         {
343                 preg_match("/^(\+{1,3})(.*)$/",$text,$out) or die("OList");
344                 parent::_List('ol', 'li', strlen($out[1]), $out[2]);
345         }
346 }
347 class DList extends _List
348 { // :
349         function DList($text)
350         {
351                 if (!preg_match("/^(:{1,3})(.*)\|(.*)$/",$text,$out)) {
352                         $this = new Inline($text);
353                         return;
354                 }
355                 parent::_List('dl', 'dd', strlen($out[1]), $out[3]);
356                 if ($out[2] != '') {
357                         array_unshift($this->elements,new Inline("\n<dt>".inline2(inline($out[2]))."</dt>\n"));
358                 }
359         }
360 }
361 class BQuote extends Block
362 { // >
363         var $level;
364         
365         function BQuote($text)
366         {
367                 parent::Block();
368                 preg_match("/^(\>{1,3})(.*)$/",$text,$out) or die("BQuote");
369                 $this->level = strlen($out[1]);
370                 $this->text = $out[2];
371                 $this->last =& $this->insert(new Paragraph($this->text, ' class="quotation"'));
372         }
373         function canContain(&$obj)
374         {
375                 if (!is_a($obj, get_class($this))) {
376                         return TRUE;
377                 }
378                 return ($this->level <= $obj->level);
379         }
380         function &insert(&$obj)
381         {
382                 if (is_a($obj, 'BQuote') and $obj->level == $this->level) {
383                         if (is_a($this->last,'Paragraph')) {
384                                 $this->last->insert($obj->elements[0]->elements[0]);
385                         } else {
386                                 $this->last =& $this->insert($obj->elements[0]);
387                         }
388                         return $this->last;
389                 }
390                 $this->last =& $obj;
391                 return parent::insert($obj);
392         }
393         function toString()
394         {
395                 return $this->wrap(parent::toString(),'blockquote');
396         }
397 }
398 function &bq_end(&$last, $text)
399 {
400         preg_match("/^(\<{1,3})(.*)$/",$text,$out) or die("bq_end");
401         $level = strlen($out[1]);
402         $parent =& $last;
403         while (is_object($parent)) {
404                 if (is_a($parent,'BQuote') and $parent->level == $level) {
405                         return $parent->parent->insert(new Inline($out[2]));
406                 }
407                 $parent =& $parent->parent;
408         }
409         return $last->insert(new Inline($text));
410 }
411 class Table extends Block
412 { // |
413         var $col,$head,$foot;
414         var $level;
415         
416         function Table($text)
417         {
418                 parent::Block();
419                 if (!preg_match("/^\|(.+)\|([hHfFcC]?)$/",$text,$out)) {
420                         $this = new Inline($text);
421                         return;
422                 }
423                 $this->elements = array();
424                 $cells = explode('|',$out[1]);
425                 $this->level = count($cells);
426                 $char = strtolower($out[2]);
427                 if ($char == 'c') {
428                         $this->col =& new Col($cells);
429                 }
430                 else {
431                         $this->insert(new Row($cells,($char == 'h' ? 0 : ($char == 'f' ? 1 : 2))));
432                 }
433         }
434         function canContain(&$obj)
435         {
436                 return is_a($obj, 'Table') and $obj->level == $this->level;
437         }
438         function &insert(&$obj)
439         {
440                 if (is_a($obj, 'Table')) {
441                         if (isset($obj->col) and is_object($obj->col)) {
442                                 $this->col = $obj->col;
443                                 return $this;
444                         }
445                         $obj =& $obj->elements[0];
446                         $last = count($this->elements) - 1;
447                         for ($n = 0; $n < count($obj->elements); $n++) {
448                                 if ($obj->elements[$n] != '~') {
449                                         continue;
450                                 }
451                                 $obj->type = $this->elements[$last]->type;
452                                 for ($m = $last; $m >= 0; $m--) {
453                                         if ($this->elements[$m]->elements[$n] == '~') {
454                                                 continue;
455                                         }
456                                         $this->elements[$m]->row[$n]++;
457                                         break;
458                                 }
459                         }
460                 }
461                 $this->elements[] = $obj;
462                 return $this;
463         }
464         function toString()
465         {
466                 $col = NULL;
467                 if (isset($this->col) and is_object($this->col)) {
468                         $col =& $this->col;
469                 }
470                 $string = $col ? $this->col->toString() : '';
471                 $part = array(0=>'thead',1=>'tfoot',2=>'tbody');
472                 foreach ($part as $type=>$str) {
473                         $tmp = '';
474                         foreach ($this->elements as $row) {
475                                 if ($row->type != $type) {
476                                         continue;
477                                 }
478                                 $tmp .= $row->toString($col);
479                         }
480                         if ($tmp != '') {
481                                 $string .= $this->wrap($tmp,$str);
482                         }
483                 }
484                 if ($string != '') {
485                         $string = <<<EOD
486
487 <div class="ie5">
488  <table class="style_table" cellspacing="1" border="0">
489   $string
490  </table>
491 </div>
492 EOD;
493                 }
494                 return $string;
495         }
496 }
497 class Row extends Block
498 {
499         var $col,$row,$type;
500         
501         function Row($cells,$type='')
502         {
503                 parent::Block();
504                 $this->elements = $cells;
505                 $this->type = $type;
506                 $span = 1;
507                 for ($n = 0; $n < count($cells); $n++) {
508                         $this->row[$n] = 1;
509                         if ($cells[$n] == '>') {
510                                 $this->col[$n] = 0;
511                                 $span++;
512                         }
513                         else {
514                                 $this->col[$n] = $span;
515                                 $span = 1;
516                         }
517                 }
518         }
519         function toString($obj)
520         {
521                 $cells = '';
522                 for ($n = 0; $n < count($this->elements); $n++) {
523                         $cell = $this->elements[$n];
524                         if ($cell == '>' or $cell == '~') {
525                                 continue;
526                         }
527                         $row = $col = '';
528                         if ($this->row[$n] > 1) {
529                                 $row = " rowspan=\"{$this->row[$n]}\"";
530                         }
531                         if ($this->col[$n] > 1) {
532                                 $col = " colspan=\"{$this->col[$n]}\"";
533                         }
534                         $align = $width = '';
535                         if (is_object($obj)) {
536                                 $align = $obj->align[$n];
537                                 if ($this->col[$n] == 1) {
538                                         $width = $obj->width[$n];
539                                 }
540                         }
541                         if (preg_match("/^(LEFT|CENTER|RIGHT):(.*)$/",$cell,$out)) {
542                                 $align = strtolower($out[1]);
543                                 $cell = $out[2];
544                         }
545                         if (preg_match('/^~(.+)$/',$cell,$matches)) {
546                                 $tag = 'th'; $cell = $matches[1];
547                         }
548                         else {
549                                 $tag = 'td';
550                         }
551                         $style = $width == '' ? '' : 'width:'.$width.'px;';
552                         $style.= $align == '' ? '' : 'text-align:'.$align.';';
553                         $style = $style == '' ? '' : ' style="'.$style.'"';
554                         $cells .= "\n<$tag class=\"style_$tag\"$style$row$col>".inline2(inline($cell))."</$tag>\n";
555                 }
556                 return $this->wrap($cells,'tr');
557         }
558 }
559 class Col extends Row
560 {
561         var $width,$align;
562         
563         function Col($cells)
564         {
565                 parent::Row($cells);
566                 $align = $width = '';
567                 for ($n = count($this->elements) - 1; $n >= 0; $n--) {
568                         if ($cells[$n] == '') {
569                                 $align = $width = '';
570                         }
571                         else if ($cells[$n] != '>') {
572                                 if (preg_match("/^(LEFT|CENTER|RIGHT):(.*)$/",$cells[$n],$out)) {
573                                         $align = strtolower($out[1]);
574                                         $width = htmlspecialchars($out[2]);
575                                 }
576                         }
577                         $this->align[$n] = $align;
578                         $this->width[$n] = $width;
579                 }
580         }
581         function toString()
582         {
583                 $cells = '';
584                 for ($n = 0; $n < count($this->elements); $n++) {
585                         $cell = $this->elements[$n];
586                         if ($cell == '>') {
587                                 continue;
588                         }
589                         $span = " span=\"{$this->col[$n]}\"";
590                         $align = $this->align[$n] == '' ? '' : ' align="'.$this->align[$n].'"';
591                         $width = $this->width[$n] == '' ? '' : ' width="'.$this->width[$n].'"';
592                         $cells .= "\n<colgroup$span$align$width></colgroup>\n";
593                 }
594                 return $cells;
595         }
596 }
597 class YTable extends Block
598 { // ,
599         var $col;
600         
601         function YTable($text)
602         {
603                 parent::Block();
604                 if (!preg_match_all('/("[^"]*(?:""[^"]*)*"|[^,]*),/',"$text,",$out)) {
605                         $this = new Inline($text);
606                         return;
607                 }
608                 array_shift($out[1]);
609                 $_value = array();
610                 foreach ($out[1] as $val) {
611                         $_value[] = preg_match('/^"(.*)"$/',$val,$matches) ? str_replace('""','"',$matches[1]) : $val;
612                 }
613                 $align = array();
614                 $value = array();
615                 foreach($_value as $val) {
616                         if (preg_match('/^(\s+)?(.+?)(\s+)?$/',$val,$matches)) {
617                                 $align[] =($matches[1] != '') ?
618                                         ((array_key_exists(3,$matches) and $matches[3] != '') ? ' style="text-align:center"' : ' style="text-align:right"') : '';
619                                 $value[] = $matches[2];
620                         }
621                         else {
622                                 $align[] = '';
623                                 $value[] = $val;
624                         }
625                 }
626                 $this->col = count($value);
627                 $colspan = array();
628                 foreach ($value as $val) {
629                         $colspan[] = ($val == '==') ? 0 : 1;
630                 }
631                 $str = '';
632                 for ($i = 0; $i < count($value); $i++) {
633                         if ($colspan[$i]) {
634                                 while ($i + $colspan[$i] < count($value) and $value[$i + $colspan[$i]] == '==') {
635                                         $colspan[$i]++;
636                                 }
637                                 $colspan[$i] = ($colspan[$i] > 1) ? " colspan=\"{$colspan[$i]}\"" : '';
638                                 $str .= "<td class=\"style_td\"{$align[$i]}{$colspan[$i]}>".inline2(inline($value[$i])).'</td>';
639                         }
640                 }
641                 $this->elements[] = $str;
642         }
643         function canContain(&$obj)
644         {
645                 return is_a($obj, 'YTable') and $obj->col == $this->col;
646         }
647         function &insert(&$obj)
648         {
649                 $this->elements[] = $obj->elements[0];
650                 return $this;
651         }
652         function toString()
653         {
654                 $rows = '';
655                 foreach ($this->elements as $str) {
656                         $rows .= "\n<tr class=\"style_tr\">$str</tr>\n";
657                 }
658                 $string = <<<EOD
659
660 <div class="ie5">
661  <table class="style_table" cellspacing="1" border="0">
662   $rows
663  </table>
664 </div>
665
666 EOD;
667                 return $string;
668         }
669 }
670 class Pre extends Block
671 { // ' '
672         
673         function Pre($text)
674         {
675                 parent::Block();
676                 $tab = 8;
677                 while (preg_match('/^([^\t]*)(\t+)(.+)$/',$text,$m)) {
678                         $text = $m[1].str_repeat(' ',strlen($m[2]) * $tab - strlen($m[1]) % $tab).$m[3];
679                 }
680                 $this->elements[] = htmlspecialchars($text,ENT_NOQUOTES);
681         }
682         function canContain(&$obj)
683         {
684                 return is_a($obj, 'Pre');
685         }
686         function &insert(&$obj)
687         {
688                 $this->elements[] = $obj->elements[0];
689                 return $this;
690         }
691         function toString()
692         {
693                 return $this->wrap(join("\n",$this->elements),'pre');
694         }
695 }
696 class Div extends Block
697 { // #
698         var $text;
699         
700         function Div($text)
701         {
702                 parent::Block();
703                 $this->text = $text;
704         }
705         function canContain(&$obj)
706         {
707                 return FALSE;
708         }
709         function toString()
710         {
711                 if (preg_match("/^\#([^\(]+)(.*)$/",$this->text,$out) and exist_plugin_convert($out[1])) {
712                         if ($out[2]) {
713                                 $_plugin = preg_replace("/^\#([^\(]+)\((.*)\)$/ex","do_plugin_convert('$1','$2')",$this->text);
714                         }
715                         else {
716                                 $_plugin = preg_replace("/^\#([^\(]+)$/ex","do_plugin_convert('$1','$2')",$this->text);
717                         }
718                         $text = "\t$_plugin";
719                 }
720                 else {
721                         $text = "\n<p>".htmlspecialchars($this->text)."</p>\n";
722                 }
723                 return $text;
724         }
725 }
726 class Align extends Body
727 { // LEFT:/CENTER:/RIGHT:
728         var $align;
729         
730         function Align($align)
731         {
732                 $this->align = $align;
733         }
734         function toString()
735         {
736                 $string = parent::toString();
737                 if ($string != '') {
738                         if (preg_match('/^(\s*<[^>]+style=")([^"]+)"/',$string,$matches)) {
739                                 $string = $matches[1]."text-align:{$this->align};".$matches[2];
740                         }
741                         else {
742                                 $string = preg_replace('/^(\s*<[a-z]+)/', '$1 style="text-align:'.$this->align.';"',$string);
743                         }
744                 }
745                 return $string;
746         }
747 }
748 //¸«½Ð¤·¤Î°ìÍ÷´Ø·¸
749 class Contents
750 {
751         var $id,$count,$top,$contents,$last;
752         
753         function Contents($id)
754         {
755                 global $top;
756                 
757                 $this->id = $id;
758                 $this->count = 0;
759                 $this->top = "<a href=\"#contents_$id\">$top</a>";
760                 $this->contents =& new Block();
761                 $this->last =& $this->contents;
762         }
763         function getAnchor($text,$level)
764         {
765                 $content_str = "content_{$this->id}_{$this->count}";
766                 $this->last =& $this->last->add(new Contents_UList($text,$this->id,$level,$content_str));
767                 $this->count++;
768                 return array(inline2(inline($text)).$this->top," id=\"{$content_str}\"");
769         }
770         function getContents()
771         {
772                 global $strip_link_wall;
773                 
774                 $contents  = "<a id=\"contents_{$this->id}\"></a>";
775                 $contents .= $this->contents->toString();
776                 if ($strip_link_wall) {
777                         $contents = preg_replace("/\[\[([^\]]+)\]\]/","$1",$contents);
778                 }
779                 return $contents;
780         }
781 }
782 class Contents_UList extends _List
783 { // -
784         var $id;
785         
786         function Contents_UList($text,$id,$level,$content_str)
787         {
788                 $this->id = $id;
789                 // ¥Æ¥­¥¹¥È¤Î¥ê¥Õ¥©¡¼¥à
790                 // ¹ÔƬ\n¤ÇÀ°·ÁºÑ¤ß¤òɽ¤¹ ... X(
791                 $text = "\n<a href=\"#{$content_str}\">".
792                         strip_htmltag(inline2(inline($text,TRUE))).
793                         "</a>\n";
794                 parent::_List('ul', 'li', --$level, $text);
795         }
796 }
797 ?>