Template:Guide to Unix/Clink

From Wikibooks, open books for an open world
Jump to: navigation, search

How to use

The {{Guide to Unix/Clink}} template, used at Guide to Unix/Commands, generates tables of links to pages about Unix commands. The basic syntax is:

{{Guide to Unix/Clink|command|section| special parameters}}

All of the parameters are optional except command and the special parameter s for the synopsis. Specifying a section number is highly recommended even if special parameters are not set. The command and section parameters must not contain spaces.

You can easily generate links:

  • For *BSD manual pages, set bsds to yes and provide a section number.
  • For Linux questions wiki page, set lqwiki to yes.
  • For GNU coreutils info page, set coreutils to a certain integer from the URL.

What appears

What you type

chmod
changes file mode
{{Guide to Unix/Clink|chmod| s=changes file mode}}
chmod
changes file mode
{{Guide to Unix/Clink|chmod|1| bsds=yes | s=changes file mode}}
chmod
changes file mode
{{Guide to Unix/Clink|chmod| lq=yes | s=changes file mode}}
chmod
changes file mode
{{Guide to Unix/Clink|chmod| coreutils=81 | s=changes file mode}}
chmod
changes file mode
{{Guide to Unix/Clink|chmod| bsds=yes| lq=yes| coreutils=81 | s=changes file mode}}

How it works[edit]

The template contains a table made with HTML and CSS. The CSS includes the usual code for templates that float to the right ("float: right; clear: right;"). The border style must be repeated for each cell because I would need style tags or an external stylesheet to create a CSS class.

This template uses the "conditional" hack to hide any table rows that are not in use. Entire rows are hidden on the server side because CSS "empty-cells: hide;" fails to hide rows in Konqueror, though it works in Firefox.