In most cases it is generally more convenient to simply use the
\x
magic
argument through insane cross references instead of the c
and p
arguments as described on the rest of this section, see also: Section "Inflection vs magic".A common usage pattern is that we want to use header titles in non-full cross references as the definition of a concept without repeating the title, for example:
== Dog
Cute animal.
\x[cats][Cats] are its natural enemies.
== Cats
This is the natural enemy of a \x[dog][dog].
\x[dog][Dogs] are cute, but they are still the enemy.
One example of a cat is \x[felix-the-cat].
=== Felix the Cat
Felix is not really a \x[cats][cat], just a carton character.
However, word inflection makes it much harder to avoid retyping the definition again.
For example, in the previous example, without any further intelligent behaviour we would be forced to re-type
\x[dog][dog]
instead of the desired \x[dog]
.OurBigBook can take care of some inflection cases for you.
For capitalization, both headers and cross reference macros have the Capitalization is handled by a JavaScript case conversion.
c
boolean argument which stands for "capitalized":- for headers,
c
means that the header title has fixed capitalization as given in the title, i.e.- if the title has a capital first character, it will always show as a capital, as is the case for most proper noun
- if it is lower case, it will also always remain lower case, as is the case for some rare proper nouns, notably the name of certain companies
This means that for such headers,c
in thex
has no effect. Maybe we should give an error in that case. But lazy now, send PR. - for cross reference macros,
c
means that the first letter of the title should be capitalized.Using this option is required when you are starting a sentence with a non-proper noun.
For pluralization, cross reference macros have the If your desired pluralization is any more complex than modifying the last word of the title, you must do it manually however.
p
boolean argument which stands for "pluralize":- if given and true, this automatically pluralizes the last word of the target title by using the blakeembrey/pluralize library.
- if given and false, automatically singularize
- if not given, don't change the number of elements
With those rules in mind, the previous OurBigBook example can be written with less repetition as:
== Dog
Cute animal.
\x[cats]{c} are its natural enemies.
== Cats
This is the natural enemy of a \x[dog].
\x[dog]{p} are cute, but they are still the enemy.
One example of a cat is \x[Felix the Cat].
=== Felix the Cat
{c}
Felix is not really a \x[cats][cat], just a carton character.
If plural and capitalization don't handle your common desired inflections, you can also just create custom ones with the
\H
synonym
argument.Now for a live example for quick and dirty interactive testing.