Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki
Autoren: Yaron Koren
Vom Netzwerk:
around — this might happen if, for instance, your organization has two wikis with different levels of privacy, and you want some of the content generated in the more private wiki to also show up in the more public one. For that, you can use the “Push” extension,which lets you export content from one MediaWiki wiki to another, including regular pages, templates and images. You can read more about this extension here:
https://www.mediawiki.org/wiki/Extension:Push

Importing contents from another system into MediaWiki
    Importing content from outside MediaWiki into MediaWiki is probably the trickiest of the three types of content transfers, because the outside content can take any form whatsoever, and must be converted into MediaWiki’s specific structure of pages and wikitext. There are various utilities you can use, depending on the nature of the source content.
    If you have HTML content that needs to be converted to MediaWiki, there’s a convenient online tool, theHTML2Wiki Converter, where you can paste in HTML and retrieve corresponding wikitext:
https://toolserver.org/~magnus/html2wiki.php
    There’s also a MediaWiki extension to convertMicrosoft Word documents to wiki pages, called Word2MediaWikiPlus— though its usefulness seems to depend on what exact versions you have of Word and MediaWiki:
https://www.mediawiki.org/wiki/Extension:Word2MediaWikiPlus
    If the type of information you’re importing is structured, e.g. if it comes from a database; or if it consists of simple text that has already been assigned to page names, then theData Transfer extension may be the right tool. This is an extension that allows both the import and export of structured data; for now, we’ll just look at how you can import data with it.
    To import data, Data Transfer provides two special pages: Special:ImportXML and Special:ImportCSV. These pages take in a file in XML or CSV format, respectively, and create a series of wiki pages based on their contents. You may be wondering what the purpose of Special:ImportXML is, given that turning XML into wiki page is already what Special:Import does. The difference is that Special:ImportXML takes in an entirely different XML format than Special:Import does. The XML format of Special:Import is wiki-based, holding the entire structure of a wiki page, while, the XML format of Special:ImportXML is data-based, holding each field of structured data separately; and the same is true for Special:ImportCSV. To put it briefly: Data Transfer supports the import (and, as we’ll see later, the export) of structured data by translating that structured data into the individual parameters of template calls.
    First, let’s cover Special:ImportCSV, which is the simpler, and much more popular, of the two. CSV, which was already mentioned earlier in the book, is a standard format for storing a table of data; "CSV" stands for "comma-separated values". To use Special:ImportCSV, you must have a table of data that you want to import into the wiki, with one page per row. Special:ImportCSV requires a special format for the top, "header" row.
    Here is a sample CSV file that could be imported via Special:ImportCSV:
Title,Superhero[Alias],Superhero[Special powers],Free Text
Superman,Clark Kent,
"
Flying, Super strength
"
,He’s from Krypton.
Batman,Bruce Wayne,None,He just has a bunch of gadgets.
Wonder Woman,Diana Prince,
"
Flying (sometimes), Super strength
"
,She also has cool gadgets.
    This page requires a specific syntax for the CSV files it imports. That syntax is:
Title
— sets the title of each page (required)
Template name [ Field name ]
— defines the value for a single field, within a template call
Free Text
— sets the "free", non-template part of each page.
    And here is the resulting text for the page that would be created from the first row of data, i.e. the second row:
{{Superhero
|Alias=Clark Kent
|Special powers=Flying, Super strength
}}
He’s from Krypton
.
    The strings "Title" and "Free Text" are in place for English-language wikis, but they can also be used in any other language. In addition, many (over 50) languages have their own counterpart for "Title" and "Free Text" — if your wiki is in a language other than English, you can see these values (and, if you want, even modify them) at the pages MediaWiki:dt_xml_title and MediaWiki:dt_xml_freetext.
    "Title" is the only required column. If the data you want to import contains no structured fields, you can simply put all the text you
Vom Netzwerk:

Weitere Kostenlose Bücher