Template:InfoBox/testcases

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
This is the template test case page for Template:InfoBox and its sandbox version. You may have to purge this page to update the examples.

Correct

Parameter info containing message to display (the minimum required to get something useful)
Wiki code
{{InfoBox stack
| {{InfoBox|info=Some text}}
}}
Main version
Some text
Sandbox version
Some text


Adding an icon and header
Wiki code
{{InfoBox stack
| {{InfoBox|info=Some text|icon=rocket|header=Some heading}}
}}
Main version

Some heading

Some text
Sandbox version

Some heading

Some text


Parameter anchor containing a hyperlink target (#click_me)
Wiki code
{{InfoBox stack
| {{InfoBox|anchor=click_me|info=Some text}}
}}
Main version
Some text
Sandbox version
Some text


↑ When specifying a header, it's preferable to use the {{InfoBox header}} template, as shown in the next case.


Using a custom id (instead of an icon) and header={{InfoBox header}}
Wiki code
{{InfoBox stack
| {{InfoBox|info=Some text|id=Some id| header={{InfoBox header|Some heading}} }}
}}
Main version
Some heading
Some idSome text
Sandbox version
Some heading
Some id Some text


↑ This gives you a preformatted heading that matches the color scheme of this wiki. The value of id can be either plain (or formatted) text or a small image. Note that either type of header (with or without {{InfoBox header}}) can be used with either icon or id.)

Incorrect

No parameter inside InfoBox stack (Exposes wikicode)
Wiki code
{{InfoBox stack
| {{InfoBox}}
}}
Main version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.
Sandbox version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.


Called in isolation with no parameter, not inside of {{InfoBox stack}} (Error message displayed)
Wiki code
{{InfoBox}}
Main version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.
Sandbox version
{{InfoBox template error}}
Parameter info not defined. For correct usage see InfoBox template's documentation on the info parameter.




Called in isolation with info parameter, not inside of {{InfoBox stack}} (Large box, not right-floated)
Wiki code
{{InfoBox|info=Foo}}
Main version
Foo
Sandbox version
Foo




↑ This would not be an error if this template call appeared on a page in the Template: namespace to define a special kind of infobox template — say, "Template:InfoBox foo". This is because {{InfoBox foo}} would need to be called inside an {{InfoBox stack}}.