From: MatmaRex Date: Fri, 21 Dec 2012 19:26:29 +0000 (+0100) Subject: skin: Convert table of contents from to
X-Git-Tag: 1.31.0-rc.0~19294 X-Git-Url: http://git.cyclocoop.org/%24self?a=commitdiff_plain;h=435491fb25797ca6f0e832b2aaf6abd001444355;p=lhc%2Fweb%2Fwiklou.git skin: Convert table of contents from
to
It makes no sense semantically; it was only used to make the TOC not span full width of the page, which is easily achieved with CSS. Bug: 658 Change-Id: I4ecd0659d1f955a9b593d281a3fef0a81c218a52 --- diff --git a/RELEASE-NOTES-1.22 b/RELEASE-NOTES-1.22 index fb8896a1bb..6393252cb2 100644 --- a/RELEASE-NOTES-1.22 +++ b/RELEASE-NOTES-1.22 @@ -162,6 +162,11 @@ production. * (bug 41281) Fixed ugly output if file size could not be extracted for multi-page media. * (bug 50315) list=logevents API module will now output log entries by anonymous users. * (bug 38911) Handle headers with rowspan in jquery.tablesorter +* (bug 658) Converted the table of contents on wiki pages from
to
+ and adjusted skin CSS accordingly. The CSS was carefully crafted to be + backwards-compatible in all reasonable cases (uses of the __TOC__ magic word, + the #toc CSS id and the .toc CSS class). However, particularly bad abuse of + the id or the class can possibly break. === API changes in 1.22 === * (bug 25553) The JSON output formatter now leaves forward slashes unescaped diff --git a/includes/Linker.php b/includes/Linker.php index 3529d28b50..5bb92308ff 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1688,10 +1688,10 @@ class Linker { $lang = wfGetLangObj( $lang ); $title = wfMessage( 'toc' )->inLanguage( $lang )->escaped(); - return '
' + return '
' . '

' . $title . "

\n" . $toc - . "\n
\n"; + . "\n\n"; } /** diff --git a/skins/common/commonContent.css b/skins/common/commonContent.css index a36fa48f2b..ee102f7f07 100644 --- a/skins/common/commonContent.css +++ b/skins/common/commonContent.css @@ -14,6 +14,36 @@ padding: 5px; font-size: 95%; } + +/** + * We want to display the ToC element with intrinsic width. There are a few good + * old ways of making it this way, including floating it or making it a table. + * Both are clearly suboptimal. + * + * Thus we use display: inline-block. It is treated as an inline element with + * regard to text flow, but this isn't an issue here as the ToC is always + * sandwiched between other block-level elements. + */ +#toc, +.toc { + display: -moz-inline-block; + display: inline-block; + zoom: 1; + *display: inline; + padding: 7px; +} + +/* CSS for backwards-compatibility with cached page renders and creative uses in wikitext */ +table#toc, +table.toc { + border-collapse: collapse; +} +/* Remove additional paddings inside table-cells that are not present in
s */ +table#toc td, +table.toc td { + padding: 0; +} + #toc h2, .toc h2 { display: inline; diff --git a/skins/common/oldshared.css b/skins/common/oldshared.css index 2a9c25f5f6..7f90c77183 100644 --- a/skins/common/oldshared.css +++ b/skins/common/oldshared.css @@ -121,6 +121,21 @@ img { border: none; } padding: 5px; font-size: 95%; text-align: center; + display: -moz-inline-block; + display: inline-block; + zoom: 1; + *display: inline; + padding: 7px; +} +/* CSS for backwards-compatibility with cached page renders and creative uses in wikitext */ +table#toc, +table.toc { + border-collapse: collapse; +} +/* Remove additional paddings inside table-cells that are not present in
s */ +table#toc td, +table.toc td { + padding: 0; } #toc h2, .toc h2 { diff --git a/skins/modern/main.css b/skins/modern/main.css index f222028887..47a2542dd5 100644 --- a/skins/modern/main.css +++ b/skins/modern/main.css @@ -546,6 +546,23 @@ img.thumbborder { border-spacing: 0; background-color: #f0f0f0; border: solid 1px #bbbbbb; + display: -moz-inline-block; + display: inline-block; + zoom: 1; + *display: inline; + padding: 7px; +} + +/* CSS for backwards-compatibility with cached page renders and creative uses in wikitext */ +table#toc, +table.toc { + border-collapse: collapse; +} + +/* Remove additional paddings inside table-cells that are not present in
s */ +table#toc td, +table.toc td { + padding: 0; } #toc tr, #toc td { diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 17f9437e21..34ec4086d3 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -8631,7 +8631,7 @@ Section headings with TOC Some text ===Another headline=== !! result -

Contents

+

Contents

-
+

Headline 1[edit]

Subheadline 1[edit]

Skipping a level[edit]
@@ -8679,7 +8679,7 @@ Handling of sections up to level 6 and beyond ========= Level 9 Heading========= ========== Level 10 Heading========== !! result -

Contents

+

Contents

  • 1 Level 1 Heading
      @@ -8707,7 +8707,7 @@ Handling of sections up to level 6 and beyond
-
+

Level 1 Heading[edit]

Level 2 Heading[edit]

Level 3 Heading[edit]

@@ -8731,7 +8731,7 @@ TOC regression (bug 9764) == title 2 == === title 2.1 === !! result -

Contents

+

Contents

  • 1 title 1
      @@ -8749,7 +8749,7 @@ TOC regression (bug 9764)
-
+

title 1[edit]

title 1.1[edit]

title 1.1.1[edit]

@@ -8771,7 +8771,7 @@ wgMaxTocLevel=3 == title 2 == === title 2.1 === !! result -

Contents

+

Contents

  • 1 title 1
      @@ -8785,7 +8785,7 @@ wgMaxTocLevel=3
-
+

title 1[edit]

title 1.1[edit]

title 1.1.1[edit]

@@ -8806,7 +8806,7 @@ wgMaxTocLevel=3 ====Section 1.1.1.1==== ==Section 2== !! result -

Contents

+

Contents

+

Section 1[edit]

Section 1.1[edit]

Section 1.1.1[edit]

@@ -8898,7 +8898,7 @@ __TOC__ === title 1.1 === == title 2 == !! result -

Contents

+

Contents

+

title 1[edit]

title 1.1[edit]

title 2[edit]

@@ -8962,7 +8962,7 @@ section 5 !! result

The tooltips shall not show entities to the user (ie. be double escaped)

-

Contents

+

Contents

-
+

text > text[edit]

section 1

@@ -8997,14 +8997,14 @@ Headers with excess '=' characters =''italic'' heading== ==''italic'' heading= !! result -

Contents

+
+

foo=[edit]

=foo[edit]

italic heading=[edit]

@@ -9026,7 +9026,7 @@ HTML headers vs TOC (bug 23393) == Header 2.2 == __NOEDITSECTION__ !! result -

Contents

+

Contents

  • 1 Header 1
      @@ -9041,7 +9041,7 @@ __NOEDITSECTION__
-
+

Header 1

Header 1.1

Header 1.2

@@ -10335,11 +10335,11 @@ Fuzz testing: Parser14 http://__TOC__ !! result

onmouseover=[edit]

-http://

Contents

+http://

Contents

-
+ !! end @@ -12161,7 +12161,7 @@ Out-of-order TOC heading levels =====5===== ==2== !! result -

Contents

+

Contents

  • 1 2
      @@ -12176,7 +12176,7 @@ Out-of-order TOC heading levels
-
+

2[edit]

6[edit]

3[edit]

@@ -13754,11 +13754,11 @@ title=[[Main Page]] __TOC__ == ''Lost'' episodes == !! result -

Contents

+

Contents

-
+

Lost episodes[edit]

!! end @@ -13771,11 +13771,11 @@ title=[[Main Page]] __TOC__ == '''should be bold''' then normal text == !! result -

Contents

+
+

should be bold then normal text[edit]

!! end @@ -13788,11 +13788,11 @@ title=[[Main Page]] __TOC__ == Image [[Image:foobar.jpg]] == !! result -

Contents

+

Contents

-
+

Image Foobar.jpg[edit]

!! end @@ -13805,11 +13805,11 @@ title=[[Main Page]] __TOC__ ==
Quote
== !! result -

Contents

+

Contents

-
+

Quote
[edit]

!! end @@ -13824,11 +13824,11 @@ __TOC__ Hanc marginis exiguitas non caperet. QED !! result -

Contents

+

Contents

-
+

Proof: 2 < 3[edit]

Hanc marginis exiguitas non caperet. QED @@ -13843,12 +13843,12 @@ __TOC__ == Foo

Bar
== !! result -

Contents

+

Contents

-
+

Foo Bar[edit]

Foo
Bar
[edit]

@@ -13862,12 +13862,12 @@ __TOC__ == Evilbye == !! result -

Contents

+
+

Hello[edit]

b">Evilbye[edit]

@@ -13887,7 +13887,7 @@ __TOC__ == Attributes after dir on these span tags must be deleted from the TOC == !! result -

Contents

+
+

C++[edit]

זבנג![edit]

The attributes on these span tags must be deleted from the TOC[edit]

diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js index 713ec4be5b..b4b5d0bb08 100644 --- a/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js +++ b/tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js @@ -84,13 +84,13 @@ assert.strictEqual( mw.util.toggleToc(), null, 'Return null if there is no table of contents on the page.' ); - tocHtml = '
' + + tocHtml = '
' + '
' + '

Contents

' + ' [Hide ]' + '
' + '
' + - '
'; + ''; $( tocHtml ).appendTo( '#qunit-fixture' ), $toggleLink = $( '#togglelink' );