RemovingHTMLStyles

Summary: How to remove pmwiki styles from HTML head
Status: Stable
Version: 2006-10-28
Prerequisites: pmwiki 2
Maintainer:
Categories: Skins CSS

Question

How do I move pmwiki style definition from the header of the HTML source into a css file?

Answer

To move all style definitions from the header into a css file is not so easy, since different modules are adding them, and some of those additions cannot be turned off individually.

You can find these modules by searching all installed scripts for $HTMLStylesFmt, including pmwiki.php and all pmwiki scripts in the scripts directory, plus in addition cookbook scripts.

The following pmwiki script modules add styles via $HTMLStylesFmt:

pagerev.php:$HTMLStylesFmt['diff']
simuledit.php:$HTMLStylesFmt['simuledit']
stdmarkup.php:$HTMLStylesFmt['markup']
urlapprove.php:$HTMLStylesFmt['urlapprove']
vardoc.php:$HTMLStylesFmt['vardoc']
wikistyles.php:$HTMLStylesFmt['wikistyles']
pmwiki.php:$HTMLStylesFmt['pmwiki']
xlpage-utf-8.php:$HTMLStylesFmt['rtl-ltr']

Note that some can be turned off in config.php with

$HTMLStylesFmt['diff'] = "";
$HTMLStylesFmt['simuledit'] = "";
$HTMLStylesFmt['markup'] = "";
$HTMLStylesFmt['urlapprove'] = "";
$HTMLStylesFmt['vardoc'] = "";
$HTMLStylesFmt['wikistyles'] = "";
$HTMLStylesFmt['pmwiki'] = "";
$HTMLStylesFmt['rtl-ltr'] = "";

We could also turn off all $HTMLStylesFmt definitions from any module, including any cookbook recipe, with

$HTMLHeaderFmt['styles'] = '';

but then we have to make sure that we really don't need $HTMLStylesFmt[] at all.

After having turned off some $HTMLStylesFmt[] definitions we need to include these via a css file, usually this is pub/css/local.css, since it get loaded automatically. Or create a pmwiki-core.css file for these core styles in your Farm's or standard pub/css/ folder, and load it by adding to config.php:

$HTMLHeaderFmt['pmwiki-core'] = "
  <link rel='stylesheet' href='\$FarmPubDirUrl/css/pmwiki-core.css' type='text/css' />\n";

So create or add to pub/css/local.css the following (or put into a new pmwiki-core.css file, see above):

/* wikistyles */
.frame  { border:1px solid #cccccc; padding:4px; background-color:#f9f9f9; }
.lfloat { float:left; margin-right:0.5em; }
.rfloat { float:right; margin-left:0.5em; }

/* pmwiki */
ul, ol, pre, dl, p { margin-top:0px; margin-bottom:0px; }
code.escaped { white-space: nowrap; }
.vspace { margin-top:1.33em; }
.indent { margin-left:40px; }
.outdent { margin-left:40px; text-indent:&#8722;40px; }
a.createlinktext { text-decoration:none; border-bottom:1px dotted gray; }
a.createlink { text-decoration:none; position:relative; top:&#8722;0.5em;
  font-weight:bold; font-size:smaller; border-bottom:none; }
img { border:0px; }

/* markup */
table.markup { border:2px dotted #ccf; width:90%; }
td.markup1, td.markup2 { padding-left:10px; padding-right:10px; }
table.vert td.markup1 { border-bottom:1px solid #ccf; }
table.horiz td.markup1 { width:23em; border-right:1px solid #ccf; }
table.markup caption { text-align:left; }
div.faq p, div.faq pre { margin-left:2em; }
div.faq p.question { margin:1em 0 0.75em 0; font-weight:bold; }

/* pagerev */
.diffbox { border:1px #999999 solid; margin-top:1.33em; }
.diffauthor { font-weight:bold; }
.diffchangesum { font-weight:bold; }
.difftime { font-family:verdana,sans-serif; font-size:66%; 
  background-color:#dddddd; }
.difftype { clear:both; font-family:verdana,sans-serif; 
  font-size:66%; font-weight:bold; }
.diffadd { border-left:5px #99ff99 solid; padding-left:5px; }
.diffdel { border-left:5px #ffff99 solid; padding-left:5px; }
.diffrestore { clear:both; font-family:verdana,sans-serif; 
  font-size:66%; margin:1.5em 0px; }
.diffmarkup { font-family:monospace; }

/* urlapprove */
.apprlink { font-size:smaller; }

/* simuledit */
.editconflict { color:green; 
  font-style:italic; margin-top:1.33em; margin-bottom:1.33em; }

/* vardoc */
a.varlink { text-decoration:none; }

plus any css definitions from any other module or cookbook recipe.

Notes

  • This recipe was last tested on PmWiki version:
  • This recipe requires at least PmWiki version: and (any other recipes)
  • This recipe, version...... was installed here the...(date)

Releases

Comments

Try as one might, removing $HTMLStylesFmt['markup'] seems impossible at the moment; simply setting it to '' appears to have no effect. It's probably because some of these markups aren't set using SDV, so they just get reset later. Any possibility that this might change in the future? - JonHaupt

See Also

Contributors

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.