/* 위키 페이지 링크 */ A.wikipagelink:link, A.wikipagelink:active, A.wikipagelink:visited, A.wikipagelink:hover { background: transparent; color: green; text-decoration: none; } A.wikipagelink:hover { text-decoration: underline; } /* 위키 페이지 편집 링크 */ A.wikipageedit:link, A.wikipageedit:active, A.wikipageedit:visited, A.wikipageedit:hover { background: transparent; color: red; text-decoration: none; } A.wikipageedit:hover { text-decoration: underline; }
그 외의 패턴은 InitLinkPatterns 함수의 diff로 설명을 대신함: 사실 패턴의 의미 자체가 달라진 건 거의 없고, oddmuse를 따라서 문자의 코드값 범위를 \x80-\xff 로 넓힌 게 핵심.
sub InitLinkPatterns { my ($UpperLetter, $LowerLetter, $AnyLetter, $LpA, $LpB, $QDelim); # Field separators are used in the URL-style patterns below. # $FS = "\xb3"; # The FS character is a superscript "3" - $FS = "\x7f"; + $FS = "\x1e"; # by gypark. from oddmuse $FS1 = $FS . "1"; # The FS values are used to separate fields $FS2 = $FS . "2"; # in stored hashtables and other data structures. $FS3 = $FS . "3"; # The FS character is not allowed in user data. ############### ### added by gypark $FS_lt = $FS . "lt"; $FS_gt = $FS . "gt"; ### ############### - - $UpperLetter = "[A-Z"; - $LowerLetter = "[a-z"; - $AnyLetter = "[A-Za-z"; - if ($NonEnglish) { - $UpperLetter .= "\xc0-\xde"; - $LowerLetter .= "\xdf-\xff"; - $AnyLetter .= "\xc0-\xff"; - } - if (!$SimpleLinks) { - $AnyLetter .= "_0-9"; - } - $UpperLetter .= "]"; $LowerLetter .= "]"; $AnyLetter .= "]"; + $UpperLetter = "[A-Z\xc0-\xde]"; + $LowerLetter = "[a-z\xdf-\xff]"; + $AnyLetter = "[A-Za-z\x80-\xff_0-9]"; # Main link pattern: lowercase between uppercase, then anything $LpA = $UpperLetter . "+" . $LowerLetter . "+" . $UpperLetter . $AnyLetter . "*"; # Optional subpage link pattern: uppercase, lowercase, then anything $LpB = $UpperLetter . "+" . $LowerLetter . "+" . $AnyLetter . "*"; if ($UseSubpage) { # Loose pattern: If subpage is used, subpage may be simple name $LinkPattern = "((?:(?:$LpA)?\\/$LpB)|$LpA)"; # Strict pattern: both sides must be the main LinkPattern # $LinkPattern = "((?:(?:$LpA)?\\/)?$LpA)"; } else { $LinkPattern = "($LpA)"; } $QDelim = '(?:"")?'; # Optional quote delimiter (not in output) -############### -### replaced by gypark -### anchor 에 한글 사용 -# $AnchoredLinkPattern = $LinkPattern . '#(\\w+)' . $QDelim if $NamedAnchors; - $AnchoredLinkPattern = $LinkPattern . '#([0-9A-Za-z\xa0-\xff]+)' . $QDelim if $NamedAnchors; -### -############### $LinkPattern .= $QDelim; # Inter-site convention: sites must start with uppercase letter # (Uppercase letter avoids confusion with URLs) $InterSitePattern = $UpperLetter . $AnyLetter . "+"; $InterLinkPattern = "((?:$InterSitePattern:[^\\]\\s\"<>$FS]+)$QDelim)"; + # free link [[pagename]] if ($FreeLinks) { # Note: the - character must be first in $AnyLetter definition - #if ($NonEnglish) { - $AnyLetter = "[-,.()' _0-9A-Za-z\xa0-\xff]"; - #} else { - # $AnyLetter = "[-,.()' _0-9A-Za-z]"; - #} + $AnyLetter = "[-,.()' _0-9A-Za-z\x80-\xff]"; } - $FreeLinkPattern = "($AnyLetter+)"; if ($UseSubpage) { $FreeLinkPattern = "((?:(?:$AnyLetter+)?\\/)?$AnyLetter+)"; + } else { + $FreeLinkPattern = "($AnyLetter+)"; } $FreeLinkPattern .= $QDelim; -############### -### added by gypark -### 한글패이지에 anchor 사용 -### from Bab2's patch - $AnchoredFreeLinkPattern = $FreeLinkPattern . '#([0-9A-Za-z\xa0-\xff]+)' . $QDelim if $NamedAnchors; -### -############### + # anchored link + $AnchorPattern = '#([0-9A-Za-z\x80-\xff]+)'; + $AnchoredLinkPattern = $LinkPattern . $AnchorPattern . $QDelim if $NamedAnchors; + $AnchoredFreeLinkPattern = $FreeLinkPattern . $AnchorPattern . $QDelim if $NamedAnchors; # Url-style links are delimited by one of: # 1. Whitespace (kept in output) # 2. Left or right angle-bracket (< or >) (kept in output) # 3. Right square-bracket (]) (kept in output) # 4. A single double-quote (") (kept in output) # 5. A $FS (field separator) character (kept in output) # 6. A double double-quote ("") (removed from output) - - $UrlProtocols = "http|https|ftp|afs|news|nntp|mid|cid|mailto|wais|mms|mmst|" - . "prospero|telnet|gopher"; - $UrlProtocols .= '|file' if $NetworkFile; + $UrlProtocols = 'http|https|ftp|afs|news|nntp|mid|cid|mailto|wais|mms|mmst|prospero|telnet|gopher|irc'; + $UrlProtocols .= '|file' if $NetworkFile; $UrlPattern = "((?:(?:$UrlProtocols):[^\\]\\s\"<>$FS]+)$QDelim)"; $ImageExtensions = "(gif|jpg|png|bmp|jpeg|GIF|JPG|PNG|BMP|JPEG)"; $RFCPattern = "RFC\\s?(\\d+)"; -############### -### replaced by gypark -### ISBN 패턴 수정 -# $ISBNPattern = "ISBN:?([0-9- xX]{10,})"; $ISBNPattern = "ISBN:?([0-9-xX]{10,})"; -### -############### }
sub InitLinkPatterns { my ($UpperLetter, $LowerLetter, $AnyLetter, $WikiWord, $QDelim); $QDelim = '(?:"")?';# Optional quote delimiter (removed from the output) $WikiWord = '[A-Z]+[a-z\x80-\xff]+[A-Z][A-Za-z\x80-\xff]*'; $LinkPattern = "($WikiWord)$QDelim"; $FreeLinkPattern = "([-,.()' _0-9A-Za-z\x80-\xff]+)"; # Intersites must start with uppercase letter to avoid confusion with URLs. $InterSitePattern = '[A-Z\x80-\xff]+[A-Za-z\x80-\xff]+'; $InterLinkPattern = "($InterSitePattern:[-a-zA-Z0-9\x80-\xff_=!?#\$\@~`\%&*+\\/:;.,]*[-a-zA-Z0-9\x80-\xff_=#\$\@~`\%&*+\\/])$QDelim"; $FreeInterLinkPattern = "($InterSitePattern:[-a-zA-Z0-9\x80-\xff_=!?#\$\@~`\%&*+\\/:;.,()' ]+)"; # plus space and other characters, and no restrictions on the end of the pattern $UrlProtocols = 'http|https|ftp|afs|news|nntp|mid|cid|mailto|wais|prospero|telnet|gopher|irc'; $UrlProtocols .= '|file' if $NetworkFile; my $UrlChars = '[-a-zA-Z0-9/@=+$_~*.,;:?!\'"()&#%]'; # see RFC 2396 my $EndChars = '[-a-zA-Z0-9/@=+$_~*]'; # no punctuation at the end of the url. $UrlPattern = "((?:$UrlProtocols):$UrlChars+$EndChars)"; $FullUrlPattern="((?:$UrlProtocols):$UrlChars+)"; # when used in square brackets $ImageExtensions = '(gif|jpg|png|bmp|jpeg)'; }
소스 보다가 잘 모르겠어서... $QDelim은 뭐하는 걸까요?