function make_heading(&$str, $strip = TRUE) { $NotePattern = PukiWikiConfig::getParam('NotePattern'); // 見出しの固有ID部を削除 $id = ''; if (preg_match('/^(\\*{0,6})(.*?)\\[#([A-Za-z][\\w-]+)\\](.*?)$/m', $str, $matches)) { $str = $matches[2] . $matches[4]; $id = $matches[3]; } else { $str = preg_replace('/^\\*{0,6}/', '', $str); } if ($strip) { $str = PukiWikiFunc::strip_htmltag(PukiWikiFunc::make_link(preg_replace($NotePattern, '', $str))); } return $id; }
function PukiWikiYTable($_value) { parent::PukiWikiElement(); $align = $value = $matches = array(); foreach ($_value as $val) { if (preg_match('/^(\\s+)?(.+?)(\\s+)?$/', $val, $matches)) { $align[] = $matches[1] != '' ? isset($matches[3]) && $matches[3] != '' ? ' style="text-align:center"' : ' style="text-align:right"' : ''; $value[] = $matches[2]; } else { $align[] = ''; $value[] = $val; } } $this->col = count($value); $colspan = array(); foreach ($value as $val) { $colspan[] = $val == '==' ? 0 : 1; } $str = ''; for ($i = 0; $i < count($value); $i++) { if ($colspan[$i]) { while ($i + $colspan[$i] < count($value) && $value[$i + $colspan[$i]] == '==') { $colspan[$i]++; } $colspan[$i] = $colspan[$i] > 1 ? " colspan=\"{$colspan[$i]}\"" : ''; $str .= "<td class=\"" . PukiWikiConfig::getParam('style_prefix') . "style_td\"{$align[$i]}{$colspan[$i]}>" . PukiWikiFunc::make_link($value[$i]) . '</td>'; } } $this->elements[] = $str; }
function PukiWikiYTable(&$root, $text) { parent::PukiWikiElement(); $_value = PukiWikiFunc::csv_explode(',', substr($text, 1)); if (count($_value) == 0) { $this = new PukiWikiInline($text); $this->last =& $this; return; } $align = $value = $matches = array(); foreach ($_value as $val) { if (preg_match('/^(\\s+)?(.+?)(\\s+)?$/', $val, $matches)) { $align[] = $matches[1] != '' ? (array_key_exists(3, $matches) and $matches[3] != '') ? ' style="text-align:center"' : ' style="text-align:right"' : ''; $value[] = $matches[2]; } else { $align[] = ''; $value[] = $val; } } $this->col = count($value); $colspan = array(); foreach ($value as $val) { $colspan[] = $val == '==' ? 0 : 1; } $str = ''; for ($i = 0; $i < count($value); $i++) { if ($colspan[$i]) { while ($i + $colspan[$i] < count($value) and $value[$i + $colspan[$i]] == '==') { $colspan[$i]++; } $colspan[$i] = $colspan[$i] > 1 ? " colspan=\"{$colspan[$i]}\"" : ''; $str .= "<td class=\"" . PukiWikiConfig::getParam('style_prefix') . "style_td\"{$align[$i]}{$colspan[$i]}>" . PukiWikiFunc::make_link($value[$i]) . '</td>'; } } $this->elements[] = $str; }
function set($arr, $page) { global $_PukiWikiFootExplain; static $note_id = 0; list(, $body) = $this->splice($arr); $id = ++$note_id; $note = PukiWikiFunc::make_link($body); $style_small = PukiWikiConfig::getParam('style_prefix') . "small"; $style_super = PukiWikiConfig::getParam('style_prefix') . "note_super"; $_PukiWikiFootExplain[$id] = <<<EOD <a id="notefoot_{$id}" href="#notetext_{$id}" class="{$style_super}">*{$id}</a> <span class="{$style_small}">{$note}</span> <br /> EOD; $name = "<a id=\"notetext_{$id}\" href=\"#notefoot_{$id}\" class=\"" . PukiWikiConfig::getParam('style_prefix') . "note_super\">*{$id}</a>"; return parent::setParam($page, $name, $body); }