[첫화면으로]UseModWiki소스수정/WikiHeading

마지막으로 [b]

변경사항 (가장 최근의 "다른 사용자에 의한 수정"부터) (일반적인 수정, 소소한 수정)

-27,6 +27,56
=== 추가 업데이트 내역 ===
=== 사용자 의견 ===
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/"/&quot;/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. <mysign([[JuanmaMP]],2012-7-11 11:17 am)>
Hi Raymundo, one more suggestion not a request
{{{#!vim perl
sub WikiHeading {
...
- $edit_section = '' if (&GetParam("embed", $EmbedWiki));
+ $edit_section = $SectionNumber if (&GetParam("embed", $EmbedWiki));
    ...
}
}}}
Thanks ... <mysign([[JuanmaMP]],2013-5-12 6:29 am)>
<longcomments(UseModWiki소스수정/WikiHeading,100)>
----
[[위키위키분류]]


Wiki Heading 개선

Jof: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\"") . $number;          마지막 줄을 다음과 같이 수정
    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.
-- JuanmaMP 2012-7-11 11:17 am

Hi Raymundo, one more suggestion not a request

sub WikiHeading {
...
- $edit_section = '' if (&GetParam("embed", $EmbedWiki));
+ $edit_section = $SectionNumber if (&GetParam("embed", $EmbedWiki));
    ...
}
Thanks ...
-- JuanmaMP 2013-5-12 6:29 am
이름:  
Homepage:
내용:
 

위키위키분류

마지막 편집일: 2013-5-12 6:33 am (변경사항 [d])
1424 hits | Permalink | 변경내역 보기 [h] | 페이지 소스 보기