Jdlrobson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366173 )

Change subject: Feature flagged print styles
......................................................................

Feature flagged print styles

These are feature flagged to allow editors to test before making
them the default. A class is added to the body tag to allow us
to switch between old and new styles at a later date.

To start with we introduce some typography improvements.
Further iterations will focus on other elements.

Bug: T169823
Change-Id: I453ae43099796a74c39d965b796f2fa13942106c
---
M SkinVector.php
A print.less
M skin.json
3 files changed, 116 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/Vector 
refs/changes/73/366173/1

diff --git a/SkinVector.php b/SkinVector.php
index 1733bb6..07dd060 100644
--- a/SkinVector.php
+++ b/SkinVector.php
@@ -40,6 +40,15 @@
                $this->vectorConfig = 
ConfigFactory::getDefaultInstance()->makeConfig( 'vector' );
        }
 
+       /** @inheritdoc */
+       public function getPageClasses( $title ) {
+               $className = parent::getPageClasses( $title );
+               if ( $this->vectorConfig->get( 'VectorExperimentalPrintStyles' 
) ) {
+                       $className .= ' vector-print-styles';
+               }
+               return $className;
+       }
+
        /**
         * Enables the responsive mode
         */
@@ -63,6 +72,12 @@
                        $this->enableResponsiveMode();
                }
 
+               // Print styles are feature flagged.
+               // This flag can be removed when T154965 is resolved.
+               if ( $this->vectorConfig->get( 'VectorExperimentalPrintStyles' 
) ) {
+                       $out->addModuleStyles( 'skins.vector.print.styles' );
+               }
+
                $out->addModules( 'skins.vector.js' );
        }
 
diff --git a/print.less b/print.less
new file mode 100644
index 0000000..b0160d4
--- /dev/null
+++ b/print.less
@@ -0,0 +1,92 @@
+@pureBlack: #000;
+
+@media print {
+       body.vector-print-styles {
+               padding: 10px;
+               font-family: serif;
+       }
+
+       .vector-print-styles {
+
+               // Normalize Blue links in the article
+               a {
+                       border-bottom:1px solid #aaa;
+               }
+
+
+               .firstHeading {
+                       font-size: 25pt;
+                       line-height: 28pt;
+                       margin-bottom: 20px;
+                       padding-bottom: 5px;
+               }
+
+               // Headings
+               .firstHeading,
+               > h2 {
+                       border-bottom: 2px solid @pureBlack;
+               }
+
+               h3,
+               h4,
+               h5,
+               h6 {
+                       margin: 30px 0 0;
+                       font-family: sans-serif;
+               }
+
+               h2,
+               h3,
+               h4,
+               h5,
+               h6 {
+                       page-break-before: avoid;
+                       display: block;
+                       padding: 0;
+                       position: relative;
+               }
+
+               h2 {
+                       font-size: 18pt;
+                       line-height: 24pt;
+                       margin-bottom: 0.25em;
+                       overflow: hidden;
+               }
+
+               h3 {
+                       font-size: 13pt;
+                       line-height: 20pt;
+               }
+
+               h4,
+               h5,
+               h6 {
+                       font-size: 10pt;
+                       line-height: 15pt;
+               }
+
+               p {
+                       font-size: 10pt;
+                       line-height: 16pt;
+                       margin-top: 5px;
+                       text-align: justify;
+               }
+
+               blockquote {
+                       border-left: 2px solid @pureBlack;
+                       padding-left: 20px;
+               }
+
+               ul {
+                       list-style-type: square;
+                       margin: .3em 0 0 1.6em;
+                       padding: 0;
+                       margin-top: 10px;
+
+                       li {
+                               padding: 5px 0;
+                               font-size: 10pt;
+                       }
+               }
+       }
+}
diff --git a/skin.json b/skin.json
index 3f016a7..b96f87c 100644
--- a/skin.json
+++ b/skin.json
@@ -48,6 +48,13 @@
                                }
                        }
                },
+               "skins.vector.print.styles": {
+                       "targets": [ "desktop", "mobile" ],
+                       "position": "top",
+                       "styles": [
+                               "print.less"
+                       ]
+               },
                "skins.vector.styles.responsive": {
                        "targets": [ "desktop", "mobile" ],
                        "position": "top",
@@ -101,6 +108,8 @@
        "config": {
                "VectorUseSimpleSearch": true,
                "VectorUseIconWatch": true,
+               "@VectorExperimentalPrintStyles": "Temporary config variable to 
feature flag new print styles (T154965)",
+               "VectorExperimentalPrintStyles": false,
                "VectorResponsive": false
        },
        "manifest_version": 1

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I453ae43099796a74c39d965b796f2fa13942106c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/Vector
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>

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

Reply via email to