|
PmWiki /
Wiki Stylesauthors (basic, advanced)
Contents Wiki Style? basicsWiki Styles allow authors to modify the color and other styling attributes of the contents of a page.
A Wiki Style? is written using percent-signs, as in Wiki Styles versus CSS stylesWiki Styles, as written in the wiki page, are not exactly CSS styles or CSS classes. Wiki Styles allow authors to use both pre-defined by the administrator CSS classes, and to define new combinations of styles, without any need to edit/update local CSS files on the server. Note that Pm Wiki allows advanced authors to use of Text color and fontThe most basic use of Wiki Styles is to change text attributes such as color, background color, and font. Pm Wiki defines several Wiki Styles for changing the text color to %black%, %white%, %red%, %yellow%, %blue%, %gray%, %silver%, %maroon%, %green%, %navy%, and %purple%.
For colors other than the predefined colors, use the
To change the background color, use
See WikiStyle Colors for more color help. Text justificationWiki Styles are used to control the text justification
and to create floating text:
ScopesWiki Styles can also specify a scope; with no scope, the style is applied to any text that follows up to the next Wiki Style? specification or the end of the paragraph, whichever comes first. The apply= attribute and its shortcuts allow to change the scope as follows:
Thus, Some predefined style shortcuts also make use of apply, thus Example: Apply a style to a paragraph:
Caveat: An applied Wiki Style? will only take effect if it's on the line that starts the thing it's supposed to modify. In other words, a Wiki Style? in the third markup line of a paragraph can't change the attributes of the paragraph:
Larger blocksThe
Note, the HTML "class" and "style" attributes for tables and divisionsWiki Styles are only the commands between Tables, table directives and (:div:) division blocks allow advanced authors to incorporate the HTML/CSS attributes
Note, the Custom style shortcutsThe
Tip: It's often a good idea to put common style definitions into Group Header pages so that they can be shared among multiple pages in a group. Or, the wiki administrator can predefine styles site-wide as a local customization (see Custom WikiStyles).
Tip: Use custom style definitions to associate meanings with text instead of just colors. For example, if warnings are to be displayed as green text, set %define=warn green% and then use %warn% instead of %green% in the document. Then, if you later decide that warnings should be styled differently, it's much easier to change the (one) definition than many occurrences of %green% in the text.
Tip: Any undefined Wiki Style? is automatically treated as a request for a class, thus %pre% is the same as saying %class=pre%.
Predefined style shortcutsPm Wiki defines a number of style shortcuts.
Wiki Style? attributesThe style attributes recognized within a Wiki Style? specification are: ------------ CSS ------------- --HTML--
color bgcolor class
background-color margin id
text-align padding hspace
text-decoration border vspace
font-size float target
font-family list-style rel
font-weight width* accesskey
font-style height* value
display
Special: define, apply
The attributes in the first two columns correspond to the cascading style sheet (CSS) properties of the same name. The attributes in the last column apply only to specific items:
* The width and height attributes have asterisks because they are handled specially for <img .../> tags. If used by themselves (i.e., without anything providing an "apply=" parameter to the Wiki Style?), then they set the 'width=' and 'height=' attributes of any <img ... /> tags that follow. Otherwise, they set the 'width:' and 'height:' properties of the element being styled.
Enabling StylesStyles not listed above can be enabled by a Pm Wiki Administrator by modifying the local/config.php file. For instance to enable the "line-height" style attribute add the line $WikiStyleCSS[] = 'line-height';
to the local/config.php file. Defining scope for other HTML elementsYou can add additional HTML elements to To apply styling to anchor tags, place in config.php: $WikiStyleApply['link'] = 'a'; Then, you can apply a class or style to an anchor link:
Or, to apply an ID attribute to a table row TR, place in config.php: $WikiStyleApply['row'] = 'tr'; Then, in an advanced table, you can have: (:cellnr:) %apply=row id=myid bgcolor=pink% cell content And also in a simple table: || border=1 || %apply=row id=myrowid% 1 || 2 || 3 || 4 || Note, the %apply=row...% Wiki Style? should be on the same line as ExamplesWikiStyle Examples contains a number of examples of ways to use Wiki Styles in pages. Known Issues
See Also
This page may have a more recent version on pmwiki.org: PmWiki:WikiStyles, and a talk page: PmWiki:WikiStyles-Talk. |