Wiki Heading 개선
UseModWiki소스수정/WikiHeading개선을 그대로 적용. Thanks to 조프.
wiki.pl 수정
sub WikiToHTML {
...
$pageText =~ s/&__LT__;toc&__GT__;/<a name="toc"><\/a>$TableOfContents/i;
$pageText =~ s/&__LT__;toc&__GT__;/$TableOfContents/gi;
...
}
sub WikiHeadingNumber {
...
return &StoreHref(" name='$anchor' href='#toc'",$number);
}
추가 업데이트 내역
사용자 의견
wikicreole markup suggested (in coexistence with earlier markup).
First of all, I'm not sure where the exact site for cutting regular expresion at "/(^[ \t]*(\=+)\s+[^\n]+\s+\=+\s*$)/", but works fine by now.
<pre>
sub DoEdit {
- while ($temp_text =~ /(^[ \t]*(\=+)\s+[^\n]+\s+\=+\s*$)/gm) {
+ while ($temp_text =~ /(^[ \t]*(\=+)\s+[^\n]*$)/gm) {
$num++;
$h_pos[$num] = pos($temp_text) - length($1);
$h_depth[$num] = length($2);
if ($num == $section) { # summary
my $h_str = $1;
- $h_str =~ /^[ \t]*\=+\s+(#\s+)?([^\n]+)\s+\=+\s*$/;
+ $h_str =~ /^[ \t]*\=+\s+(#\s+)?([^\n]+)\s+\s*$/;
$h_str = $2;
+ # suppress the "=" series on the right of header
+ $h_str =~ s/(\=+)?//g;
+ # suppress possible blank before the "=" series on the right of header
+ $h_str =~ s/( +)?$//g;
$h_str =~ s/"/"/g;
$q->param("summary", "$h_str - "
. &GetParam("summary", "")) unless $preview || $saveEdit;
$header .= '. ' . T('Section') . '=' . $num . ': ' . $h_str ;
}
}
....
sub CommonMarkup {
s/(^|\n)\s*(\=+)\s+([^\n]+)\s+\=+/&WikiHeading($1, $2, $3)/geo;
+ # creole heading
+ s/(^|\n)\s*(\=+)\s+([^\n]+)/&WikiHeading($1, $2, $3)/geo;
...
sub DoPostMain {
...
- while ($temp_text =~ /(^[ \t]*(\=+)\s+[^\n]+\s+\=+\s*$)/gm) {
+ while ($temp_text =~ /(^[ \t]*(\=+)?\s+[^\n]*$)/gm) {
End.
Hi Raymundo, one more suggestion not a request
sub WikiHeading {
...
- $edit_section = '' if (&GetParam("embed", $EmbedWiki));
+ $edit_section = $SectionNumber if (&GetParam("embed", $EmbedWiki));
...
}
Thanks ...
위키위키분류