Template:Answer

From Foss2Serve
(Difference between revisions)
Jump to: navigation, search
 
Line 5: Line 5:
 
<pre>{{Answer|42}}</pre>
 
<pre>{{Answer|42}}</pre>
  
This template can work in several ways:
+
This template can work in several ways, depending what is in the onlyinclude tags above:
  
1. Do not show the answer (only accessible from source). (Current approach.)
+
1. Never show the answer (only accessible from source). (Current approach.)
  
2. Show a link to toggle the answer.
+
2. Always show the answer.
 +
 
 +
3. Show a link to toggle the answer.
  
 
<pre><span class="mw-collapsible mw-collapsed" data-expandtext="Ans" data-collapsetext="Hide"><span style="background:gray">{{{1}}}</span></span></pre>
 
<pre><span class="mw-collapsible mw-collapsed" data-expandtext="Ans" data-collapsetext="Hide"><span style="background:gray">{{{1}}}</span></span></pre>
Line 15: Line 17:
 
Click on "Ans" to show the answer (42) and change the link to "Hide".
 
Click on "Ans" to show the answer (42) and change the link to "Hide".
 
Click again to change it back.
 
Click again to change it back.
 +
 +
4. Show the answer only when the user is logged in. (FUTURE WORK)
  
 
[[Category:Templates]]
 
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 14:47, 25 January 2019


Usage

This template provides a hidden answer. Invoke the template like this:

{{Answer|42}}

This template can work in several ways, depending what is in the onlyinclude tags above:

1. Never show the answer (only accessible from source). (Current approach.)

2. Always show the answer.

3. Show a link to toggle the answer.

<span class="mw-collapsible mw-collapsed" data-expandtext="Ans" data-collapsetext="Hide"><span style="background:gray">{{{1}}}</span></span>

The example above will result in a "Ans" link. Click on "Ans" to show the answer (42) and change the link to "Hide". Click again to change it back.

4. Show the answer only when the user is logged in. (FUTURE WORK)

Personal tools
Namespaces
Variants
Actions
Events
Learning Resources
HFOSS Projects
Evaluation
Navigation
Toolbox