Manual:Pywikibot/pagefromfile.py

Introduction
pagefromfile.py is a script used to upload pages to a wiki from a text file.

This bot takes its input from the UTF-8 text file that contains a number of pages to be put on the wiki. The pages should all have the same beginning and ending text (which may not overlap). The beginning and ending text is not uploaded with the page content by default.

As a page name is by default taken the first text block from the page content marked in bold (wrapped between    and   ). If you expect the page title not to be present in the text or marked by different markers, use  ,  , and   parameters.

Specific arguments
If the page to be uploaded already exists, it is skipped by default. But you can override this behavior if you want to:

It is possible to define a separator after the 'append' modes which is added between the existing and the new text. For example a parameter   would add 'foo' between them. A new line can be added between them by specifying '<tvar|newline>\n</>' as a value.

Basic example
In the most basic form, pagefromfile takes a single text file with several wiki pages in it as input. For example, the contents could be:

Store this as a UTF-8 encoded text file, for example as 'pages.txt'. You can then run. This will let the bot create Pywikibot and AutoWikiBrowser -- the first bolded elements in both pages. will give you the opportunity to review changes before they are being made.

Different page titles
Often, the first bolded element is not necessarily the correct page title. For example, we might want to place the article about AutoWikiBrowser on AWB instead. To do so, add a line in front of each article, with the correct page title between triple quotes (i.e., bolded):

and add the  parameter to the call, i.e.:.