BugTrack/285関連。
*、**、***で自動的に固定的なアンカーを出力してほしい。
手動でアンカーを付けると、#calendar_viewなどで複数ページを一括表示した場合に、アンカー名が重複してしまうので、一意的な固定したアンカーを出力してほしい。一つ一つの記事で重複しないアンカー名を手作業で付けるのはあまりにも非効率で非現実的な作業になってしまう。手作業で付け始めて困難に直面してます。
その場合、*、**、***で指定したタイトル全体を<a>タイトル</a>で囲んでほしい。
&aname(hoge);ではなく&aname(hoge){hogehoge};形式でのアンカー名設定が普及しない内にやらないと厄介なことになる(処理によってはアンカーがネストしてしまうおそれがある)ので、1.4リリースまでに…という意味で、あえて「緊急」にしておきます。
file.php/make_str_rules() // 日付・時刻置換処理 foreach ($arr as $str) { if ($str != '' and $str{0} != ' ' and $str{0} != "\t") { foreach ($str_rules as $rule => $replace) { $str = preg_replace("/$rule/",$replace,$str); } } + // 見出しに固有IDを付与する + if (preg_match('/^(\*{1,3}(.(?!\[#[A-Za-z][\w-]+\]))+)$/',$str,$matches)) + { + $anchor = md5(uniqid($matches[2],1)); + $str = rtrim($matches[1])." [#A$anchor]\n"; + } $retvars[] = $str; }
default.ini.php,i_mode.ini.php,jphone.ini.phpなど '#related' => '<del>#related</del>', +'\[#([A-Za-z][\w-]+)\]' => '<a class="anchor" id="$1" href="#$1" title="$1">†</a>',
default.ja.css,default.en.css +.anchor +{ + font-size:xx-small; + vertical-align:super; +}
convert_html 800行めあたり
// 行頭\nで整形済みを表す ... X( + $text = preg_replace("/\s\[#[A-Za-z][\w-]+\]/",'',$text); // [#...]を削除 $text = "\n<a href=\"#$id\">".strip_htmltag(inline2(inline($text,TRUE)))."</a>\n";
ls2.inc.php 195行めあたり
// array_push($params['result'], '<li>'.$s_title // .'<a href="'.$href.LS2_CONTENT_HEAD.$anchor.'">'.$_ls2_messages['msg_go'].'</a>' + $s_title = preg_replace("/\s\&dagger\;$/",'',$s_title); // †を削除 array_push($params['result'], '<li><a href="'.$href.LS2_CONTENT_HEAD.$anchor.'">'. $s_title.'</a>'
convert_html 800行あたり
function Contents_UList($text,$id,$level,$id) { + if (preg_match('/^(.*)\&aname\(.*\)\{.*\}\;(.*)$/',$text,$matches)) + { + $text = $matches[1].$matches[2]; + } // テキストのリフォーム // 行頭\nで整形済みを表す ... X(
convert_html.php 809行めあたり
// テキストのリフォーム // 行頭\nで整形済みを表す ... X( - $text = "\n<a href=\"#$id\">".strip_htmltag(inline2(inline($text,TRUE)))."</a>\n"; + $text = "\n<a href=\"#$id\">".trim(strip_htmltag(inline2(inline($text,TRUE))))."</a>\n"; parent::ListContainer('ul', 'li', --$level, $text); }
///////////////////////////////////////////////// // 見出し行に固有のアンカーを自動挿入する $fixed_heading_anchor = 0;