Mailinglist Archive: opensuse-wiki (14 mails)
| < Previous | Next > |
[opensuse-wiki] Inline CSS in templates
- From: Christian Boltz <opensuse@xxxxxxxxx>
- Date: Sun, 25 Sep 2011 15:32:52 +0200
- Message-id: <201109251532.53500@tux.boltz.de.vu>
Hello,
several templates (see the list near the end of this mail) are using
inline CSS (style=...).
It would be a good idea to move those styles into the CSS files to unify
the styling and to reduce the maintenance effort in case we want to
change some styles in the whole wiki one day. This is even more
important for templates that are used as page templates because those
are copied to the new page (which means we'd have to change all pages
based on this template).
Basically there are two ways how to handle this:
a) easy, but requires wiki admin rights
- create a CSS class at http://en.opensuse.org/MediaWiki:Common.css
- change the template to use that CSS class (class=... instead of
style=...)
- from time to time, move all styles from MediaWiki:Common.css to the
CSS files
b) with delay, but possible for everybody
- send a mail to this list with the code for the CSS class
- wait until someone (Robert?) has added it to the CSS files
- change the template to use that CSS class
As you can see, a) is easier. If you want to cleanup lots of the
templates, you should probably request admin permissions ;-)
I'll give an example what you need to do.
Template:Weekly_news_full contains several sections like
<div style="background-color:#E5E5E6;text-align:center;color:#000000">
==Editors Note==
</div>
This should be changed to
a) CSS code:
.weekly-news-header {
background-color:#E5E5E6;
text-align:center;
color:#000000
}
b) wiki code:
<div class="weekly-news-header">
==Editors Note==
</div>
If you find out that some templates use similar styles, try to merge
them into one CSS class. For example, Template:Warning and Template:Info
use nearly the same styling except of the color. This means you can
create a common class for both and an additional class for each of them
that only changes the color.
There might also be cases where useless or broken CSS is included (see
my change in Template:Event [1] for an example) - you should just remove
those things and wait if someone complains ;-)
Unfortunately I don't have the time to do all this myself, but I can
help if needed and/or if you have questions.
To get something grep-able, I wrote a small script that downloads all
templates from the english wiki. It's attached to this mail. (To avoid
that the wiki gets overloaded, I included a "sleep 1" after each
download.)
List of templates containing "style="
Template:Alphabet_index
Template:Article_with_side_navigation
Template:Box
Template:Box-footer
Template:Box-header
Template:Category_box
Template:Cellno
Template:Celltodo
Template:Cellyes
Template:Cleanup
Template:Delete
Template:DesktopTable
Template:Edu
Template:Event
Template:Expand
Template:Forbidden
Template:Foundation_navigation
Template:GNOME
Template:Hack_proj
Template:Hack_proj+1
Template:HL
Template:Icon_step
Template:Info
Template:Infobox
Template:Intro
Template:KDE
Template:Knowledge
Template:LaptopTable
Template:LaptopTable2
Template:LaptopTable2_Remark
Template:LegendMedical
Template:List_subpages
Template:LXDE
Template:Med
Template:Merge
Template:Move
Template:Moved_to_external
Template:Move_to_hcl
Template:Move_to_portal
Template:Move_to_sdb
Template:Multiple_image
Template:Navbar
Template:Navigation_Desktops
Template:Navigation_Hardware
Template:Navigation_Laptops
Template:No_article_template
Template:Obsolete
Template:Petite
Template:Point_here
Template:Portal
Template:Portal_50-50
Template:Quotation
Template:Random_portal_component
Template:Sandbox
Template:Screenshot_step
Template:Screenshot_step_2
Template:Screenshot_step_big
Template:Section
Template:Section_cleanup
Template:Special_info
Template:Speed_delete
Template:Stats
Template:Strikethrough
Template:Support_question_help
Template:Teams
Template:Tested_on
Template:Update
Template:Userpage
Template:Version
Template:Version_note
Template:VersionNote
Template:Warning
Template:Weekly_news_full
Template:Weekly_news_header
Template:Weekly_news_header_new
Template:Weekly_news_light
Template:Wiki_question_help
Template:Wireless_table
Template:Xfce
Regards,
Christian Boltz
[1]
http://en.opensuse.org/index.php?title=Template%3AEvent&action=historysubmit&diff=43487&oldid=38353
--
Look at Debian... its stable, works on a variety of platforms.... and
development is racing along at the speed of a turtle with 3 broken legs.
[Joseph M. Gaffney in opensuse]
several templates (see the list near the end of this mail) are using
inline CSS (style=...).
It would be a good idea to move those styles into the CSS files to unify
the styling and to reduce the maintenance effort in case we want to
change some styles in the whole wiki one day. This is even more
important for templates that are used as page templates because those
are copied to the new page (which means we'd have to change all pages
based on this template).
Basically there are two ways how to handle this:
a) easy, but requires wiki admin rights
- create a CSS class at http://en.opensuse.org/MediaWiki:Common.css
- change the template to use that CSS class (class=... instead of
style=...)
- from time to time, move all styles from MediaWiki:Common.css to the
CSS files
b) with delay, but possible for everybody
- send a mail to this list with the code for the CSS class
- wait until someone (Robert?) has added it to the CSS files
- change the template to use that CSS class
As you can see, a) is easier. If you want to cleanup lots of the
templates, you should probably request admin permissions ;-)
I'll give an example what you need to do.
Template:Weekly_news_full contains several sections like
<div style="background-color:#E5E5E6;text-align:center;color:#000000">
==Editors Note==
</div>
This should be changed to
a) CSS code:
.weekly-news-header {
background-color:#E5E5E6;
text-align:center;
color:#000000
}
b) wiki code:
<div class="weekly-news-header">
==Editors Note==
</div>
If you find out that some templates use similar styles, try to merge
them into one CSS class. For example, Template:Warning and Template:Info
use nearly the same styling except of the color. This means you can
create a common class for both and an additional class for each of them
that only changes the color.
There might also be cases where useless or broken CSS is included (see
my change in Template:Event [1] for an example) - you should just remove
those things and wait if someone complains ;-)
Unfortunately I don't have the time to do all this myself, but I can
help if needed and/or if you have questions.
To get something grep-able, I wrote a small script that downloads all
templates from the english wiki. It's attached to this mail. (To avoid
that the wiki gets overloaded, I included a "sleep 1" after each
download.)
List of templates containing "style="
Template:Alphabet_index
Template:Article_with_side_navigation
Template:Box
Template:Box-footer
Template:Box-header
Template:Category_box
Template:Cellno
Template:Celltodo
Template:Cellyes
Template:Cleanup
Template:Delete
Template:DesktopTable
Template:Edu
Template:Event
Template:Expand
Template:Forbidden
Template:Foundation_navigation
Template:GNOME
Template:Hack_proj
Template:Hack_proj+1
Template:HL
Template:Icon_step
Template:Info
Template:Infobox
Template:Intro
Template:KDE
Template:Knowledge
Template:LaptopTable
Template:LaptopTable2
Template:LaptopTable2_Remark
Template:LegendMedical
Template:List_subpages
Template:LXDE
Template:Med
Template:Merge
Template:Move
Template:Moved_to_external
Template:Move_to_hcl
Template:Move_to_portal
Template:Move_to_sdb
Template:Multiple_image
Template:Navbar
Template:Navigation_Desktops
Template:Navigation_Hardware
Template:Navigation_Laptops
Template:No_article_template
Template:Obsolete
Template:Petite
Template:Point_here
Template:Portal
Template:Portal_50-50
Template:Quotation
Template:Random_portal_component
Template:Sandbox
Template:Screenshot_step
Template:Screenshot_step_2
Template:Screenshot_step_big
Template:Section
Template:Section_cleanup
Template:Special_info
Template:Speed_delete
Template:Stats
Template:Strikethrough
Template:Support_question_help
Template:Teams
Template:Tested_on
Template:Update
Template:Userpage
Template:Version
Template:Version_note
Template:VersionNote
Template:Warning
Template:Weekly_news_full
Template:Weekly_news_header
Template:Weekly_news_header_new
Template:Weekly_news_light
Template:Wiki_question_help
Template:Wireless_table
Template:Xfce
Regards,
Christian Boltz
[1]
http://en.opensuse.org/index.php?title=Template%3AEvent&action=historysubmit&diff=43487&oldid=38353
--
Look at Debian... its stable, works on a variety of platforms.... and
development is racing along at the speed of a turtle with 3 broken legs.
[Joseph M. Gaffney in opensuse]
| < Previous | Next > |