Extension:NewPageCSS

From Linux Web Expert

MediaWiki extensions manual
NewPageCSS
Release status: experimental
Implementation Tag , Skin
Description Allows the inclusion of CSS style sheets within wiki pages
Author(s)
Latest version 1.3.0 (2022-07-19)
MediaWiki 1.35+
PHP 7.4+
Database changes No
License GNU General Public License 2.0 or later
Download
‎<css>
Quarterly downloads Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Public wikis using Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin').
Translate the NewPageCSS extension if it is available at translatewiki.net

The NewPageCSS extension uses the tag <css> to include a CSS in the text of the wiki page; that CSS is then put into the header of the resulting HTML, and so formats your page. If you are creating a wiki page that ends up requiring a lot of style modifiers, it's probably simpler to put them into a CSS style sheet.

Installation

  • <translate> <tvar name=1>Download</tvar> and place the file(s) in a directory called <tvar name=name>NewPageCSS</tvar> in your <tvar name=ext>extensions/</tvar> folder.</translate>
  • <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
    wfLoadExtension( 'NewPageCSS' );
    
  • File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>

Usage

<css>
table.uc {
    border-collapse: collapse;
}

.uc th {
    background-color: #f2f2f2;
    border: 1px solid black;
}

.uc td {
    border: 1px solid black;
}

.uc td.pm {
    background-color: #ffa0a0;
}
</css>

<table class="uc">

...

</table>

See also

I would like to acknowledge the author of the original extension PageCSS (Ævar Arnfjörð Bjarmason), which I have updated so it will work with current versions of MediaWiki.