Go to the documentation of this file.
18 $this->assertEquals( $transformedA, $cssB,
'Test A-B transformation' );
21 $this->assertEquals( $transformedB, $cssA,
'Test B-A transformation' );
26 $this->assertEquals( $transformedA, $cssA,
'Nothing was flipped' );
34 $swapLtrRtlInURL = isset(
$options[
'swapLtrRtlInURL'] ) ?
36 $swapLeftRightInURL = isset(
$options[
'swapLeftRightInURL'] ) ?
37 $options[
'swapLeftRightInURL'] :
false;
41 $this->assertEquals( $expectedOutput, $flipped,
42 'Test flipping, options: url-ltr-rtl=' . ( $swapLtrRtlInURL ?
'true' :
'false' )
43 .
' url-left-right=' . ( $swapLeftRightInURL ?
'true' :
'false' )
54 $this->assertEquals( $expectedOutput, $flipped,
'Test flipping' );
73 '.foo { alright: 0; }'
76 '.foo { balleft: 0; }'
81 '.foo { padding-left: 0; }',
82 '.foo { padding-right: 0; }'
85 '.foo { margin-left: 0; }',
86 '.foo { margin-right: 0; }'
89 '.foo { border-left: 0; }',
90 '.foo { border-right: 0; }'
95 '.foo { border-left-color: red; }',
96 '.foo { border-right-color: red; }'
100 '.foo { x-left-y: 0; }',
101 '.foo { x-right-y: 0; }'
106 '.foo { padding: 0; }'
109 '.foo { padding: 0 1px; }'
112 '.foo { padding: 0 1px 2px; }'
115 '.foo { padding: 0 1px 2px 3px; }',
116 '.foo { padding: 0 3px 2px 1px; }'
121 '.foo { padding: .25em 15px 0pt 0ex; }',
122 '.foo { padding: .25em 0ex 0pt 15px; }'
125 '.foo { margin: 1px -4px 3px 2px; }',
126 '.foo { margin: 1px 2px 3px -4px; }'
129 '.foo { padding: 0 15px .25em 0; }',
130 '.foo { padding: 0 0 .25em 15px; }'
133 '.foo { padding: 1px 4.1grad 3px 2%; }',
134 '.foo { padding: 1px 2% 3px 4.1grad; }'
137 '.foo { padding: 1px 2px 3px auto; }',
138 '.foo { padding: 1px auto 3px 2px; }'
141 '.foo { padding: 1px inherit 3px auto; }',
142 '.foo { padding: 1px auto 3px inherit; }'
146 '.foo { border-radius: .25em 15px 0pt 0ex; }',
147 '.foo { border-radius: 15px .25em 0ex 0pt; }'
150 '.foo { border-radius: 0px 0px 5px 5px; }',
154 '.foo { x-unknown: a b c d; }'
157 '.foo barpx 0 2% { opacity: 0; }'
160 '#settings td p strong'
164 '.foo { border-color: red green blue white }',
165 '.foo { border-color: red white blue green }',
169 '.foo { border-color: red #f00 rgb(255, 0, 0) rgba(255, 0, 0, 0.5) }',
170 '.foo { border-color: red rgba(255, 0, 0, 0.5) rgb(255, 0, 0) #f00 }',
174 '.foo { border-color: red #f00 hsl(0, 100%, 50%) hsla(0, 100%, 50%, 0.5) }',
175 '.foo { border-color: red hsla(0, 100%, 50%, 0.5) hsl(0, 100%, 50%) #f00 }',
179 '.foo { -x-unknown: 1 2 3 4 5; }'
182 '.foo { -x-unknown: 1 2 3 4 5 6; }'
187 '.foo { margin: 1em 0 .25em; }'
190 '.foo { margin:-1.5em 0 -.75em; }'
195 '.foo { padding: 1px 2px; }'
200 '.foo { padding: 1px; }'
205 '.foo { box-shadow: -6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
206 '.foo { box-shadow: 6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
209 '.foo { box-shadow: inset -6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
210 '.foo { box-shadow: inset 6px 3px 8px 5px rgba(0, 0, 0, 0.25); }',
213 '.foo { text-shadow: orange 2px 0; }',
214 '.foo { text-shadow: orange -2px 0; }',
217 '.foo { text-shadow: 2px 0 orange; }',
218 '.foo { text-shadow: -2px 0 orange; }',
222 '.foo { text-shadow: orange 0 2px; }'
229 '.foo { direction: ltr; }',
230 '.foo { direction: rtl; }'
233 '.foo { direction: rtl; }',
234 '.foo { direction: ltr; }'
237 'input { direction: ltr; }',
238 'input { direction: rtl; }'
241 'input { direction: rtl; }',
242 'input { direction: ltr; }'
245 'body { direction: ltr; }',
246 'body { direction: rtl; }'
249 '.foo, body, input { direction: ltr; }',
250 '.foo, body, input { direction: rtl; }'
253 'body { padding: 10px; direction: ltr; }',
254 'body { padding: 10px; direction: rtl; }'
257 'body { direction: ltr } .myClass { direction: ltr }',
258 'body { direction: rtl } .myClass { direction: rtl }'
263 '.foo { float: left; }',
264 '.foo { float: right; }'
267 '.foo { text-align: left; }',
268 '.foo { text-align: right; }'
271 '.foo { -x-unknown: left; }',
272 '.foo { -x-unknown: right; }'
276 '.column-left { width: 0; }'
279 'a.left { width: 0; }'
282 'a.leftification { width: 0; }'
285 'a.ltr { width: 0; }'
288 # <div
class=
"a-ltr png">
289 '.a-ltr.png { width: 0; }'
293 'foo-ltr[attr="x"] { width: 0; }'
296 'div.left > span.right+span.left { width: 0; }'
299 '.thisclass .left .myclass { width: 0; }'
302 '.thisclass .left .myclass #myid { width: 0; }'
307 '.foo { cursor: e-resize; }',
308 '.foo { cursor: w-resize; }'
311 '.foo { cursor: se-resize; }',
312 '.foo { cursor: sw-resize; }'
315 '.foo { cursor: ne-resize; }',
316 '.foo { cursor: nw-resize; }'
321 '.foo { background-position: top left; }',
322 '.foo { background-position: top right; }'
325 '.foo { background: url(/foo/bar.png) top left; }',
326 '.foo { background: url(/foo/bar.png) top right; }'
329 '.foo { background: url(/foo/bar.png) top left no-repeat; }',
330 '.foo { background: url(/foo/bar.png) top right no-repeat; }'
333 '.foo { background: url(/foo/bar.png) no-repeat top left; }',
334 '.foo { background: url(/foo/bar.png) no-repeat top right; }'
337 '.foo { background: #fff url(/foo/bar.png) no-repeat top left; }',
338 '.foo { background: #fff url(/foo/bar.png) no-repeat top right; }'
341 '.foo { background-position: 100% 40%; }',
342 '.foo { background-position: 0% 40%; }'
345 '.foo { background-position: 23% 0; }',
346 '.foo { background-position: 77% 0; }'
349 '.foo { background-position: 23% auto; }',
350 '.foo { background-position: 77% auto; }'
353 '.foo { background-position-x: 23%; }',
354 '.foo { background-position-x: 77%; }'
357 '.foo { background-position-y: 23%; }',
358 '.foo { background-position-y: 23%; }'
361 '.foo { background:url(../foo.png) no-repeat 75% 50%; }',
362 '.foo { background:url(../foo.png) no-repeat 25% 50%; }'
365 '.foo { background: 10% 20% } .bar { background: 40% 30% }',
366 '.foo { background: 90% 20% } .bar { background: 60% 30% }'
371 'body { direction: rtl; float: right; } .foo { direction: ltr; float: right; }',
372 'body { direction: ltr; float: left; } .foo { direction: rtl; float: left; }',
377 '.foo { float: left; float: right; float: left; }',
378 '.foo { float: right; float: left; float: right; }',
383 '/* left /* right */left: 10px',
384 '/* left /* right */right: 10px'
387 '/*left*//*left*/left: 10px',
388 '/*left*//*left*/right: 10px'
391 '/* Going right is cool */ .foo { width: 0 }',
394 "/* padding-right 1 2 3 4 */\n#test { width: 0}\n/*right*/"
397 "/** Two line comment\n * left\n \*/\n#test {width: 0}"
403 '/* @noflip */ div { float: left; }'
407 '/* @noflip */ div, .notme { float: left; }'
411 'div, /* @noflip */ .foo { float: left; }'
415 'div, .notme /* @noflip */ { float: left; }'
419 '/* @noflip */ div { float: left; } .foo { float: left; }',
420 '/* @noflip */ div { float: left; } .foo { float: right; }'
424 '/* @noflip */ .test:not(:first) { margin-right: -0.25em; margin-left: 0.25em; }',
425 '/* @noflip */ .test:not(:first) { margin-right: -0.25em; margin-left: 0.25em; }'
429 '.foo { float: left; } /* @noflip */ div { float: left; }',
430 '.foo { float: right; } /* @noflip */ div { float: left; }'
434 'div { /* @noflip */ float: left; text-align: left; }',
435 'div { /* @noflip */ float: left; text-align: right; }'
439 'div { float: left; /* @noflip */ text-align: left; }',
440 'div { float: right; /* @noflip */ text-align: left; }'
444 '/* @noflip */ div.foo[bar*=baz] { float:left; clear: left; }'
448 '/* @noflip */ div.foo[bar^=baz] { float:left; clear: left; }'
452 '/* @noflip */ div.foo[bar~=baz] { float:left; clear: left; }'
456 '/* @noflip */ div.foo[bar=baz] { float:left; clear: left; }'
460 '/* @noflip */ div.foo[bar=\'baz{quux\'] { float:left; clear: left; }'
465 'background-image: -moz-linear-gradient(#326cc1, #234e8c);'
468 'background-image: -webkit-gradient(linear, 100% 0%, 0% 0%, from(#666666), to(#ffffff));'
494 ".foo { left : 0 ; }",
495 ".foo { right : 0 ; }"
498 ".foo\n { left : 0 ; }",
499 ".foo\n { right : 0 ; }"
502 ".foo\n { \nleft : 0 ; }",
503 ".foo\n { \nright : 0 ; }"
506 ".foo\n { \n left : 0 ; }",
507 ".foo\n { \n right : 0 ; }"
510 ".foo\n { \n left\n : 0; }",
511 ".foo\n { \n right\n : 0; }"
514 ".foo \n { \n left\n : 0; }",
515 ".foo \n { \n right\n : 0; }"
518 ".foo\n{\nleft\n:\n0;}",
519 ".foo\n{\nright\n:\n0;}"
522 ".foo\n.bar {\n\tleft: 0;\n}",
523 ".foo\n.bar {\n\tright: 0;\n}"
526 ".foo\t{\tleft\t:\t0;}",
527 ".foo\t{\tright\t:\t0;}"
532 '.foo { leftxx: 0; }',
533 '.foo { leftxx: 0; }'
536 '.foo { rightxx: 0; }',
537 '.foo { rightxx: 0; }'
549 # [ - _ . ] <-> [ left right ltr rtl ]
550 'foo.jpg' =>
'foo.jpg',
551 'left.jpg' =>
'right.jpg',
552 'ltr.jpg' =>
'rtl.jpg',
554 'foo-left.png' =>
'foo-right.png',
555 'foo_left.png' =>
'foo_right.png',
556 'foo.left.png' =>
'foo.right.png',
558 'foo-ltr.png' =>
'foo-rtl.png',
559 'foo_ltr.png' =>
'foo_rtl.png',
560 'foo.ltr.png' =>
'foo.rtl.png',
562 'left-foo.png' =>
'right-foo.png',
563 'left_foo.png' =>
'right_foo.png',
564 'left.foo.png' =>
'right.foo.png',
566 'ltr-foo.png' =>
'rtl-foo.png',
567 'ltr_foo.png' =>
'rtl_foo.png',
568 'ltr.foo.png' =>
'rtl.foo.png',
570 'foo-ltr-left.gif' =>
'foo-rtl-right.gif',
571 'foo_ltr_left.gif' =>
'foo_rtl_right.gif',
572 'foo.ltr.left.gif' =>
'foo.rtl.right.gif',
573 'foo-ltr_left.gif' =>
'foo-rtl_right.gif',
574 'foo_ltr.left.gif' =>
'foo_rtl.right.gif',
577 foreach ( $bgPairs
as $left =>
$right ) {
578 # By default '-rtl' and '-left' etc. are not touched,
579 # Only when the appropiate parameter is set.
581 ".foo { background: url(images/$left); }",
582 ".foo { background: url(images/$left); }"
585 ".foo { background: url(images/$right); }",
586 ".foo { background: url(images/$right); }"
589 ".foo { background: url(images/$left); }",
590 ".foo { background: url(images/$right); }",
592 'swapLtrRtlInURL' =>
true,
593 'swapLeftRightInURL' =>
true,
597 ".foo { background: url(images/$right); }",
598 ".foo { background: url(images/$left); }",
600 'swapLtrRtlInURL' =>
true,
601 'swapLeftRightInURL' =>
true,
617 # <foo-left-x attr=
"x">
618 'foo-left-x[attr="x"] { width: 0; }',
619 'foo-left-x[attr="x"] { width: 0; }'
622 # <div
class=
"foo" data-left=
"x">
623 '.foo[data-left="x"] { width: 0; }',
624 '.foo[data-left="x"] { width: 0; }'
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
testTransform( $cssA, $cssB=null)
@dataProvider provideTransformCases
return false if a UserGetRights hook might remove the named right $right
static provideTransformAdvancedCases()
These cases are tested in one way only (format: actual, expected, msg).
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
static provideTransformCases()
These transform cases are tested in both directions No need to declare a principle twice in both dire...
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Based on the test suite of the original Python CSSJanus libary: http://code.google....
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static transform( $css, $swapLtrRtlInURL=false, $swapLeftRightInURL=false)
Transform an LTR stylesheet to RTL.
testTransformAdvanced( $code, $expectedOutput, $options=array())
@dataProvider provideTransformAdvancedCases
testTransformBroken( $code, $expectedOutput)
@dataProvider provideTransformBrokenCases @group Broken
static provideTransformBrokenCases()
Cases that are currently failing, but should be looked at in the future as enhancements and/or bug fi...