| -145,9 +145,78 |
| ... |
| }}} |
|
|
|
| === # 역링크 처리, 링크 변경 처리 === |
|
|
| 예를 들어 갑 페이지에 <code>[[을#앵커]]</code>란 링크가 있으면 이것을 링크로 처리해주지 못하는 문제가 있었다. |
| * Local:action=links""에서 갑 페이지에 있는 링크 중 을이 없음 |
| * 을 페이지의 역링크 목록에 갑이 없음 |
| * 을 페이지의 이름을 병으로 바꾸었을 때 이 링크가 자동으로 수정되지 않음 |
|
| wiki.pl 수정: (diff 형식은 [https://github.com/gypark/UseModKr/compare/38ce42e3f2...106491f Comparing 38ce42e3f2...106491f for gypark's UseModKr - GitHub]) |
| {{{#!vim perl |
| sub GetPageLinks { |
| ... |
| my $fl = $FreeLinkPattern; |
| $text =~ s/\[\[$fl\|[^\]]+\]\]/push(@links, &FreeToNormal($1)), ' '/ge; |
| $text =~ s/\[\[$fl\]\]/push(@links, &FreeToNormal($1)), ' '/ge; |
| # 두 줄 추가 |
| $text =~ s/\[\[$AnchoredFreeLinkPattern\|([^\]]+)\]\]/push(@links, &FreeToNormal($1)), ' '/ge; |
| $text =~ s/\[\[$AnchoredFreeLinkPattern\]\]/push(@links, &FreeToNormal($1)), ' '/ge; |
| } |
| if ($WikiLinks) { |
| $text =~ s/$LinkPattern/push(@links, &StripUrlPunct($1)), ' '/ge; |
| ... |
| } |
|
| sub SubstituteTextLinks { |
| ... |
| $text =~ |
| s/\[\[$FreeLinkPattern\|([^\]]+)\]\]/&SubFreeLink($1,$2,$old,$new)/geo; |
| $text =~ s/\[\[$FreeLinkPattern\]\]/&SubFreeLink($1,"",$old,$new)/geo; |
| # 세 줄 추가 |
| $text =~ |
| s/\[\[$AnchoredFreeLinkPattern\|([^\]]+)\]\]/&SubFreeLink($1,$3,$old,$new,$2)/geo; |
| $text =~ s/\[\[$AnchoredFreeLinkPattern\]\]/&SubFreeLink($1,"",$old,$new,$2)/geo; |
| } |
| if ($BracketText) { # Links like [URL text of link] |
| $text =~ s/(\[$UrlPattern\s+([^\]]+?)\])/&StoreRaw($1)/geo; |
| ... |
| } |
|
| sub SubFreeLink { |
| # 다음 줄 수정 |
| # my ($link, $name, $old, $new) = @_; |
| + my ($link, $name, $old, $new, $anchor) = @_; |
| my ($oldlink); |
|
| $oldlink = $link; |
| ... |
| $link = $oldlink; # Preserve spaces if no match |
| } |
| $link = "[[$link"; |
| # 세 줄 추가 |
| if ( defined $anchor and $anchor ne '' ) { |
| $link .= "#$anchor"; |
| } |
| if ($name ne "") { |
| $link .= "|$name"; |
| } |
| ... |
| } |
| }}} |
|
|
|
| == # 추가 업데이트 내역 == |
| ext2.15 - Anchor 링크 패턴 정리. anchor 매크로 삭제 |
|
| ext2.23b - 링크로 처리되지 않는 문제 해결 |
| <mysign([[Raymundo]],2012-2-24 1:23 am)> |
|
|
|
| == # 사용자 의견 == |
| 이건 개선인지 개악인지 조금 모호한 것이...원래 앵커가 절대좌표(?)로 인식되었었는데 이제 상대좌표로 걸리게 됩니다. 누군가가 중간에 앵커를 삽입하거나 삭제하면 그 뒤의 놈들은 모두 영향을 받게 되지요. :)\\ |