Help:Contents: Difference between revisions
Line 45: | Line 45: | ||
<nowiki> | <nowiki> | ||
<htmltag tagname="a" href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</htmltag> | <htmltag tagname="a" href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</htmltag> | ||
</nowiki> | |||
<nowiki> | |||
<htmltag tagname="iframe" src="http://google.com"></htmltag> | |||
</nowiki> | </nowiki> | ||
Revision as of 21:31, 11 May 2013
Image Annoation
<div class="wpImageAnnotatorEnable"> <span class="wpImageAnnotatorPageName" style="display:none;">Connectome</span> <span class="wpImageAnnotatorFullName" style="display:none;">Connectome</span> <div class="wpImageAnnotatorFile">[[File:Brainatlas1.jpg|640px]]</div> <div style="display:none;"><div><div><!--Dummy marker to have image notes inserted below this line-->{{ImageNoteEnd|id=-1}} </div> </div>
Livelets
To create livelets, wrap any areas of the page in the #live parser-function.
In the following example, a transclusion of the page called Template:MyVerySlowTable has been turned into a livelet:
{{#live: {{MyVerySlowTable}} }}
HTML Extension
Example
<htmltag tagname="a" href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</htmltag>
<htmltag tagname="iframe" src="http://google.com"></htmltag>
<htmltag tagname="iframe" src="http://google.com"></htmltag>
iFrame Attributes
<iframe src="http://www.w3schools.com" name="test2" frameborder="0" height="120" width="600">You need a Frames Capable browser to view this content.</iframe>
Attribute | Value | Description |
---|---|---|
align | left, right, top, middle, bottom | Specifies the alignment of an iframe according to surrounding elements |
frameborder | 1, 0 | Specifies whether or not to display a border around an iframe |
height | pixels | Specifies the height of an iframe |
longdesc | URL | Specifies a page that contains a long description of the content of an iframe |
marginheight | pixels | Specifies the top and bottom margins of the content of an iframe |
marginwidth | pixels | Specifies the left and right margins of the content of an iframe |
name | name | Specifies the name of an iframe |
sandbox | "", allow-forms, allow-same-origin, allow-scripts, allow-top-navigation | Enables a set of extra restrictions for the content in the iframe |
scrolling | yes, no, auto | Specifies whether or not to display scrollbars in an iframe |
seamless | seamless | Specifies that the iframe should look like it is a part of the containing document |
src | URL | Specifies the address of the document to embed in the iframe |
srcdoc | HTML_code | Specifies the HTML content of the page to show in the iframe |
width | pixels | Specifies the width of an iframe |
Local Settings
To add an HTML tag you need to specify the allowed set of HTML tags, and the allowed set of attributes for each one, using the global variable $wgHTMLTagsAttributes. For instance, to allow the <a> tag, and to allow only the attributes "href" and "class" for it, you would add the following to LocalSettings.php, after the inclusion of LocalSettings.php:
$wgHTMLTagsAttributes['a'] = array( 'href', 'class' );
If you wanted to allow the tag <fieldset>, but without any allowed attributes, you would add the following:
$wgHTMLTagsAttributes['fieldset'] = array();
Usage
Once a set of allowed tags and attributes are specified, you can use <htmltag> to place those tags on the page. You use the attribute "tagname" to specify the actual tag, and then add the other attributes exactly as you want them to appear. The "contents" of the tag become the contents of <htmltag>.
For instance, if the above lines are added, and you want to add a link on some page using the <a> tag, you could add something to the page like:
- <htmltag tagname="a" href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</htmltag>
This will add the following to the page's HTML source:
- <a href="http://en.wikipedia.org/wiki/Antarctica" class="my-links">Read about Antarctica</a>
Calling <htmltag> with a tag name that is not allowed will result in an error message; calling it with an attribute that is not allowed will simply lead to the attribute being ignored.
See Implementing LRMI for a full description of how this extension, along with some templates, can be used to allow for easy adding of LRMI metadata to pages.