From 70a3f34a0a8552fc77b64626826367395897e4df Mon Sep 17 00:00:00 2001 From: umorigu Date: Sat, 11 Dec 2021 00:40:03 +0900 Subject: [PATCH] BugTrack/2513 Bold style Table cell (BOLD:...) Implementation provided by Haifun-san. --- lib/convert_html.php | 13 ++++++++----- wiki/466F726D617474696E6752756C6573.txt | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/convert_html.php b/lib/convert_html.php index e173fdd..646e63e 100644 --- a/lib/convert_html.php +++ b/lib/convert_html.php @@ -522,18 +522,21 @@ class TableCell extends Element parent::__construct(); $this->style = $matches = array(); - while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)):(.*)$/', + while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)|(BOLD)):(.*)$/', $text, $matches)) { if ($matches[1]) { $this->style['align'] = 'text-align:' . strtolower($matches[1]) . ';'; - $text = $matches[5]; + $text = $matches[6]; } else if ($matches[3]) { $name = $matches[2] ? 'background-color' : 'color'; $this->style[$name] = $name . ':' . htmlsc($matches[3]) . ';'; - $text = $matches[5]; - } else if (isset($matches[4])) { + $text = $matches[6]; + } else if (is_numeric($matches[4])) { $this->style['size'] = 'font-size:' . htmlsc($matches[4]) . 'px;'; - $text = $matches[5]; + $text = $matches[6]; + } else if ($matches[5]) { + $this->style['bold'] = 'font-weight:bold;'; + $text = $matches[6]; } } if ($is_template && is_numeric($text)) diff --git a/wiki/466F726D617474696E6752756C6573.txt b/wiki/466F726D617474696E6752756C6573.txt index 93caee2..04a4a1e 100644 --- a/wiki/466F726D617474696E6752756C6573.txt +++ b/wiki/466F726D617474696E6752756C6573.txt @@ -89,9 +89,10 @@ BGCOLOR(色): COLOR(色): SIZE(サイズ): --- 要素の表示位置及び背景色・文字色・文字サイズ(px単位)を指定します。デフォルトは左寄せになります。 + BOLD: +-- 要素の表示位置及び背景色・文字色・文字サイズ(px単位)・太字を指定します。デフォルトは左寄せになります。 - -|表組みの |各セルの要素の配置に|関するサンプル | +|表組みの |各セルの要素の配置に|BOLD:関するサンプル |h |COLOR(crimson):左寄せ |CENTER:センタリング |BGCOLOR(yellow):RIGHT:右寄せ| |RIGHT:右寄せ |左寄せ |CENTER:センタリング | - 行末にcを記述すると、書式指定行となります。書式指定行では、次の記述子が指定できます。 @@ -101,6 +102,7 @@ BGCOLOR(色): COLOR(色): SIZE(サイズ): + BOLD: -- 記述子の後ろに数値を記述すると、セル幅がpx単位で指定できます。 - 行末にhを記述すると、ヘッダ行(thead)になります。 -- 2.11.0