Difference between revisions of "Help:Markup reference"

From Camera-wiki.org
Jump to: navigation, search
(Page ingredients)
(Lists)
Line 48: Line 48:
 
===Lists===
 
===Lists===
  
Lists are remarkably easy. There are two kinds, unordered (not numbered) and ordered (numbered).
+
There are two kinds of list, consisting of unordered (not numbered) and ordered (numbered) items. They are remarkably easy to produce: they don't require an explicit beginning or end, and instead are simply via a string of one or other kind of item. The list item starts on a new line with either of two characters, and should be typed on a single line (it should not include a line break).
  
{|class="toccolours" border="1" style="clear:both; margin:2em auto; border-collapse:collapse;"
+
An unordered list is typically displayed with bullet points. It’s made with an asterisk (“'''*'''”) at the start of each line.
|- valign="top"
+
 
! What it looks like
+
<div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf;">
! What you type
+
<nowiki>*</nowiki>This<br />
! Comments
+
<nowiki>*</nowiki>That<br />
|-  
+
<nowiki>*</nowiki>The other
| Unordered:
+
</div>
 +
 
 +
produces
 +
 
 +
<div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf;">
 
*This
 
*This
 
*That
 
*That
 
*The other
 
*The other
| <pre>*This
+
</div>
*That
+
 
*The other</pre>
+
An ordered list is typically displayed with Arabic numerals. It’s made with a hash mark (“'''#'''”) at the start of each line.
| asterisks
+
 
|-
+
<div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf;">
| Ordered:
+
<nowiki>#</nowiki>This<br />
 +
<nowiki>#</nowiki>That<br />
 +
<nowiki>#</nowiki>The other
 +
</div>
 +
 
 +
produces
 +
 
 +
<div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf;">
 
#This
 
#This
 
#That
 
#That
 
#The other
 
#The other
| <pre>#This
+
</div>
#That
+
 
#The other</pre>
+
Lists may be nested, and in any combination: either an ordered or an unordered list may be nested within either an ordered or an unordered list. An example:
| hash marks
 
|-
 
|}
 
  
A list item should be typed on one line (it should not include a line break).
+
<div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf">
 +
<nowiki>#</nowiki>Prewar<br />
 +
<nowiki>#</nowiki>Postwar film<br />
 +
<nowiki>#*</nowiki>35mm and smaller<br />
 +
<nowiki>#*</nowiki>Larger than 35mm<br />
 +
<nowiki>#</nowiki>Digital
 +
</div>
  
Lists may be nested, and in any combination: either an ordered or an unordered list may be nested within either an ordered or an unordered list. An example:
+
produces
  
{|class="toccolours" border="1" style="clear:both; margin:2em auto; border-collapse:collapse;"
+
<div style="width:20em; padding:5px; margin-left:30px; color:#000; background-color:#ddf;">
|- valign="top"
 
! What it looks like
 
! What you type
 
! Comments
 
|-
 
| Unordered within ordered:
 
 
#Prewar
 
#Prewar
 
#Postwar film
 
#Postwar film
Line 92: Line 100:
 
#*Larger than 35mm
 
#*Larger than 35mm
 
#Digital
 
#Digital
| <pre>#Prewar
+
</div>
#Postwar film
 
#*35mm and smaller
 
#*Larger than 35mm
 
#Digital</pre>
 
| A hash mark for every item, and not just for every top-level item
 
|-
 
|}
 
  
 
===Tables===
 
===Tables===

Revision as of 23:37, 17 April 2011

This may eventually grow into something worth moving into a new “Help:” ... but it has a hell of a long way to go first.

This page explains the technical aspects of writing articles. This primarily involves special markup for Mediawiki, the software behind not only Camera-wiki.org but also Wikipedia (for which it was created) and many other wikis. If you’re experienced with one of these other wikis, you should find that almost all of what follows tells you what you already know. And if you aren’t, then remember that although what’s below may tax your patience you’ll be able to apply the skills you pick up here elsewhere too.

Some of this markup is inspired by XHTML; and there’s also a limited amount of actual XHTML involved.

Page organization

Paragraphs (and line breaks)

Single line breaks have no effect within paragraphs. To separate a paragraph from the previous one, insert a blank line between them (hit the Enter key twice).

Don’t attempt to indent the first line of a paragraph.

To indent a block quotation, start the block with “<blockquote>” and end it with “</blockquote>”.

There’s a convention whereby a comment in a talk page is indented further from the left than is the comment that prompted it. For each level of indentation from the left, add one colon (“:”) at the very start of your comment.[1]

For a simple line break, use “<br />”.[2] (In normal body text this is unnecessary; however, it can help within captions and the like.)

Headers (section titles)

Think of an article as having a hierarchy of organization. Any longer article benefits from subdivision by headers. As an example of this in action, we’ll look at the article “Pearlette”.

There should be no header at the very start of an article. (Don’t add the header “Introduction”, “Preamble”, or similar.) Write a short paragraph (perhaps as short as a single sentence) and then insert the first header.

There follows a table of contents, which the software has generated automatically. Note within it:

3 Second generation: hinged back
3.1 1933 model

and take a quick look at these sections. The former is the topmost level of classification; it was added with a pair of double equals signs: “==Second generation: hinged back==”. The latter is one stage below this, and uses a pair of treble equals signs: “===1933 model===”. Note that they’re not numbered: the numbering too is generated automatically.

Put a header on a new line, and start anything that follows it on a new line.

For a further level of subdivision, ====a third level==== (four equals signs on each side) can be used. And if even this is not enough, a fourth and a fifth level (with five and six on each side respectively) can be used too.[3]

Page ingredients

Table of contents

When the number of headers within a page goes over three, this automatically triggers the generation of a table of contents. The table itself cannot be edited, and its generation should not normally be forced, moved or suppressed. However, these can be done, using one or other of two “magic words” (Mediawiki terminology), each enclosed in double underlines:

  • Adding “__TOC__” somewhere in a page forces generation of the table of contents at that point in the page.
  • Adding “__NOTOC__” anywhere in a page suppresses generation of the table of contents anywhere in the page.

Images

Clear images are the life-blood of Camera-wiki.org. But any images (typically a photograph, but perhaps a scan or diagram) must be added to a page in a very specific way, and with due consideration for its copyright status. All this is explained within Adding images.

Lists

There are two kinds of list, consisting of unordered (not numbered) and ordered (numbered) items. They are remarkably easy to produce: they don't require an explicit beginning or end, and instead are simply via a string of one or other kind of item. The list item starts on a new line with either of two characters, and should be typed on a single line (it should not include a line break).

An unordered list is typically displayed with bullet points. It’s made with an asterisk (“*”) at the start of each line.

*This
*That
*The other

produces

  • This
  • That
  • The other

An ordered list is typically displayed with Arabic numerals. It’s made with a hash mark (“#”) at the start of each line.

#This
#That
#The other

produces

  1. This
  2. That
  3. The other

Lists may be nested, and in any combination: either an ordered or an unordered list may be nested within either an ordered or an unordered list. An example:

#Prewar
#Postwar film
#*35mm and smaller
#*Larger than 35mm
#Digital

produces

  1. Prewar
  2. Postwar film
    • 35mm and smaller
    • Larger than 35mm
  3. Digital

Tables

Tables need to be explicitly opened and closed, and their contents must be written row by row. Here’s a 2×2 example:

{|
|-
! Header 1
! Header 2
|-
| row 1, cell 1
| row 1, cell 2
|-
| row 2, cell 1
| row 2, cell 2
|}

This produces:

Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

Of course this looks dreadful. Let’s replace the initial “{|” with

{|class="toccolours" border="1" style="clear:both; margin:2em auto; text-align:center; border-collapse:collapse;"

The result is now:

Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2

Let’s look at the options here.

[???]

For details, see Wikipedia’s “Help:Table”.

Definitions

Definitions — presented discretely, perhaps in a list — are only rarely of use within Camera-wiki.org, but here they are for the sake of completeness (and also because they are not obviously explained within/for Wikipedia).

As an example:

220 film
Similar to 120 film but effectively twice as long (and only usable with cameras designed specifically for it); allows 32 6×6 exposures; formally specified in ISO 732 (1991).

is achieved via

;220 film:Similar to 120 film but effectively twice as long (and only usable with cameras designed specifically for it); allows 32 6×6 exposures; formally specified in ISO 732 (1991).

Note (i) the semicolon (“;”) at the start (and necessarily at the very start of the line), and (ii) the colon (“:”) separating term and definition.[4]

Nothing special

You may be wondering how it is that this page is able to show all these commands. (For example, if it explains how to create a table, why doesn’t the explanatory code itself create a table?)

The answer is the heavy use in this page of the “<nowiki>” tag. And this tag isn’t only useful in such minor and peripheral areas of Camera-wiki.org as explanations of how markup works, it’s also useful in regular articles.

As an example, suppose we want to use the definitions markup (above) to create a definition for “3:2” (the aspect ratio). The pattern is (on a new line): semicolon, term to be defined, colon, definition. And so:

;3:2:''Aspect ratio'' (q.v.) in common use in photography [...]

However, this brings us:

3
2:Aspect ratio (q.v.) in common use in photography [...]

The problem is of course that the first colon is misinterpreted as having special significance. What we need to do is suppress this significance, using “<nowiki>...</nowiki>”:

;3<nowiki>:</nowiki>2:''Aspect ratio'' (q.v.) in common use in photography [...]

results in

3:2
Aspect ratio (q.v.) in common use in photography [...]

Character formatting

The way that text appears within a paragraph, list item, etc, can be altered via either Mediawiki-specific use of apostrophes[5] or certain XHTML tags. First, the apostrophes:

What it looks like What you type Comments
Italics: Asahi Camera is helpful
''Asahi Camera'' is helpful
Two (plain) apostrophes to start, two to finish.
Bold: It is marked SP
It is marked '''SP'''
Three (plain) apostrophes to start, three to finish.

And yes, you can combine italics and bold.

Secondly, the XHTML tags. You mark the start of an area needing some change with “<XXX>” and you mark its end with “</XXX>” — though not with “XXX” but instead with something else, as explained below:

What it looks like What you type Comments
Superscript: marketed as the “330D” in Europe
marketed as the “330<sup>D</sup>” in Europe
Subscript: marketed as the “A41” in Japan
marketed as the “<sub>A</sub>41” in Japan
Small: [not verified]
<small>[not verified]</small>
Rarely helpful in the text of an article.

(Editors familiar with CSS can also format within <span style="[CSS rules]"> and </span>.)

Characters

Characters on your keyboard

You should be able to type just about any character that’s on your keyboard, to have it rendered in the normal way. Exceptions are:

  • combinations of characters that most people would never want (such as pairs of single quotation marks)
  • the two inequality signs “<” and “>

The last pair will seldom be useful in the context of cameras; but if you do need them, type “&lt;” and “&gt;” respectively. (They’re mnemonic; “lt” and “gt” stand for “less than” and “greater than” respectively.)

Characters not on your keyboard

As for all the characters that aren’t on most people’s keyboards and that are occasionally useful — áàäâāăãåą and more — you can do either of the following:

  • copy them from elsewhere and paste them
  • insert them via the “numeric references” (eg “&#333;” for “ō”) or named “character entities” (eg “&uuml;” for “ü”) that are standard for HTML or XHTML in regular web pages

Many websites help with the latter; a good one is Alan Wood’s Unicode resources.

Page layout

It’s rarely a good idea to set out to design an article, but it may help to design small parts of a page.

For small agglomerations of images, the use of tables (described above) is acceptable. But tables are better avoided for anything large, as they tend to force a lot of scrolling in small browser windows.

If you know CSS, you can make judicious use of the div element with the style attribute for page layout. (An example follows.)

Use “<div class="center" style="width:auto; margin-left:auto; margin-right:auto;">” to start and “</div>” to end a block of text that you want centered.

Links

For links from graphics, see Adding images.

Internal links

Link to another page, or to a points within one or a point within the same page, where this seems useful.

For example, when writing about a camera made by Nikon, link "Nikon" to the page about it (i) the first time that "Nikon" is mentioned in the article, (ii) at any point where Nikon, the maker, is discussed (rather than merely mentioned), and optionally also (iii) when "Nikon" is first mentioned in a section coming some way below any previous link to that same page.

Case (the capital/lowercase distinction), spaces, the distinction between hyphen and en dash, and so forth, are all significant.

Linking to another page

Camera-wiki.org has a page titled “Pearlette”. The simple way to link to it is “[[Pearlette]]” (for “Pearlette”).

If it helps to link to the page by another name, this other name follows the title and the pipe character (“|”): “[[Pearlette|Konishiroku Pearlette]]” (for “Konishiroku Pearlette”).

The case (capital versus lowercase) of the first letter doesn’t matter. Camera-wiki.org has an article “Light meter”, but a link to “[[light meter]]” works for it: “light meter”. (Case is important elsewhere.)

What immediately follows such an internal link (and is not separated by a space, an apostrophe, etc.) is visually “blended” into the link. Thus “[[light meter]]sappears as a link to “light meters”, plural (“light meters”), but actually links to the title within the brackets.[6]

When followed by nothing at all, the pipe character (“|”) performs either or both of two tricks:

  • It hides title endings in parentheses: “[[Semi Wester (postwar)|]]” for “Semi Wester”.
  • It hides certain (although not all) namespace prefixes: “[[Help:Adding images|]]” for “Adding images”.
  • It does both of the above: “[[Template:Japanese 6×6 TLR (A–L)|]]” for “Japanese 6×6 TLR”.

Linking to a point within a page

Link to a given header within another page via “[[Article_title#Header|Text]]”. (Find the right form of the header by examining the URL as shown in your browser after you have clicked its title within the table of contents.)

For example, “[[Olympus#Pen_Digital_.28micro_four_thirds.29|µ4/3 Pen]]” for “µ4/3 Pen” — i.e. the section titled “Pen Digital (micro four thirds)” within “Olympus”.

Linking to a point within the same page

In order to link to a point within the same page, skip the article title and instead simply start with “#”; for example, “[[#Tables|Tables]]” for “Tables” within this page.

Rather than plain “(see above)” or “(see below)”, it’s helpful to write “(see [[#Tables|above]])” — for “(see above)” — or similar.

Anticipating link rot

If a page is later moved, an existing (or new) link to it under its former name should still work. So even after the article “Carl Flex” was moved to “Carlflex”, any link to the former (example) has been automatically redirected to the latter.

However, if a the title of a header within an article is changed, a link to it no longer works (and instead sends the browser to the top of the page). Therefore only link to a header within a page that already seems to have been edited to a stable state, and consider adding a hidden comment next to the target of the link, telling subsequent editors that they should only rename it if they do so with care.

External links

Simply, for a link to a page outside Camera-wiki.org, use within single (square) brackets, the URL followed by a space (no pipe character) and the page title: “[http://www.tlr-cameras.com/ TLR Cameras Website]” for TLR Cameras Website.

Interwiki links work for some other wikis. For example, “[[Wikipedia:Fujifilm]]” brings Wikipedia:Fujifilm. Combination with a pipe and an alternative title works: “[[Wikipedia:Fujifilm|Fujifilm (Wikipedia)]]” brings Fujifilm (Wikipedia). Likewise, “[[Commons:File:Perfekta_6x6_IMGP4292.jpg|Perfekta (Wikimedia Commons)]]” brings Perfekta (Wikimedia Commons). There’s also a handy shortcut employing the pipe character: “[[Wikipedia:Fujifilm|]]” brings Fujifilm.

Footnoting

After either a factual assertion that would benefit from being sourced to an authority, or an opinion or quotation, add a source footnote. The markup for any footnote is the same. ???

If the article is to have any footnotes, then there should be the single self-closing tag “<references />” somewhere below the point from which the last of the footnotes is to be linked. (It normally goes under — and indeed is the only text under — the header “==Notes==”.

Write each footnote at the point in the main text from which there should be an index number. Insert “<ref>XYZ</ref>”. This will lead to the automatic generation of an appropriate index number and a footnote that reads “XYZ”.

A given footnote may be pointed to from two or more places. In any one of these places — among which the first is strongly recommended, as this position aids subsequent editing — add the footnote in full, but with a name.[7] Example: “<ref name="perfekta66">XYZ</ref>”. Each of the other pointers to the same footnote is simply a self-closing tag with the same name: “<ref name="perfekta66" />”.

The actual content of the footnote is not moved by any automatic process; only its appearance within the page is moved. Therefore if you wish to edit a footnote that is already in place, you have to do so by editing the section of the page from which the footnote is linked. For example, a footnote from here,[8] can be edited by editing this section (“Footnoting”), not the section below titled “Notes”.

Categories

For more on categories, see Help:Categories.

In order to add a page to a category,[9] add a link to the category at the foot of the page. Thus in order to add Luxette to the category “German 4x4”, add “[[Category:German 4x4]]” to the foot of the former (but don’t touch the latter).

Within the category, the page that you categorize is normally listed according to its title (so Luxette will be under “L”). More often than not this is appropriate. But it’s sometimes better to force a different listing.

  1. Consider the Minolta SR-T 201. Within Category:Japanese 35mm SLR, it’s better listed among the Minoltas, under “M”. But if Category:Minolta SR mount has all the SR-mount Minolta models listed under under “M”, the result may be difficult to use and certainly will be ridiculous. The solution is the combination of “[[Category:Japanese 35mm SLR]]” and “[[Category:Minolta SR mount|SR-T 201]]”: in the latter, “|SR-T 201” results in listing as if titled “SR-T 201”.
  2. Consider the article “Minolta” itself. It should certainly be listed within Category:Minolta, but where? Not lost under “M”, but instead at the top. The kludge for this is an asterisk after the pipe: “[[Category:Minolta|*]]”.
  3. Consider the article “Ōki”. While it's obvious to us humans that the initial “Ō” is some kind of “O”, this is not so for the Wikimedia software, which will put the former somewhere after “Z”. Therefore its links to categories are exemplified by “[[Category:Japanese camera makers|Oki]]”, which lists it where it would be if the macron were not present.

Exceptionally, you may want to display a regular link to a category. If so, prefix a colon (“:”) to “Category”. Thus “[[:Category:German 4x4]]” renders “Category:German 4x4”.

Templates and transclusion

A template is a wiki page designed to be used as a module within other pages.

Templates are numerous and very varied; let’s start by introducing a simple one (one that's short and has no variables). Insertion of “{{Dechert Canon}}” inserts “Template:Dechert Canon”:

Dechert, Peter. Canon Rangefinder Cameras 1933–68. Hove, East Sussex: Hove Foto Books, 1985. ISBN 0-906447-30-5.

There are two ways to insert a template: “{{Subst:Dechert Canon}}” (substitution) and “{{Dechert Canon}}” (transclusion) — note that “Subst:” appears in the former.

With substitution, the content of the template is added to the article the first time the editor presses the “Save page” button. No subsequent change to the content of the template can have any effect.

With transclusion, the content of the template is added to the article only when the browser accesses the article. Thus what appears stays up to date with the template.

If the template is not expected to change, then substitution has the advantage of imposing a slightly smaller load on the webserver.

In order to link to a template (for example, in order to discuss its use), put the entire name in square brackets: “[[Template:Dechert Canon]]” renders “Template:Dechert Canon”.

Creation of a template is beyond the scope of this page. Wikipedia has a number of pages that explain it well, but while reading these you should be aware that the explanation recommends the use of certain templates (such as the very humdrum “Tl”) that do not exist in Camera-wiki.org.

Transclusion is not limited to templates: pages in other namespaces (other kinds of pages) can be transcluded too. However, in Camera-wiki.org (unlike Wikipedia) it is very rare for the transclusion of any page other than a template to be needed or even desirable.

Miscellaneous

Hidden comments

Material written between an opening “<--” and a closing “-->” is visible to anyone who edits the page but isn’t otherwise visible. (This is useful both for temporarily “commenting out” material that’s seriously flawed but that could later be fixed and for making certain kinds of comments for future editors — although most comments are better placed in the article’s talk page.)

Any material can be placed in a hidden comment, as long as it does not include a pair of hyphens. (An implication of this is that one comment cannot be nested in another comment.)

Horizontal rules

Make a horizontal rule (line) by placing an unbroken set of four hyphens (“----”), and only these hyphens, on a line.

Space starting a line

The line you are reading now is a sample of

— it’s a sample of something that’s almost never wanted within Camera-wiki.org: monospaced lettering. It’s achieved simply thanks to a space at the start of the line. Though here it’s of course deliberate, for demonstration purposes, more often than not it’s accidental. If your (normally-intended) text looks like this, check that you haven’t preceded it with a space.

Notes

  1. This is a very dubious convention, as what it does is to insert XHTML whose meaning is specific to definitions, which of course are irrelevant. But it’s well entrenched.
  2. This is XHTML. Usually, the Wikimedia software effortlessly converts HTML “<br>” to this, but in certain situations will fail to do so.
  3. As editors often discover by accident, a level higher than any of these can be achieved via a single equals sign on each side. Do not use this.
  4. In various wikis, a line-starting semicolon is often used to create a quasi-header that will not appear in the table of contents. This is poor practice, as the line-starting semicolon triggers generation by the Mediawiki software of the header-irrelevant XHTML definition markup “<dl><dd>...</dd></dl>”. If you want such a quasi-header, simply use regular, treble-apostrophe bolding for it.
  5. These must be standard, straight-from-the-keyboard apostrophes: ' . “Typographic quotes” — opening- and closing-specific quotation marks and — won’t work for this.
  6. On rare occasion this “blending” isn’t wanted. It can then be suppressed via the “<nowiki>” tag. Thus although “[[light meter]]ed” appears as “light metered” (perhaps giving the misleading impression of an article about the process of metering), “[[light meter]]<nowiki>ed</nowiki>” appears as “light metered”.
  7. The name should start with a simple letter (A–Z, a–z), and should only include letters, digits (0–9), underlines and/or hyphens.???
  8. A footnote crying out to be edited and turned into something worthwhile.
  9. Or to categorize it, or to add the category to the page — these are widely used ways of expressing the same one idea.

See also