Help:Contents: Difference between revisions

From bradwiki
Jump to navigation Jump to search
Line 37: Line 37:


==HTML Extension==
==HTML Extension==
===Example===
<iframe src="http://www.w3schools.com"></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 <nowiki><a></nowiki> 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:
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 <nowiki><a></nowiki> 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:



Revision as of 21:02, 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

<iframe src="http://www.w3schools.com"></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.