Template:A or b/Documentation

From GodWiki
< Template:A or b
Revision as of 14:57, 3 November 2018 by Djonni (talk | contribs) (Created page with "This function implements logic to decide ''randomly'' but ''consistently'' on a gender to use in text on the GodWiki. It is here for the use of any creator who wishes to allow...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This function implements logic to decide randomly but consistently on a gender to use in text on the GodWiki. It is here for the use of any creator who wishes to allow the Great Random to decide on whether the text should be about a him or a her.

It can be called directly, but is most likely to be called by one of the more user-friendly wrapper functions below.

Parameters

|male=male-gendered text
Required. This parameter contains the text to return if the template decides to male-focus the text. E.g. him
|female=female-gendered text
Required. This parameter contains the text to return if the template decides to female-focus the text. E.g. her
|or=anything
Optional. This parameter instructs the template to return both parts conjoined by or. As in, "she or he will get a surprise".
|lcase=anything
Optional. This parameter instructs the template to lowercase the first letter of the second term in an or conjunction. Use it only if giving the template uppercase He and She text, with |or=yes. As in, "She or he will get a surprise". Omit this if you explicitly want a capital letter in your second term, as in, "Gods or Goddesses are welcome in this guild!"
|daily=
Optional. This parameter instructs the template to switch the gender-focus of the text each day. Note that, depending on when the page was last cached, you may not always see the change without purging or editing the page.

Note that the text passed to |male= and |female= doesn't have to be male or female gendered text. If you switch them around, you'll get the inverted result to the usual. For example:

{{m-or-f|male=he|female=she}} passed {{m-or-f|male=her|female=him}} the salt

will give you he passed her the salt or she passed him the salt.

Furthermore, there's really no reason why the parameters need to be gendered text. The function will happily accept {{m-or-f|male=arm|female=leg|daily=yes}}, and your story can change each day whether the protagonist got his or her arm or leg chopped off.

User-friendly wrappers

These tables show the wrapper functions for various common uses.

Wrapper functions for pronouns
Pronoun Case Uppercase lowercase
Subject {{He-or-She}} {{he-or-she}}
Object {{Him-or-Her}} {{him-or-her}}
Possessive {{His-or-Hers}} {{his-or-hers}}
Wrapper functions for nouns
Uppercase lowercase
{{Hero-or-Heroine}} {{hero-or-heroine}}
{{Heroes-or-Heroines}} {{heroes-or-heroines}}

All of these wrappers take the |or= and |daily= parameters as required.