jenkins-bot has submitted this change and it was merged.

Change subject: mediawiki.action.history.diff: Rework print styles
......................................................................


mediawiki.action.history.diff: Rework print styles

* Remove extremely old print styles for diffs from commonPrint.css,
  added back in r6970. These were created for the old yellow-green-red
  diff styles and look terrible now.
* Add new, minimal print styles, that replace background colors with
  text decoration (underline for inserted text, line-through for
  deleted). Motivation is the same as in r6970: light colored backgrounds
  work great on displays, but not very well in black-and-white print.
* Fixed diff styles demo (mediawiki.action.history.diff.html), updated
  with print styles and better example.

Bug: 73544
Change-Id: Ibf08fa11f84ac0cf8c7ed4da8af2b8804de6ab6f
---
M docs/uidesign/mediawiki.action.history.diff.html
M resources/Resources.php
M resources/src/mediawiki.action/mediawiki.action.history.diff.css
A resources/src/mediawiki.action/mediawiki.action.history.diff.print.css
M resources/src/mediawiki.legacy/commonPrint.css
5 files changed, 92 insertions(+), 77 deletions(-)

Approvals:
  TheDJ: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/docs/uidesign/mediawiki.action.history.diff.html 
b/docs/uidesign/mediawiki.action.history.diff.html
index 5edcfb8..615558f 100644
--- a/docs/uidesign/mediawiki.action.history.diff.html
+++ b/docs/uidesign/mediawiki.action.history.diff.html
@@ -1,57 +1,91 @@
 <!DOCTYPE html>
 <html lang="en" dir="ltr">
 <head>
-       <link rel="stylesheet" 
href="../../resources/mediawiki.action/mediawiki.action.history.diff.css">
+       <meta charset="utf-8">
+       <link rel="stylesheet" 
href="../../resources/src/mediawiki.action/mediawiki.action.history.diff.css">
+       <link rel="stylesheet" media="print" 
href="../../resources/src/mediawiki.action/mediawiki.action.history.diff.print.css">
 </head>
-<body style="background-color: #C0C0C0;">
-<p>
-This show various styles for our diff action, the background being hardcoded 
to gray (<code>#C0C0C0</code>) The reference style sheet is:</p>
-<p>
-<code><a 
href="../../resources/mediawiki.action/mediawiki.action.history.diff.css">resources/mediawiki.action/mediawiki.action.history.diff.css</a></code>.
-</p>
-<p>
-This file might help us fix our diff colors which have been a recurring issues 
among the community for a loooong time.</p>
+<body>
 
-<p>
-First, show the diff mostly like it would be chown on a wiki</p>
-<table class="diff">
+<p>This show various styles for our diff action. Style sheet: <code><a 
href="../../resources/src/mediawiki.action/mediawiki.action.history.diff.css">resources/src/mediawiki.action/mediawiki.action.history.diff.css</a></code>.</p>
+<p>This file might help us fix our diff colors which have been a recurring 
issues among the community for a loooong time.</p>
+<p>Try it out in print mode, too. Style sheet: <code><a 
href="../../resources/src/mediawiki.action/mediawiki.action.history.diff.print.css">resources/src/mediawiki.action/mediawiki.action.history.diff.print.css</a></code>.</p>
+
+<p>Practical example copied from MediaWiki's HTML output:</p>
+
+<table class="diff diff-contentalign-left">
+       <colgroup><col class="diff-marker">
+       <col class="diff-content">
+       <col class="diff-marker">
+       <col class="diff-content">
+       </colgroup>
+<tbody>
 <tr>
-       <td class="diff-marker">-</td>
-       <td class="diff-deletedline"><div>
-               Some content <span class="diffchange diffchange-inline">deleted 
/ replaced</span>
-       </div></td>
+       <td class="diff-marker">−</td>
+       <td class="diff-deletedline"><div>Lorem ipsum dolor sit amet<del 
class="diffchange diffchange-inline">, consectetur adipisicing elit</del>, sed 
do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div></td>
        <td class="diff-marker">+</td>
-       <td class="diff-addedline"><div>
-               Some content <span class="diffchange diffchange-inline">added / 
replacement</span>
-       </div></td>
+       <td class="diff-addedline"><div>Lorem ipsum dolor sit amet, sed do 
eiusmod tempor incididunt ut labore et dolore magna aliqua.</div></td>
 </tr>
-</table>
+<tr>
+       <td class="diff-marker">−</td>
+       <td class="diff-deletedline"></td>
+       <td colspan="2" class="diff-empty">&nbsp;</td>
+</tr>
+<tr>
+       <td class="diff-marker">−</td>
+       <td class="diff-deletedline"><div>Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div></td>
+       <td colspan="2" class="diff-empty">&nbsp;</td>
+</tr>
+<tr>
+       <td class="diff-marker">&nbsp;</td>
+       <td class="diff-context"></td>
+       <td class="diff-marker">&nbsp;</td>
+       <td class="diff-context"></td>
+</tr>
+<tr>
+       <td class="diff-marker">&nbsp;</td>
+       <td class="diff-context"><div>Duis aute irure dolor in reprehenderit in 
voluptate velit esse cillum dolore eu fugiat nulla pariatur.</div></td>
+       <td class="diff-marker">&nbsp;</td>
+       <td class="diff-context"><div>Duis aute irure dolor in reprehenderit in 
voluptate velit esse cillum dolore eu fugiat nulla pariatur.</div></td>
+</tr>
+<tr>
+       <td class="diff-marker">&nbsp;</td>
+       <td class="diff-context"></td>
+       <td class="diff-marker">&nbsp;</td>
+       <td class="diff-context"></td>
+</tr>
+<tr>
+       <td class="diff-marker">−</td>
+       <td class="diff-deletedline"><div>Excepteur sint occaecat cupidatat non 
proident, sunt in culpa qui officia deserunt mollit anim<del class="diffchange 
diffchange-inline"> id est laborum</del>.</div></td>
+       <td class="diff-marker">+</td>
+       <td class="diff-addedline"><div>Excepteur sint occaecat cupidatat non 
proident, sunt<ins class="diffchange diffchange-inline"> reprehenderit in 
voluptate</ins> in culpa qui officia deserunt mollit anim.</div></td>
+</tr>
+<tr>
+       <td colspan="2" class="diff-empty">&nbsp;</td>
+       <td class="diff-marker">+</td>
+       <td class="diff-addedline"></td>
+</tr>
+<tr>
+       <td colspan="2" class="diff-empty">&nbsp;</td>
+       <td class="diff-marker">+</td>
+       <td class="diff-addedline"><div>Ut enim ad minim veniam, quis nostrud 
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div></td>
+</tr>
+</tbody></table>
 
-
-<p>
-Below are some basic lines being applied one or two classes. Mainly for 
debugging purposes</p>
+<p>Below are some basic lines being applied one or two classes. Mainly for 
debugging purposes.</p>
 
 <table class="diff">
-
        <tr><th>Diff</th></tr>
 
        <tr><td class="diff-addedline"><code>diff-addedline</code>: added 
line</td></tr>
        <tr><td class="diff-deletedline"><code>diff-deletedline</code>: deleted 
line</td></tr>
        <tr><td class="diff-context"><code>diff-context</code>: 
context</td></tr>
 
-
-       <tr><th>Same as above with a <code>&lt;span&gt;</code> child element 
having the <code>diffchange</code> class</th></tr>
+       <tr><th>Same as above with a <code>&lt;ins&gt;</code> or 
<code>&lt;del&gt;</code> child element having the <code>diffchange</code> 
class:</th></tr>
 
        <tr><td class="diffchange">Diffchange</td></tr>
-       <tr><td class="diff-addedline">
-               <span class="diffchange">Added line + diffchange</span>
-       </td></tr>
-       <tr><td class="diff-deletedline">
-               <span class="diffchange">Deleted line + diffchange</span>
-       </td></tr>
-       <tr><td class="diff-context">
-               <span class="diffchange">Context + diffchange</span>
-       </td></tr>
+       <tr><td class="diff-addedline"><ins class="diffchange">Added line + 
diffchange</ins></td></tr>
+       <tr><td class="diff-deletedline"><del class="diffchange">Deleted line + 
diffchange</del></td></tr>
 </table>
 
 </body>
diff --git a/resources/Resources.php b/resources/Resources.php
index cfac8a9..c39ba3b 100644
--- a/resources/Resources.php
+++ b/resources/Resources.php
@@ -1053,7 +1053,10 @@
                'group' => 'mediawiki.action.history',
        ),
        'mediawiki.action.history.diff' => array(
-               'styles' => 
'resources/src/mediawiki.action/mediawiki.action.history.diff.css',
+               'styles' => array(
+                       
'resources/src/mediawiki.action/mediawiki.action.history.diff.css',
+                       
'resources/src/mediawiki.action/mediawiki.action.history.diff.print.css' => 
array( 'media' => 'print' ),
+               ),
                'group' => 'mediawiki.action.history',
                'targets' => array( 'desktop', 'mobile' ),
        ),
diff --git a/resources/src/mediawiki.action/mediawiki.action.history.diff.css 
b/resources/src/mediawiki.action/mediawiki.action.history.diff.css
index 092a597..0887476 100644
--- a/resources/src/mediawiki.action/mediawiki.action.history.diff.css
+++ b/resources/src/mediawiki.action/mediawiki.action.history.diff.css
@@ -1,6 +1,6 @@
-/*
-** Diff rendering
-*/
+/*!
+ * Diff rendering
+ */
 table.diff {
        border: none;
        border-spacing: 4px;
diff --git 
a/resources/src/mediawiki.action/mediawiki.action.history.diff.print.css 
b/resources/src/mediawiki.action/mediawiki.action.history.diff.print.css
new file mode 100644
index 0000000..76b5c9b
--- /dev/null
+++ b/resources/src/mediawiki.action/mediawiki.action.history.diff.print.css
@@ -0,0 +1,16 @@
+/*!
+ * Diff rendering
+ */
+td.diff-context,
+td.diff-addedline .diffchange,
+td.diff-deletedline .diffchange {
+       background-color: transparent;
+}
+
+td.diff-addedline .diffchange {
+       text-decoration: underline;
+}
+
+td.diff-deletedline .diffchange {
+       text-decoration: line-through;
+}
diff --git a/resources/src/mediawiki.legacy/commonPrint.css 
b/resources/src/mediawiki.legacy/commonPrint.css
index 9405719..a52ccb6 100644
--- a/resources/src/mediawiki.legacy/commonPrint.css
+++ b/resources/src/mediawiki.legacy/commonPrint.css
@@ -324,44 +324,6 @@
 }
 
 /**
- * Diff rendering
- */
-table.diff {
-       background: white;
-}
-
-td.diff-otitle {
-       background: #ffffff;
-}
-
-td.diff-ntitle {
-       background: #ffffff;
-}
-
-td.diff-addedline {
-       background: #ccffcc;
-       font-size: smaller;
-       border: solid 2px black;
-}
-
-td.diff-deletedline {
-       background: #ffffaa;
-       font-size: smaller;
-       border: dotted 2px black;
-}
-
-td.diff-context {
-       background: #eeeeee;
-       font-size: smaller;
-}
-
-.diffchange {
-       color: silver;
-       font-weight: bold;
-       text-decoration: underline;
-}
-
-/**
  * Table rendering
  * As on shared.css but with white background.
  */

-- 
To view, visit https://gerrit.wikimedia.org/r/174101
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf08fa11f84ac0cf8c7ed4da8af2b8804de6ab6f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Isarra <[email protected]>
Gerrit-Reviewer: Jack Phoenix <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to