Jump to content

User:CohuttaBlue/Useful Code

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by CohuttaBlue (talk | contribs) at 03:57, 19 February 2021 (Transclusion: Revised tips, instructions.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Cohutta Blue's quick cheatsheet for often-used code:

Citing References

Citing References

Minimalist table

A B
C D

Click "edit" to view the code for this table. I created this by copying code from Wikipedia's help section.

Transclusion

Transclude target page where "Pagename" is the target:

  x{x{Namespace:Pagename}x}x

(Remove each "x" to deploy template.)

Note: subsequent pageloads of the page bearing this template will cause a tranclusion of the target page each time the current page is loaded. Changes made to the template are then automatically reflected on all pages into which that page has been transcluded (though a purge may sometimes be necessary).

To prevent deploying the template with every page load, use substitution, as below; if the article to be transcluded is in the mainspace, add the extra colon, as shown:

Substitution (transclude once):

x{x{subst::fullpagename}x}x

(Remove each "x" to deploy template.)

Note: By using substitution, above, subsequent pageloads will not result in further transclusions of the target page.

MY ATTEMPT TO USE TRANSCLUSION FOR THE FOLLOWING PAGE DID NOT WORK!

I have successfully used transclusion before. Some attempts failed. (I did of course remove the exes while trying to deploy the template):

FAILED OR ONLY PARTLY SUCCESSFUL CODE:

{x{subst:User:CohuttaBlue/Sandboxes#Moon-eyed_revision_plan_February_2021}x}

The transclusion function was successful, but it caused a transclusion of the full page (Sandboxes), not just the targeted section (Moon-eyed revision plan February 2021). I'm not sure why the above markup caused the full page (Sandboxes) to be transcluded instead of just one section of the page.

For more on transclusion, see Wikipedia page:

Help:Transclusion

Userbox codes

Edit Userboxes Template
Displays "Pie or Pi" userbox. {{User:CohuttaBlue/Userboxes/Pie or Pi}}
Displays "Loveable Curmudgeon" userbox. {{User:CohuttaBlue/Userboxes/Loveable Curmudgeon}}
Displays "Typewriter" userbox. {{User:CohuttaBlue/Userboxes/Typewriter}}
Displays "Eccentric" userbox. {{User:CohuttaBlue/Userboxes/Eccentric}}
Displays "Lives on Earth" userbox. {{User on Earth}}
Displays "Xenocidic Escher" userbox. {{User:Xenocidic/Escher}}
Displays "Stone Age" userbox. {{User stone age}}
Displays "Smilodon" userbox. {{User:Diriector Doc/Ubx/Smilodon}}
Displays "Tabby Cats" userbox. {{User:CohuttaBlue/Userboxes/Tabby Cats}}
Displays "Fraidy Cat" userbox. {{User:CohuttaBlue/Userboxes/FraidyCat}}
Displays "Child at Heart" userbox. {{User:CohuttaBlue/Userboxes/Child at Heart}}Photo credit: xlibber, license cc by 2.0.

Example of table displaying userboxes

Example of a table

This one displays userboxes in two neat columns.

(Do not transclude the code on the ones that originated outside your own user space; it would call up the templates every time and might break if the designer changed the code).

Edit Userboxes Template
This user is quite perplexed; she ordered pie, not pi.
This user is a loveable curmudgeon.
This user learned touch-typing on a manual typewriter.
This user is a bit eccentric.
This user currently resides on
Planet Earth
.
This user enjoys optical illusions, especially the impossible constructions of M.C. Escher.
This user remembers the
Stone Age
SmilodonThis user wishes the Smilodon wasn't extinct.
This user likes cats, especially pretty little tabby cats.
This user is a Fraidy Cat. If startled, she leaps into the air and hisses, then runs and hides.
This user is a
child at heart.