MediaWiki
Write the way wiki encyclopedias do, with '''bold''', [[links]] and an infobox, and get an article page.
What it shows
Rebuild an encyclopedia's wiki markup as rules.
What you learn
Headings between = signs, bold and italic from runs of quotes, nested lists, definition lists, table blocks whose lines split into cells, a longer rule for an infobox, references and words that print nothing.
Try this
- Add a row "| Height || 20–35 m" with a |- line above it to the infobox, and the box grows.
Ginkgo
| Kingdom | Plants |
| Division | Ginkgophyta |
| Order | Ginkgoales |
| Family | Ginkgoaceae |
| Genus | Ginkgo |
| Species | G. biloba |
| Native to | China |
| Status | Endangered in the wild |
Ginkgo (Ginkgo biloba), also called the maidenhair tree, is a tree native to China. It is the only living species of its division, the Ginkgophyta.1 Leaves almost the same as today's are found in rocks from the Jurassic, about 170 million years old.
Ginkgos are planted in streets and parks around the world, because they put up with poor soil, dry summers and city air.
Description
Ginkgos are large trees, usually 20 to 35 metres tall. The leaves are fan-shaped, often with a notch in the middle of the outer edge, which gives the species its name: biloba, "two-lobed". In autumn they turn bright yellow, and they can all fall within a few days.
| Season | What you see |
|---|---|
| Spring | New leaves, pale green, on short shoots |
| Summer | Leaves deep green |
| Autumn | Leaves bright yellow, then all down at once |
| Winter | Bare grey branches |
Male and female trees
- Male trees
- Bear small cones that shed pollen in spring.
- Female trees
- Bear seeds in a soft outer coat, which smells of rancid butter when it falls and rots.2
Most street trees are male, grown from cuttings, so the pavements stay clean.citation needed
In Hiroshima
Six ginkgos between one and two kilometres from the centre of the explosion in Hiroshima in 1945 survived it, and are still growing.3
Growing one
- Choose a male tree grown from a cutting, unless you want the seeds
- A nursery labels them by their variety's name
- Give it full sun and room for a large tree
- Water it well in its first two summers
- Then leave it alone: it has few pests and diseases
See also the old tree register for ginkgos near you.
How it's made
- Every mark on this page is a rule in the rules block. Equals signs around a line make a heading, and runs of quotes make italic and bold.
- A line's first character makes a list item, a definition or a table row. Cells on one line are split at two bars.
- The infobox is a table that starts with class="infobox". Its rule is longer than the one for every other table, so it wins, and its CSS floats it to the right.
- The brackets around a reference and around citation needed come from the CSS, and the word NOTOC with two underscores on each side prints nothing.
To show the marks themselves, put them between nowiki lines:
[[Ginkgo]], '''bold''' and <ref>1</ref> stay as typed here.Try it yourself
- Add a row with | Height || 20–35 m and a |- line above it to the infobox. The box grows.
- Change === In Hiroshima === to two = signs on each side. It becomes a section.
- Put three quotes on each side of fan-shaped. It turns bold.
- Indent Give it full sun by two spaces. It moves one level in, under the first point.
Next: the DokuWiki rulebook writes a wiki page with different marks for the same things.
~~~ selfscribe
# MediaWiki: the markup of wiki encyclopedias. Use it with: use mediawiki
# Lesson: Rebuild an encyclopedia's wiki markup as rules.
# You learn: headings between = signs, bold and italic from runs of quotes, nested lists, definition lists, table blocks whose lines split into cells, a longer rule for an infobox, references and words that print nothing.
# Try this: add a row "| Height || 20–35 m" with a |- line above it to the infobox, and the box grows.
# summary: Write the way wiki encyclopedias do, with '''bold''', [[links]] and an infobox, and get an article page.
# category: syntax
set title MediaWiki
# ---- Colours, each with its shade for dark pages -------------------------------------
palette
rule color-mix(in srgb, currentColor 18%, transparent)
plant #c8f0c0 dark #24452a
# ---- = Title =, == Section == and so on: more = signs, a smaller heading -----------------
# Headings take the page's text font, and the title and sections a line under them, as
# encyclopedias do.
class wk-head { --doc-font-heading: var(--doc-font, var(--font-prose, Georgia, serif)) }
class wk-ruled { padding-bottom: 0.15em; border-bottom: 1px solid var(--rule) }
line = _ = -> h1.wk-head.wk-ruled fold 1
line == _ == -> h2.wk-head.wk-ruled fold 2
line === _ === -> h3.wk-head fold 3
line ==== _ ==== -> h4.wk-head fold 4
# ---- Three quotes on each side for bold, two for italic --------------------------------
# The longer pattern wins, so '''bold''' is never read as italic.
inline '''_''' -> b
inline ''_'' -> i
# ---- ---- on its own line: a rule across the page ---------------------------------------
line ---- -> hr
# ---- Lists: "* " a point, "# " a numbered step; indent a line to put it one level in -----
line * _ -> li group ul nest
line # _ -> li group ol nest
# ---- "; term" then ": meaning": a definition list -------------------------------------
line ; _ -> dt group dl { font-weight: 700; margin-top: 0.4em } as wk-dt
line : _ -> dd group dl { margin-left: 1.6em } as wk-dd
# ---- Links: [[Page]], [[Page|words to show]] and [https://address words] ----------------
# Inline rules match the leftmost start first: a [[plain]] link and a [[piped|link]] later on
# the same line would read as one link, so start a new line between them.
inline [[_|_]] -> a.wikilink href=_1 _2
inline [[_]] -> a.wikilink href=_1 _1
inline [https://_ _] -> a.external href="https://_1" _2
# ---- <ref>…</ref> a reference mark, {{…}} a template note, both in square brackets ------
class wk-note { font-size: 0.7em; line-height: 1 }
class wk-note::before { content: "[" }
class wk-note::after { content: "]" }
inline <ref>_</ref> -> sup.wk-note as wk-ref
inline {{_}} -> sup.wk-note { font-style: italic } as wk-template
# ---- Words that print nothing: __TOC__ and __NOTOC__ only tell a wiki what to do ---------
word \_\_TOC\_\_ -> hidden
word \_\_NOTOC\_\_ -> hidden
# ---- Between <nowiki> and </nowiki>: text shown exactly as typed ------------------------
block <nowiki> ... </nowiki> -> span verbatim
# ---- A table: {| opens it, |} closes it, |- starts a row, ! header cells, | cells --------
# Cells on one line are split at !! or ||. A table that opens with class="infobox" has a
# longer pattern, so it wins and floats to the right with its caption on a coloured band.
block {| _ ... |} -> table.wikitable { border-collapse: collapse; margin: 1em 0 } as wk-table
block {| class="infobox" ... |} -> table.infobox { float: right; width: 17em; margin: 0.3em 0 1em 1.5em; border: 1px solid var(--rule); border-collapse: collapse; font-size: 0.85em; line-height: 1.45; background: color-mix(in srgb, currentColor 3%, transparent) } as wk-infobox
class infobox td { border: 0; padding: 0.3em 0.7em; vertical-align: top; background: none }
class infobox td:first-child { font-weight: 600; white-space: nowrap }
class infobox caption { caption-side: top; padding: 0.45em 0.7em; border: 1px solid var(--rule); border-bottom: 0; background: var(--plant); font-size: 1.15em; font-weight: 700; text-align: center }
line |+ _ -> caption { font-weight: 700 } as wk-caption
line |- -> hidden
line ! _ -> tr split "!!" th
line | _ -> tr split "||" td
~~~
= Ginkgo =
{| class="infobox"
|+ Ginkgo
| Kingdom || Plants
|-
| Division || Ginkgophyta
|-
| Order || Ginkgoales
|-
| Family || Ginkgoaceae
|-
| Genus || ''Ginkgo''
|-
| Species || ''G. biloba''
|-
| Native to || China
|-
| Status || Endangered in the wild
|}
__NOTOC__
'''Ginkgo''' (''Ginkgo biloba''), also called the '''maidenhair tree''', is a tree native to [[China]]. It is the only living species of its division, the [[Ginkgophyta]].<ref>1</ref> Leaves almost the same as today's are found in rocks from the [[Jurassic]], about 170 million years old.
Ginkgos are planted in streets and parks around the world, because they put up with poor soil, dry summers and city air.
== Description ==
Ginkgos are large trees, usually 20 to 35 metres tall. The leaves are fan-shaped, often with a notch in the middle of the outer edge, which gives the species its name: ''biloba'', "two-lobed". In autumn they turn bright yellow, and they can all fall within a few days.
{| class="wikitable"
|+ The tree through the year
! Season !! What you see
|-
| Spring || New leaves, pale green, on short shoots
|-
| Summer || Leaves deep green
|-
| Autumn || Leaves bright yellow, then all down at once
|-
| Winter || Bare grey branches
|}
== Male and female trees ==
; Male trees
: Bear small cones that shed pollen in spring.
; Female trees
: Bear seeds in a soft outer coat, which smells of rancid butter when it falls and rots.<ref>2</ref>
Most street trees are male, grown from cuttings, so the pavements stay clean.{{citation needed}}
=== In Hiroshima ===
Six ginkgos between one and two kilometres from the centre of the explosion in [[Hiroshima]] in 1945 survived it, and are still growing.<ref>3</ref>
==== Growing one ====
* Choose a male tree grown from a cutting, unless you want the seeds
* A nursery labels them by their variety's name
* Give it full sun and room for a large tree
# Water it well in its first two summers
# Then leave it alone: it has few pests and diseases
See also [https://example.com/ginkgo the old tree register] for ginkgos near you.
----
== How it's made ==
* Every mark on this page is a rule in the rules block. Equals signs around a line make a heading, and runs of quotes make ''italic'' and '''bold'''.
* A line's first character makes a list item, a definition or a table row. Cells on one line are split at two bars.
* The infobox is a table that starts with ''class="infobox"''. Its rule is longer than the one for every other table, so it wins, and its CSS floats it to the right.
* The brackets around a reference and around ''citation needed'' come from the CSS, and the word ''NOTOC'' with two underscores on each side prints nothing.
To show the marks themselves, put them between nowiki lines:
<nowiki>
[[Ginkgo]], '''bold''' and <ref>1</ref> stay as typed here.
</nowiki>
== Try it yourself ==
# Add a row with ''| Height || 20–35 m'' and a ''|-'' line above it to the infobox. The box grows.
# Change ''=== In Hiroshima ==='' to two = signs on each side. It becomes a section.
# Put three quotes on each side of ''fan-shaped''. It turns bold.
# Indent ''Give it full sun'' by two spaces. It moves one level in, under the first point.
'''Next:''' the ''DokuWiki'' rulebook writes a wiki page with different marks for the same things.