Index: trunk/phase3/tests/parser/parserTests.txt |
— | — | @@ -3928,6 +3928,126 @@ |
3929 | 3929 | !! end |
3930 | 3930 | |
3931 | 3931 | !! test |
| 3932 | +pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149) |
| 3933 | +!! options |
| 3934 | +pst |
| 3935 | +!! input |
| 3936 | +[[Article(context)|]] |
| 3937 | +[[Bar:Article(context)|]] |
| 3938 | +[[:Bar:Article(context)|]] |
| 3939 | +[[|Article(context)]] |
| 3940 | +[[Bar:X (Y) Z|]] |
| 3941 | +[[:Bar:X (Y) Z|]] |
| 3942 | +!! result |
| 3943 | +[[Article(context)|Article]] |
| 3944 | +[[Bar:Article(context)|Article]] |
| 3945 | +[[:Bar:Article(context)|Article]] |
| 3946 | +[[Article(context)]] |
| 3947 | +[[Bar:X (Y) Z|X (Y) Z]] |
| 3948 | +[[:Bar:X (Y) Z|X (Y) Z]] |
| 3949 | +!! end |
| 3950 | + |
| 3951 | +!! test |
| 3952 | +pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149) |
| 3953 | +!! options |
| 3954 | +pst |
| 3955 | +!! input |
| 3956 | +[[Article (context)|]] |
| 3957 | +[[Bar:Article (context)|]] |
| 3958 | +[[:Bar:Article (context)|]] |
| 3959 | +[[|Article (context)]] |
| 3960 | +[[Bar:X (Y) Z|]] |
| 3961 | +[[:Bar:X (Y) Z|]] |
| 3962 | +!! result |
| 3963 | +[[Article (context)|Article]] |
| 3964 | +[[Bar:Article (context)|Article]] |
| 3965 | +[[:Bar:Article (context)|Article]] |
| 3966 | +[[Article (context)]] |
| 3967 | +[[Bar:X (Y) Z|X (Y) Z]] |
| 3968 | +[[:Bar:X (Y) Z|X (Y) Z]] |
| 3969 | +!! end |
| 3970 | + |
| 3971 | +!! test |
| 3972 | +pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149) |
| 3973 | +!! options |
| 3974 | +pst |
| 3975 | +!! input |
| 3976 | +[[Article(context)|]] |
| 3977 | +[[Bar:Article(context)|]] |
| 3978 | +[[:Bar:Article(context)|]] |
| 3979 | +[[|Article(context)]] |
| 3980 | +[[Bar:X(Y)Z|]] |
| 3981 | +[[:Bar:X(Y)Z|]] |
| 3982 | +!! result |
| 3983 | +[[Article(context)|Article]] |
| 3984 | +[[Bar:Article(context)|Article]] |
| 3985 | +[[:Bar:Article(context)|Article]] |
| 3986 | +[[Article(context)]] |
| 3987 | +[[Bar:X(Y)Z|X(Y)Z]] |
| 3988 | +[[:Bar:X(Y)Z|X(Y)Z]] |
| 3989 | +!! end |
| 3990 | + |
| 3991 | +!! test |
| 3992 | +pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149) |
| 3993 | +!! options |
| 3994 | +pst |
| 3995 | +!! input |
| 3996 | +[[Article(context)|]] |
| 3997 | +[[Bar:Article(context)|]] |
| 3998 | +[[:Bar:Article(context)|]] |
| 3999 | +[[|Article(context)]] |
| 4000 | +[[Bar:X (Y) Z|]] |
| 4001 | +[[:Bar:X (Y) Z|]] |
| 4002 | +!! result |
| 4003 | +[[Article(context)|Article]] |
| 4004 | +[[Bar:Article(context)|Article]] |
| 4005 | +[[:Bar:Article(context)|Article]] |
| 4006 | +[[Article(context)]] |
| 4007 | +[[Bar:X (Y) Z|X (Y) Z]] |
| 4008 | +[[:Bar:X (Y) Z|X (Y) Z]] |
| 4009 | +!! end |
| 4010 | + |
| 4011 | +!! test |
| 4012 | +pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149) |
| 4013 | +!! options |
| 4014 | +pst |
| 4015 | +!! input |
| 4016 | +[[Article (context)|]] |
| 4017 | +[[Bar:Article (context)|]] |
| 4018 | +[[:Bar:Article (context)|]] |
| 4019 | +[[|Article (context)]] |
| 4020 | +[[Bar:X (Y) Z|]] |
| 4021 | +[[:Bar:X (Y) Z|]] |
| 4022 | +!! result |
| 4023 | +[[Article (context)|Article]] |
| 4024 | +[[Bar:Article (context)|Article]] |
| 4025 | +[[:Bar:Article (context)|Article]] |
| 4026 | +[[Article (context)]] |
| 4027 | +[[Bar:X (Y) Z|X (Y) Z]] |
| 4028 | +[[:Bar:X (Y) Z|X (Y) Z]] |
| 4029 | +!! end |
| 4030 | + |
| 4031 | +!! test |
| 4032 | +pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149) |
| 4033 | +!! options |
| 4034 | +pst |
| 4035 | +!! input |
| 4036 | +[[Article(context)|]] |
| 4037 | +[[Bar:Article(context)|]] |
| 4038 | +[[:Bar:Article(context)|]] |
| 4039 | +[[|Article(context)]] |
| 4040 | +[[Bar:X(Y)Z|]] |
| 4041 | +[[:Bar:X(Y)Z|]] |
| 4042 | +!! result |
| 4043 | +[[Article(context)|Article]] |
| 4044 | +[[Bar:Article(context)|Article]] |
| 4045 | +[[:Bar:Article(context)|Article]] |
| 4046 | +[[Article(context)]] |
| 4047 | +[[Bar:X(Y)Z|X(Y)Z]] |
| 4048 | +[[:Bar:X(Y)Z|X(Y)Z]] |
| 4049 | +!! end |
| 4050 | + |
| 4051 | +!! test |
3932 | 4052 | pre-save transform: trim trailing empty lines |
3933 | 4053 | !! options |
3934 | 4054 | pst |
Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4320,9 +4320,9 @@ |
4321 | 4321 | $tc = "[$wgLegalTitleChars]"; |
4322 | 4322 | $nc = '[ _0-9A-Za-z\x80-\xff-]'; # Namespaces can use non-ascii! |
4323 | 4323 | |
4324 | | - $p1 = "/\[\[(:?$nc+:|:|)($tc+?)( \\($tc+\\))\\|]]/"; # [[ns:page (context)|]] |
4325 | | - $p4 = "/\[\[(:?$nc+:|:|)($tc+?)(($tc+))\\|]]/"; # [[ns:page(context)|]] |
4326 | | - $p3 = "/\[\[(:?$nc+:|:|)($tc+?)( \\($tc+\\)|)(, $tc+|)\\|]]/"; # [[ns:page (context), context|]] |
| 4324 | + $p1 = "/\[\[(:?$nc+:|:|)($tc+?)(\s?\\($tc+\\))\\|]]/"; # [[ns:page (context)|]] |
| 4325 | + $p4 = "/\[\[(:?$nc+:|:|)($tc+?)(\s?($tc+))\\|]]/"; # [[ns:page(context)|]] |
| 4326 | + $p3 = "/\[\[(:?$nc+:|:|)($tc+?)(\s?\\($tc+\\)|)(, $tc+|)\\|]]/"; # [[ns:page (context), context|]] |
4327 | 4327 | $p2 = "/\[\[\\|($tc+)]]/"; # [[|page]] |
4328 | 4328 | |
4329 | 4329 | # try $p1 first, to turn "[[A, B (C)|]]" into "[[A, B (C)|A, B]]" |