User:Blainster/code examples

From Wikipedia, the free encyclopedia

Edit automation[edit]

Reduced text[edit]

Here is the code to generate reduced size text: <div style="font-size: 80%"> at head; and </div> at foot

Reference style[edit]

New Reference style: put the footnote text inside <ref> ... </ref> tags (always remembering the second one, otherwise it fails horribly), and then add a usual "References" section with a <references /> tag in it. Simple! And, yes, it works automagically. The FAC crowd swoon when they see it :) You can also add a "name" to the <ref> (<ref name="Fred_p21">) so you can use it more than once. I think Saffron is the epitome at the moment, although it puts the <references /> tag in a "Notes" section, and has a separate "References" section referred to by the Notes, which themselves use Harvard style using the {{Harv}} template (which I had not seen until just now). -- ALoan (Talk) 21:25, 15 February 2006 (UTC)

Let me try a simpler stab at it. First, put the magic tag <references/> wherever it is that you want the list of footnotes to show up. Then, wherever you want to put a footnote into your prose, add <ref>My footnote data goes here</ref>. The "My footnore data goes here" will show up not in the prose but down at the bottom in a linked footnote. It's almost simpler to do than explain. —Bunchofgrapes (talk) 21:46, 15 February 2006 (UTC)
  • The alternate Template:Reflist does the same thing as the "references" closing tag, except it automatically generates reduced size text, and has an option to generate two or three columns.

Columns[edit]

  • Two columns with "straw" background color are created by inserting the templates {{top}}, {{mid}} (at the end of the first column), and {{bottom}} (at the end of the second column). See Template:top
  • Two columns without background can also be created with Wiki pipe syntax (see Help:Table), but this reverses row and column order:

{|
|<li>item a<li>item b<li>item c
|<li>item d<li>item e<li>item f
|}

yielding this:

  • item a
  • item b
  • item c
  • item d
  • item e
  • item f
  • Templates[edit]

    Images[edit]

    [[File: | thumb | upright | right | alt= | caption ]]
    

    Cite web[edit]

    <ref>{{cite web
     |url= 
     |title= 
     |author= 
     |date= 
     |website= 
     |publisher= 
     |access-date= 
    }}</ref>
    

    Cite journal[edit]

    <ref>{{cite journal
     |last1= 
     |first1= 
     |last2= 
     |first2= 
     |date= 
     |title= 
     |journal= 
     |volume= 
     |issue= 
     |pages= 
     |publisher= 
     |doi= 
     |url= 
     |access-date= 
    }}</ref>
    

    Cite book (short)[edit]

    <ref>{{cite book
     |last= 
     |first= 
     |author-link= 
     |title= 
     |publisher= 
     |series= 
     |date=  
     |doi= 
     |isbn= 
    }}</ref>
    

    Cite book (extended)[edit]

    <ref>{{cite book
     |last1        = 
     |first1       = 
     |last2        = 
     |first2       = 
     |author-link1 = 
     |author-link2 = 
     |editor       = 
     |title        = 
     |trans-title  = 
     |url          = 
     |access-date  = 
     |edition      = 
     |series       = 
     |volume       = 
     |date         = 
     |publisher    = 
     |location     = 
     |isbn         = 
     |doi          = 
     |page         = 
     |pages        = 
     |chapter      = 
    }}</ref>
    

    Metric conversions[edit]

    Single input:
    {{convert|original_value|original_unit|conversion_unit|abbr=on}}
    
    Range of values:
    {{convert|orig_val1|range|orig_val2|original_unit|conversion_unit|abbr=on}}
    
    Examples:
    {{convert|60|and|170|kg|lb|abbr=on}}
    {{convert|18|°C|°F}}
    {{convert|3.21|kg|lb}}
    

    Variables[edit]

    Code Effect
    {{CURRENTWEEK}} 18
    {{CURRENTDOW}} 4
    {{CURRENTMONTH}} 05
    {{CURRENTMONTHNAME}} May
    {{CURRENTMONTHNAMEGEN}} May
    {{CURRENTDAY}} 2
    {{CURRENTDAYNAME}} Thursday
    {{CURRENTYEAR}} 2024
    {{CURRENTTIME}} 02:58
    {{NUMBEROFARTICLES}} 6,819,162
    {{NUMBEROFPAGES}} 60,575,126
    {{NUMBEROFUSERS}} 47,338,811
    {{PAGENAME}} Blainster/code examples
    {{NAMESPACE}} User
    {{REVISIONID}} -
    {{REVISIONUSER}} Blainster
    {{localurl:pagename}} /wiki/Pagename
    {{localurl:Wikipedia:Sandbox|action=edit}} /w/index.php?title=Wikipedia:Sandbox&action=edit
    {{fullurl:pagename}} //en.wikipedia.org/wiki/Pagename
    {{fullurl:pagename|query_string}} //en.wikipedia.org/w/index.php?title=Pagename&query_string
    {{SERVER}} //en.wikipedia.org
    {{ns:index}} e.g. '{{ns:1}}' fullname of namespace e.g 'Talk'
    {{SITENAME}} Wikipedia

    Recalling named reference[edit]

    <ref name="NAMEOFREF" />
    

    Quotes[edit]

    {{blockquote |text= |sign= }}
    

    Blockquotes[edit]

    <blockquote>
    <p>QUOTED PARAGRAPH</p>
    <p>NAME, SOURCE, REFERENCE</p>
    </blockquote>
    

    About[edit]

    (This page is about USE1. For other uses, see About (disambiguation).)
    {{About|USE1}}
    
    (This page is about USE1. For other uses, see PAGE2.)
    {{About|USE1||PAGE2}}
    
    (This page is about USE1. For USE2, see PAGE2.)
    {{About|USE1|USE2|PAGE2}}
    
    (This page is about USE1. For USE2, see PAGE2. For USE3, see PAGE3. For USE4, see PAGE4. For USE5, see PAGE5.)
    {{About|USE1|USE2|PAGE2|USE3|PAGE3|USE4|PAGE4|USE5|PAGE5}}
    

    Tables (borderless)[edit]

    {|
    |-
    ! scope="col" |COLUMN1
    ! scope="col" |COLUMN2
    |-
    |ROW1
    |ROW1/COL2
    |-
    |ROW2
    |ROW2/COL2
    |}
    

    Tables (wikitable)[edit]

    {| class="wikitable"
    |-
    ! scope="col" |COLUMN1
    ! scope="col" |COLUMN2
    |-
    |ROW1
    |ROW1/COL2
    |-
    |ROW2
    |ROW2/COL2
    |}
    

    Collapsible tables (Default: collapsed)[edit]

    {| class="wikitable mw-collapsible mw-collapsed" style="text-align: left;margin:0px;"
    |- 
    ! style="width:20em;" |COLUMN1
    ! style="width:20em;" |COLUMN2
    |- 
    |ROW1
    |ROW1/COL2
    |-
    |ROW2
    |ROW2/COL2
    |-
    |}
    

    Columns[edit]

    {{col-begin|width=100%}}
    {{col-break|width=}} 
    {{col-end}}
    

    Interwiki links[edit]

    Wiki Shortcut
    Wikimedia Commons [[commons:]]
    Wikipedia [[w:]]
    Wiktionary [[wikt:]]
    Wikibooks [[b:]]
    Wikisource [[s:]]
    Wikispecies [[species:]]
    Metawiki [[m:]]
    MediaWiki [[mw:]]

    Vandalism response templates[edit]

     * {{subst:uw-vandalism1|PageName}} ~~~~ (unintentional vandalism/test)
     * {{subst:uw-delete1|PageName}} ~~~~ (unintentional removal of content)
     * {{subst:uw-vandalism2|PageName}} ~~~~ (suitable for intentional nonsense or disruption)
     * {{subst:uw-delete2|PageName}} ~~~~ (variant for removal of content)
     * {{subst:uw-vandalism3|PageName}} ~~~~ ("please stop" for use after level 2 warning)
     * {{subst:uw-delete3|PageName}} ~~~~ (please stop removing content)
     * {{subst:uw-vandalism4|PageName}} ~~~~ (last warning for vandalism)
     * {{subst:uw-delete4|PageName}} ~~~~ (last warning for removing content)
     * {{subst:uw-vandalism4im|PageName}} ~~~~ (only warning; for severe or grotesque vandalism only)
     * {{subst:uw-delete4im|PageName}} ~~~~ (only warning; for many blankings in a short period of time)
    

    Page citations[edit]

    {{rp|page=}}
    

    Wikipedia:Service awards

    Articles created

    Categories created: Blues musicians from Mississippi, Greek New Testament, Mechanical calculator companies, Jewish skeptics

    Major additions: Arthur M. Young, Gifford Lectures

    RLDS book[edit]

    A Marvelous Work and a Wonder is also the title of a 1911 book by Daniel MacGregor published by Herald House, the publishing arm of the Reorganized Church of Jesus Christ of Latter Day Saints.[1]