ヘッダセルにabbr属性を指定したい。
|CENTER:|CENTER:|h |hogehoge|氏名|
このような場合、ヘッダセルの先頭にABBR(~):を記述すると、<th abbr="~">といった具合に出力して欲しい。
|CENTER:|CENTER:|h |ABBR(hoge):hogehoge|ABBR(受験者):氏名|
--- convert_html.1.7.php Fri Jan 21 22:17:16 2005 +++ convert_html.php Fri Mar 11 19:49:35 2005 @@ -467,19 +467,23 @@ { parent::Element(); $this->style = $matches = array(); + $this->abbr = ""; - while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)):(.*)$/', + while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)|ABBR\(([^\)]+)\)):(.*)$/', $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 . ':' . htmlspecialchars($matches[3]) . ';'; - $text = $matches[5]; + $text = $matches[6]; } else if ($matches[4]) { $this->style['size'] = 'font-size:' . htmlspecialchars($matches[4]) . 'px;'; - $text = $matches[5]; + $text = $matches[6]; + } else if ($matches[5]) { + $this->abbr = htmlspecialchars($matches[5]); + $text = $matches[6]; } } if ($is_template && is_numeric($text)) @@ -526,6 +530,9 @@ } if (! empty($this->style)) $param .= ' style="' . join(' ', $this->style) . '"'; + + if (! empty($this->abbr)) + $param .= ' abbr="' . $this->abbr . '"'; return $this->wrap(parent::toString(), $this->tag, $param, FALSE); }