הפצה ממדיה־ויקי

This page is a translated version of the page Publishing from MediaWiki and the translation is 100% complete.

מדיה־ויקי הוא כלי נהדר לכתיבה שיתופית של מסמכים, עם זאת, הוא לא בהכרח מספק לך את המסמך המוגמר שלך בתסדיר מתאים לשימוש מחוץ להקשר ויקי. עמוד זה חוקר את הדרכים הטובות ביותר לחלץ תוך של מדיה־ויקי באופן שמתאים להפיץ אותו בסוגי מדיה אחרים.

נכון להיום, תצורות שאינן דיגיטליות נוצרות מחומרים ממקור דיגילי, לכאן השאלה הזאת מצטמצמת לכדי ‚לאילו תצורות אוכל לחלץ את הנתונים שלי’.

Types of content you may want to extract

There are generally four types of data that you may wish to publish from MediaWiki:

  • Individual pages
  • Collections of pages
  • Individual media files (e.g. images)
  • Collections of media files

In the case of the latter two, these will not normally be created collaboratively on the wiki, but the wiki may have been used to collate the files from various sources. However, manipulating that file outside of MediaWiki is likely to give you the best results, whatever other medium you plan to publish in. In cases where an individual image/file is required, simpy go to the file's description page and download the original from there. In cases where you want to download multiple files, follow the instructions on exporting all the files of a wiki, but filter the file list so it just contains the files you want.

The rest of this page therefore focuses on the first two items: individual pages and collections of pages.

Built-in methods of exporting data via the interface

  • You can export the HTML content of a page by appending ?action=render to the URL, like this. This outputs just the rendered HTML content of the page, without any of the MediaWiki skin elements. Note that it is not a valid HTML page, but a page fragment, and does not include any CSS styling.
  • You can export one or more pages using Special:Export. This will give you the raw wikitext wrapped up in an XML structure. You will need to do further processing in order for this output to be useful.
  • You should be able to extract pages using the API.

Built-in methods of exporting data via the command-line

  • /maintenance/getText.php allows you to get the wiki text for a specific page.
  • As a Hack, the following command will output page html (make sure to run it in your maintenance directory. Replace Main_Page with the page you want)
echo '$a = new ApiMain( new FauxRequest( array( "action" => "parse", "page" => "Main_Page", "prop" => "text" ))); $a->execute(); $d = $a->getResultData(); echo $d["parse"]["text"]["*"];'|php eval.php
  • The above could be replaced by a proper maintenance script if there is demand (similar to getText.php for page text).

Extensions to help with exporting data

This list is not by any means exhaustive, nor should it be considered a recommendation to use any of these extensions. It is more a pointer to some extensions that may be worth investigating further.