Template:Hero-or-Heroine

From GodWiki
Jump to: navigation, search

Hero

[view] [edit] [history] [refresh]
Documentation  Documentation

The {{m-or-f}} 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. You are reading this documentation on {{Hero-or-Heroine}}; for just the parameters relevant to the wrapper functions, skip to the section on the 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=anything
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.
|invert=anything
Optional. This parameter reverses the usual order of the result. If the male-focussed language is being selected for the page, you will get the female-focussed language with this option, and vice versa.

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 just like using |invert=. 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}}
Adjective {{His-or-Her}} {{his-or-her}}
Wrapper functions for nouns
Uppercase lowercase
{{Hero-or-Heroine}} {{hero-or-heroine}}
{{Heroes-or-Heroines}} {{heroes-or-heroines}}

All of these wrappers take these parameters as required:

|or=anything
Optional. This parameter instructs the template to return both parts conjoined by or. As in, "she or he will get a surprise".
|daily=anything
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.
|invert=anything
Optional. This parameter reverses the usual order of the result. If the male-focussed language is being selected for the page, you will get the female-focussed language with this option, and vice versa. Use this to build sensible sentences. For example:
{{He-or-She}} held {{his-or-her|invert=yes}} hand in the moonlight.

will result in either:

He held her hand in the moonlight.

or

She held his hand in the moonlight.

Decision Logic

The template uses the page's {{PAGEID}} property to decide, so will always return the same result for the same page. If the {{PAGEID}} is odd, the male-focussed language is chosen; if it's even, the female-focused. (The page you are reading this on had a {{PAGEID}} value of 12341.) If the |daily= parameter is set, the current day of the month (16) is added to it before testing if it's odd or even, changing the result almost every day, except for the last day of months with an odd number of days.

When creating a new page, before the page is saved the {{PAGEID}} is not set. In these cases, the template will use the {{CURRENTTIMESTAMP}} of the preview, so that it will return consistent results within each preview, but may change each time. If you must know with certainly what the final results will be, save and create the page, and the {{PAGEID}} value will be generated.