Templates link
(28 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | Templates are a way to insert elements commonly used among your pages by reference, and they are usually invoked with one or more parameters which will be wrapped or transformed by the template in various ways. Besides all the [https://en.wikipedia.org/wiki/Wikipedia:Template_index Wikipedia's | + | Templates are a way to insert elements commonly used among your pages by reference, and they are usually invoked with one or more parameters which will be wrapped or transformed by the template in various ways. Besides all the [https://en.wikipedia.org/wiki/Wikipedia:Template_index Wikipedia's] or [https://www.mediawiki.org/wiki/Category:Templates Mediawiki's templates] which can be used or imported if missing, here are some additional templates specifically created for this platform. To use them, go to "Edit source" in the top menu, and insert the wiki text as shown below. |
Line 5: | Line 5: | ||
<pre> | <pre> | ||
− | {{CI text highlight| text to highlight}} | + | {{CI text highlight| text to highlight }} |
</pre> | </pre> | ||
Line 12: | Line 12: | ||
{{CI text highlight | text to highlight }} | {{CI text highlight | text to highlight }} | ||
+ | <noinclude> | ||
− | |||
'''inline logo''' | '''inline logo''' | ||
Line 37: | Line 37: | ||
− | '''pdf thumbnail | + | '''pdf thumbnail ''' |
<pre> | <pre> | ||
− | {{CI pdf thumbnail | + | {{CI pdf thumbnail | Knuth-plass-breaking.pdf | Breaking paragraphs into lines | clear after = true }} |
</pre> | </pre> | ||
produces: | produces: | ||
− | {{CI pdf thumbnail | + | |
− | + | {{CI pdf thumbnail | Knuth-plass-breaking.pdf | Breaking paragraphs into lines | clear after = true }} | |
− | + | ||
+ | it shows a thumbnail of the first page of the pdf, with a direct link to it: it expects filename and optionally caption as unnamed arguments, plus a "clear after" argument, specifying whether we want to prevent subsequent elements to float (default is false), or alternatively a "clear" argument, specifying the actual value for the [https://www.w3schools.com/cssref/pr_class_float.asp float css property]. | ||
+ | |||
+ | Basically, if you want to show a series of pdf thumbnails as a column, you can omit both "clear after" and "clear" arguments, if you want to display the pdf thumbnails aside each other, you can use "clear after = false" or "clear = none". If you want let the text around to float on the left you can use "clear = right" (or "clear = left" if you want the text around floating on the right). [[File:How it works/Templates/msupload_insertpdf_arrow.jpg|thumb]]When using "clear after = false" or "clear = none" just remind to disable it for the last thumbnail otherwise the following page's section will float on the right of the element, which is usually an unwanted behavior. | ||
+ | |||
+ | Finally, since April 2021 this template can be inserted using WikiEditor following the instructions [[How_it_works/Images_upload_%26_gallery|here]] (see picture on the right). | ||
+ | |||
+ | |||
+ | |||
+ | '''Accordion''' | ||
+ | |||
+ | <pre> | ||
+ | {{CI accordion | ||
+ | |Why should I use this website? | ||
+ | |Of course that's your choice ... | ||
+ | |||
+ | |Why canapes tend to fall on the wrong side? | ||
+ | |Because the specific weight of bread ... | ||
+ | |||
+ | |Why should I wake up my sons so early to bring them at school ? | ||
+ | |To prevent it grows some odd idea in their dreams... | ||
+ | |||
+ | }} | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | which produces the following | ||
+ | |||
+ | {{CI accordion | ||
+ | |Why should I use this website? | ||
+ | |Of course that's your choice ... | ||
+ | |||
+ | |Why canapes tend to fall on the wrong side? | ||
+ | |Because the specific weight of bread is less than ... | ||
+ | |||
+ | |Why should I wake up my sons so early to bring them at school ? | ||
+ | |To prevent it grows some odd idea in their dreams... | ||
+ | |||
+ | | Why the specific weight of bread is less than ... ? | ||
+ | | Because in a [https://en.wikipedia.org/wiki/Right_triangle right triangle] the area of the square whose side is the hypotenuse is equal to the sum of the areas of the squares on the other two sides | ||
+ | }} | ||
+ | |||
+ | (except that last question-answer which is "a plus") | ||
+ | |||
+ | The accordion template (technically a [https://en.wikiversity.org/wiki/Lua Lua module]) takes advantage of [[How_it_works/Front-end_features#Dynamic_components|Dynamic components]] on the front-end, so basically you can add to your pages the equivalent of a paying wordpress plugin with just few lines of wiki text. | ||
+ | |||
Line 57: | Line 102: | ||
− | the latter does not show anything, but | + | the latter does not show anything, but avoids text or elements to float if there are floating elements above, for instance using a floating image thumbnail (an image with floating text on left or right). |
+ | |||
+ | |||
+ | |||
</noinclude> | </noinclude> |
Latest revision as of 01:33, 11 April 2021
Templates are a way to insert elements commonly used among your pages by reference, and they are usually invoked with one or more parameters which will be wrapped or transformed by the template in various ways. Besides all the Wikipedia's or Mediawiki's templates which can be used or imported if missing, here are some additional templates specifically created for this platform. To use them, go to "Edit source" in the top menu, and insert the wiki text as shown below.
text highlight
{{CI text highlight| text to highlight }}
produces:
text to highlight
inline logo
{{CI inline logo}}
produces:
Cultura italiana
notice box
{{CI notice box | some notice }}
produces:
some notice |
pdf thumbnail
{{CI pdf thumbnail | Knuth-plass-breaking.pdf | Breaking paragraphs into lines | clear after = true }}
produces:
it shows a thumbnail of the first page of the pdf, with a direct link to it: it expects filename and optionally caption as unnamed arguments, plus a "clear after" argument, specifying whether we want to prevent subsequent elements to float (default is false), or alternatively a "clear" argument, specifying the actual value for the float css property.
Basically, if you want to show a series of pdf thumbnails as a column, you can omit both "clear after" and "clear" arguments, if you want to display the pdf thumbnails aside each other, you can use "clear after = false" or "clear = none". If you want let the text around to float on the left you can use "clear = right" (or "clear = left" if you want the text around floating on the right).
When using "clear after = false" or "clear = none" just remind to disable it for the last thumbnail otherwise the following page's section will float on the right of the element, which is usually an unwanted behavior.
Finally, since April 2021 this template can be inserted using WikiEditor following the instructions here (see picture on the right).
Accordion
{{CI accordion |Why should I use this website? |Of course that's your choice ... |Why canapes tend to fall on the wrong side? |Because the specific weight of bread ... |Why should I wake up my sons so early to bring them at school ? |To prevent it grows some odd idea in their dreams... }}
which produces the following
(except that last question-answer which is "a plus")
The accordion template (technically a Lua module) takes advantage of Dynamic components on the front-end, so basically you can add to your pages the equivalent of a paying wordpress plugin with just few lines of wiki text.
clear div
{{CI clear div }}
the latter does not show anything, but avoids text or elements to float if there are floating elements above, for instance using a floating image thumbnail (an image with floating text on left or right).