Manuale:Creare pagine con testo precaricato

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Manual:Creating pages with preloaded text and the translation is 57% complete.

Alla creazione di una nuova pagina, Wikitesto precaricato propone all'utente, invece di una pagina bianca, un testo parzialmente precompilato, potenzialmente con istruzioni in-linea per l'organizzazione del contenuto. Questa tecnica è particolarmente utile nel caso la wiki contenga una o più categorie di articoli con una grande quantità di testo proforma. Inoltre è utile nel caso le informazioni necessarie per scrivere l'articolo siano un misto di dati strutturati e testo libero.

Creare pagine con testo precaricato è un processo in tre passi:

  1. Progetta il file di pre-caricamento e i suoi template di supporto
  2. Crea pagine per i file di pre-caricamento e per i template di supporto
  3. Imposta l'evento che carica il file di pre-caricamento

Progettazione del file di pre-caricamento

Il file di pre-caricamento spesso è un articolo con un template incorporato. Per esempio, se vuoi un articolo che rappresenti un cliente o un contatto di marketing, il testo pre-caricato sarebbe qualcosa di simile all'esempio qui sotto.

   <!-- Please enter your customer's contact information after the equal sign.
        If you need help uploading the business card images, please see [[Help:Uploading business card images]]
   -->
   {{CustomerContact
   |Number=
   |BizcardImage=
   |Primary phone number=
   |Address=
   }}

Naming and documenting the preload file

Some extensions have specific expectations as to where the preloaded text should be stored. Others leave that decision entirely up to the system administrator.

Naming and documenting the preload file takes some care, because preload files don't always show up on "What links here" and so are at risk for accidental deletion (no info/no links—hard to tell from an article that got created and abandoned). For template based preload files, the following naming conventions may help avoid accidental deletion:

  • place template in Template:CategoryName
  • place preload file in Template:CategoryName/Preload

Loading the preload file

Preloading can be done with a preload parameter in a URL like http://en.wikipedia.org/wiki/Talk:Main_Page?action=edit&section=new&preload=Template:Foo which links to the edit box of a new page, preloaded with Template:Foo. There are also a number of extensions available to trigger your preload file, see below.

The wikitext of the source page is preloaded into the editbox if the page or section does not exist yet. If the page or section to be edited already exists then only its wikitext is loaded, the preload command is ignored.

  • ‎<noinclude> and ‎</noinclude> tags are removed; if you need the preloaded text to provide noinclude tags, you can use
    <no<includeonly></includeonly>include>
    
    in your source: since the two middle tags will be stripped (see next), the preloaded text will end up with just the desired ‎<noinclude>.
  • The ‎<includeonly> and ‎</includeonly> tags are stripped from the source page. If you need the preloaded text to provide includeonly tags, you can use
    <include<includeonly></includeonly>only>
    
    in your source: since the two middle tags will be stripped, the preloaded text will end up with just the desired ‎<includeonly>.

Thus there is neither a complete inclusion nor a regular transclusion. See also task T7210 (since 2006-03-09).

If it is creating a new section, the initial content of the "Subject/headline" box can be provided with the parameter "preloadtitle"

http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&section=new&preloadtitle=New_Header

If it is not creating a new section, the summary can be set with the summary parameter (task T19002).

http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&summary=Doing%20some%20changes

The minor edit checkbox can be set by adding minor parameter

http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&minor=1

Using parameters

Versione MediaWiki:
1.23

You can also specify parameters to the preload text with the preloadparams[] url parameter (When linking on wiki, you may want to escape the [] to be %5b%5d.) Each parameter specified replaces a $1, $2, ... variable.

Note: $1, $2, ... variables are distinct from {{{1}}}, {{{2}}}, ... variables. In order to use preloadparams[], it appears to be necessary for the template to use $1, $2, ... variables instead of {{{1}}}, {{{2}}}, ... variables. This documentation should be improved by explaining why these two distinct template parameter notations exist, and when it is possible or necessary to use each of the two notations.

For example:

http://mediawiki.org/wiki/Project:Sandbox?action=edit&section=new&nosummary=true&preload=Manual:Creating_pages_with_preloaded_text/param_demo
vs
http://mediawiki.org/wiki/Project:Sandbox?action=edit&section=new&nosummary=true&preload=Manual:Creating_pages_with_preloaded_text/param_demo&preloadparams%5b%5d=first%20value&preloadparams%5b%5d=second%20value

Extensions

Extensions that trigger a preload file include:

A few extensions also handle all three steps for you:

All extensions related to page creation are in the Page creation extensions category.

See also