現在表組みの書式指定行にサポートされているのは
LEFT: CENTER: RIGHT: BGCOLOR(色): COLOR(色): SIZE(サイズ):
の6つだけですが、ここに太字(BOLD:)の追加も希望したいです。
また、これは厳密には書式ではないのですが、見出し(TH:)もあったら便利かなと思います。 → BugTrack/2531 に移動
525行辺りのwhileを置き換えてみます。
while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)|(BOLD)|(ITALIC|OBLIQUE)|(UNDERLINE|OVERLINE|LINE-THROUGH)|(TH)):(.*)$/', $text, $matches)) { if ($matches[1]) { $this->style['align'] = 'text-align:' . strtolower($matches[1]) . ';'; $text = $matches[9]; } else if ($matches[3]) { $name = $matches[2] ? 'background-color' : 'color'; $this->style[$name] = $name . ':' . htmlsc($matches[3]) . ';'; $text = $matches[9]; } else if ($matches[4]) { $this->style['size'] = 'font-size:' . htmlsc($matches[4]) . 'px;'; $text = $matches[9]; } else if ($matches[5]) { $this->style['bold'] = 'font-weight:bold;'; $text = $matches[9]; } else if ($matches[6]) { $this->style['style'] = 'font-style:'.strtolower(htmlsc($matches[6])).';'; $text = $matches[9]; } else if ($matches[7]) { $this->style['decoration'] = 'text-decoration:'.strtolower(htmlsc($matches[7])).';'; $text = $matches[9]; } else if ($matches[8]) { $this->tag = 'th'; $text = $matches[9]; } }
$line_rules = array( 'COLOR\(([^\(\)]*)\){([^}]*)}' => '<span style="color:$1">$2</span>', 'SIZE\(([^\(\)]*)\){([^}]*)}' => '<span style="font-size:$1px">$2</span>', 'COLOR\(([^\(\)]*)\):((?:(?!COLOR\([^\)]+\)\:).)*)' => '<span style="color:$1">$2</span>', 'SIZE\(([^\(\)]*)\):((?:(?!SIZE\([^\)]+\)\:).)*)' => '<span class="size$1">$2</span>', 'BOLD:((?:(?!BOLD\([^\)]+\)\:).)*)' => '<b>$1</b>', 'ITALIC:((?:(?!ITALIC\([^\)]+\)\:).)*)' => '<i>$1</i>', 'OBLIQUE:((?:(?!OBLIQUE\([^\)]+\)\:).)*)' => '<em>$1</em>', 'UNDERLINE:((?:(?!UNDERLINE\([^\)]+\)\:).)*)' => '<u>$1</u>', 'OVERLINE:((?:(?!OVERLINE\([^\)]+\)\:).)*)' => '<span style="text-decoration: overline;">$1</span>', 'LINE-THROUGH:((?:(?!LINE-THROUGH\([^\)]+\)\:).)*)' => '<span style="text-decoration: line-through;">$1</span>', '%%%(?!%)((?:(?!%%%).)*)%%%' => '<ins>$1</ins>', '%%(?!%)((?:(?!%%).)*)%%' => '<del>$1</del>', "'''(?!')((?:(?!''').)*)'''" => '<em>$1</em>', "''(?!')((?:(?!'').)*)''" => '<strong>$1</strong>', );