mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-26 19:56:49 +00:00
Port urlencoded char support to preprocessor-supporting link target
production, and remove old link_target production.
This commit is contained in:
parent
001194b140
commit
f02b3d91c6
Notes:
Gabriel Wicke
2012-02-27 16:40:01 +00:00
|
@ -461,7 +461,15 @@ spaceless_preprocessor_text
|
|||
return flatten_string ( r );
|
||||
}
|
||||
|
||||
link_preprocessor_text
|
||||
wikilink_preprocessor_text
|
||||
= r:( t:[^%<~[{\n\r\t|!\]} &=]+ { return t.join(''); }
|
||||
/ urlencoded_char
|
||||
/ directive
|
||||
/ !inline_breaks !"]]" text_char )+ {
|
||||
return flatten ( r );
|
||||
}
|
||||
|
||||
extlink_preprocessor_text
|
||||
= r:( t:[^'<~[{\n\r|!\]}\t&="' \u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000]+ { return t.join(''); }
|
||||
/ directive
|
||||
/ urlencoded_char
|
||||
|
@ -743,7 +751,7 @@ extlink
|
|||
"["
|
||||
& { return setFlag('extlink'); }
|
||||
//target:urllink
|
||||
target:link_preprocessor_text
|
||||
target:extlink_preprocessor_text
|
||||
text:(( space / [\u00A0\u1680\u180E\u2000-\u200A\u202F\u205F\u3000] )*
|
||||
t:inlineline { return t } )?
|
||||
"]" {
|
||||
|
@ -901,7 +909,7 @@ wikilink
|
|||
= "[["
|
||||
! url
|
||||
//target:link_target
|
||||
target:preprocessor_text
|
||||
target:wikilink_preprocessor_text
|
||||
lcontent:( "|" lt:link_text { return lt } )*
|
||||
"]]"
|
||||
// XXX In real MediaWiki, this is a language-dependent positive character
|
||||
|
@ -931,16 +939,6 @@ wikilink
|
|||
return [obj].concat(textTokens, [new EndTagTk( 'a' )]);
|
||||
}
|
||||
|
||||
link_target
|
||||
= h:( c:[^|%\n\]]+ { return c.join('') } // quickly eat anything unsuspicious
|
||||
/ !"]]"
|
||||
hi:(
|
||||
[^|%\n]
|
||||
/ urlencoded_char
|
||||
/ '%'
|
||||
) { return hi }
|
||||
)* { return h.join(''); }
|
||||
|
||||
link_text
|
||||
= & { return setFlag('linkdesc'); }
|
||||
h:inline
|
||||
|
|
Loading…
Reference in a new issue