Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki Kostenlos Bücher Online Lesen
Autoren: Yaron Koren
Vom Netzwerk:
here:
https://www.mediawiki.org/wiki/Extension:ParserFunctions

Displaying code
    You may want to display source code in some programming or markup language on a wiki page, if it’s, say, part of a software-related wiki. The awkwardly-named SyntaxHighlight GeSHi is the recommended extension for doing that. It uses the third-party GeSHi library, whose name itself stands for “Generic Syntax Highlighter”. The extension defines the tag

, which takes in the parameter
lang=
, which can hold any of over 100 language names, and can then display any set of code. Here’s one example call:

System.out.println( "Bonjour, monde!" );

    And here is the resulting output:

     can take in some other parameters, which modify the display; these are only rarely used, but here are some of them:
line
— adds a line number at the beginning of each line.
start=
— if
line
is used, sets the line number for the first line (by default it’s 1).
highlight=
— specifies a line to highlight.
enclose=
— specifies the HTML tag used to enclose the entire text. By default it’s
"pre
", but it can also be
"div"
or
"none
". Using
"div"
allows for line wrapping, which is helpful when there are long lines of code.
    See the SyntaxHighlight GeSHi homepage for more information on how to download and use this extension, including the full set of languages allowed:
https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi

Cite
    The Cite extension should be well-known to anyone who has read Wikipedia — it’s the extension that lets users create footnotes. It’s not used often outside of Wikipedia and other Wikimedia sites, but it can, and probably should, be used more often, because providing citations for facts is always a good idea. To add a footnote after a statement on a page, you can add something like the following afterwards:

[http://usatoday.com/1234567.html Interview with a Screen Legend], Dana Douglas, ''USA Today'', January 1, 1980. Page retrieved February 2, 2014.

    The citation style is up to you, and you can use a template to set the formatting; that’s how it’s often done on Wikipedia, using templates like “cite news” and “cite web”. On Wikipedia, you could do, in place of the former,
{{cite news |url=http://usatoday.com/1234567.html |title=Interview with a Screen Legend |first=Dana |last=Douglas |work=USA Today |date=January 1, 1980 |accessed=February 2, 2014}}
    This will guarantee a consistent display of citations.
    The “name=” attribute within the tag is optional — it’s useful if you cite the same source more than once. If that happens, every additional citation can simply look like this:

    Finally, at the bottom of the page, you need the following tag to display the full set of footnotes:

    The English Wikipedia has a “{{Reflist}}” template that displays this tag, and applies some custom formatting around it.

Header Tabs
    Header Tabs is a cool extension that lets you place tabs within a wiki page (separate from, and below, the editing-based tabs provided by the skin), thus letting you break up the content of what might otherwise be overly-long pages. It’s fairly limited: it can only create one set of tabs on a page, with no sub-tabs. Still, that by itself is enough to make pages a lot more readable in a variety of circumstances.
    To create a tab with Header Tabs, just print the tab name as a top-level section header, i.e. with one ’=’, like this:
=Tab name=
    This takes advantage of the fact that top-level headers are usually unused; two equals signs (’==’) and higher are recommended for regular page headers in almost all cases.
    Here’s an example of the display of tabs, for a page about an athlete:

    This display would just require having lines like “
=Biography=
”, “
=Statistics=
”, etc. within the wikitext.
    Even if you have Header Tabs installed, such headers won’t automatically get turned into tabs unless you do one of two things. The first option is to place the tag

somewhere below the set of tabs for the page; wherever it goes marks the end of the contents of the last tab, and everything below the

will show up below the tabs structure.
    The other option is to designate one or more namespaces as automatically getting tabs, so that

Weitere Kostenlose Bücher