Style Plugin
This plugin lets you add CSS style attributes to your pages.
See
StylePluginDetails? for the detailed description.
StylePlugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write
%<plugin>_<setting>%, i.e.
%STYLEPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = A TWiki notation for adding css style class references with span and div tags
- Debug plugin: (See output in
data/debug.txt)
- Disable styles for non-rendering skins
- site styles
- Set SITESTYLES = .minilink { font-size:smaller; } .webref { font-size:larger; font-weight:bold; } .author, .BAuthor {font-weight:bold; font-style:normal;} .booktitle, .BTitle {font-style:italic; font-weight:normal; text-decoration:underline;} .publisher, .BPublisher { font-style:italic; } .note {color:green; font-style:italic; } .note:before {display:inline; content: "Note: "; } .new {font-weight:bold; color:red; } .deprecated {text-decoration:line-through; color:gray; } .comment {font-style:italic; background-color: #CCFFCC; } .ebook {width:6in; text-align:justify;} .super {vertical-align:super; font-size:smaller;} .sub {vertical-align:sub; font-size:smaller;} .article { padding-left:10px;padding-right:10px; width:6in; text-align:justify; } .pullquote { border-left:1px;border-right:1px;border-color:black;border-style:solid; border-top:0px;border-bottom:0px; padding-left:10px;padding-right:10px; margin-left:10px; font-style:italic; } .sidebar { background-color:#eee; border-width:2px; border-color:black;border-style:solid; padding:3px; padding-right:5px; position:relative;float:right; width:230px; font-size:smaller;} .question {font-weight:bold; } .answer {font-style:italic; } abbr, acronym, .help { border-bottom: 1px dotted #333; cursor: help; } DT {font-weight:bold;text-decoration:underline;margin-left:10px; } .intro {font-weight:bold;font-style:italic;margin-left:30px;} TH {text-align: center; font-weight: bold; background-color:#eeeeee; vertical-align: top; } TD {vertical-align: top; } TABLE { border-width: 1; } .hide {position:absolute; width:1px;visibility:hidden; height:1px;}
Overview
Why is this useful? Well, there are times when you want a consistent look and feel for certain types of items. For example, if you have a list or table, you might want certain fields to have a certain appearance. At
DaleBookList? I have a list of books and authors, with some publishers. Here's what a typical entry looks like :
- ((booktitle)(Programming Ruby)) by ((author)(Andrew Hunt and David Thomas)), ((publisher)(Addison-Wesley)), 2001
If the plugin is installed, and you have defined the style classes for 'booktitle', 'author', and 'publisher', the list item looks good. If you have the plugin installed, but don't have the style classes defined, then the list item looks, well, normal. If you don't have the plugin installed then you see all the parentheses and style names.
More generally, the style plugin lets you get away from the "let's make this bold and that italic" kind of formatting. Instead you can focus on semantic labelling of content and let the css stylesheet take care of the presentation.
Syntax Rules
A style class applied to a div tag
Use "\n---[.yourstylename ... \n---]"
This will produce
<div class=yourstylename> ... </div>
A style class applied to a span tag
Use "((yourstylename)(a chunk o' text))
This will produce
<span class=yourstylename> a chunk o' text</span>
A style class applied to a paragraph
Use ".yourstylename\nyour text"
This will produce
<p class=yourstylename> your text
A blockquote
Use '\n---"( your quoted material \n---")
This will produce
<blockquote>your quoted material</blockquote>
Acronyms
For example:
((acronym)(CSS)(Cascading Style Sheet))
This will produce
<acronym title="Cascading Style Sheet">CSS</acronym>
Plugin Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.
Like many other TWiki extensions, this module is shipped with a fully automatic installer script written using the BuildContrib.
- If you have TWiki 4.1 or later, and Perl 5.8, you can install from the
configure interface (Go to Plugins->Find More Extensions)
- If you have a permanent connection to the internet (and Perl 5.8), you are recommended to use the automatic installer script
- Just download the
StylePlugin_installer perl script and run it.
- If the $TWIKI_PACKAGES environment variable is set to point to a directory, the installer will try to get archives from there. Otherwise it will try to download from twiki.org or cpan.org, as appropriate.
- (Developers only: the script will look for twikiplugins/StylePlugin/StylePlugin.tgz before downloading from TWiki.org)
- If you don't have a permanent connection, you can still use the automatic installer, by downloading all required TWiki archives to a local directory.
- Point the environment variable
$TWIKI_PACKAGES to this directory, and the installer script will look there first for required TWiki packages.
-
$TWIKI_PACKAGES is actually a path; you can list several directories separated by :
- If you are behind a firewall that blocks access to CPAN, you can build a local CPAN mini-mirror, as described at http://twiki.org/cgi-bin/view/Codev/BuildingDakar#CPAN_local_minimirror
- The installer script will:
- Automatically resolve dependencies,
- Copy files into the right places in your local install even if you have renamed data directories,
- check in new versions of any installed files that have existing RCS histories files in your existing install.
- If you don't want to use the script, or have problems on your platform (e.g. you don't have Perl 5.8), then you can still install manually:
- Download and unpack one of the
.zip or .tgz archives to a temporary directory.
- Manually copy the contents across to the relevant places in your TWiki installation.
- Check in any installed files that have existing
,v files in your existing install (take care not to lock the files when you check in)
- Manually edit LocalSite.cfg to set any configuration variables.
- Run
configure and enable the module, if it is a plugin.
- Repeat from step 1 for any missing dependencies.
Plugin Info
Related Topics: TWikiPreferences,
TWikiPlugins
--
TWiki:Main.DaleBrayden - 26 Dec 2002