web.Html(source : str, xpath : str, namespaces: map, ttl: num) : xml
Convert source to HTML by optionally fetching and parsing it.
1.9.1 or later
| Name | Type | Description |
| source | str | HTML source text or source uri |
| xpath | str | (optional, default: none) xpath to value |
| namespaces | map | (optional, default: none) XML namespace definitions |
| ttl | num | (optional, range: 60 - 86400, default: 300) Caching durations in seconds (8.08 or later) |
The result of web.html depends on the combination of arguments provided. If source is not a URI and xpath is omitted, web.html parses the source argument as a HTML fragment (see html fragment note below). If source is not a URI and xpath is provided, then web.html parses the source argument as a HTML fragment and then applies the xpath expression (see xpath note below). If source is a URI and xpath is omitted, then web.html fetches the data from the URI and parses it as a HTML document. If source is a URI and xpath is provided, then web.html fetches the data from the URI and applies the xpath expression.
The HTML fragment does not need to be a complete HTML document. When parsed, it is automatically placed inside <html><body>source</body></html> context. However, it MUST be structurally valid. That is, all opened tags must also be closed. For example, the following is NOT VALID: web.html("<ul>"). When the HTML is fetched from a URI, it is expected to be a complete HTML document.
Before the HTML result is returned, it is sanitized to remove any potential XSS vulnerabilities and HTML elements deemed unsafe.
When applying the xpath expression, web.html returns only the first HTML node matched by the xpath expression.
NOTE: all web.* functions are limited to reading at most 500KB of data from a URI.
| Output | ||
|
|
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by
http://mywiki/index.php?title=mypage&action=comment&commentnum=7
And web.html sanatizes it so the arguments are stripped. Uuuuuggghhhhhhh!
deki:
//bu is a value
var bu1 = bu;
//bu2 encloses it in quotes if bu1 is a string
var bu2="'"..bu1.."'";
var bu3='<a onclick="testfunction('..bu2..');return false;" href="#">testthis</a>';
jswrite(bu3);
-----------------------
template:jswrite:
<input type="hidden" value="{{($0)}}" id="temp0" /
<script>
document.write(DekiWiki.$("#temp0").val());
</script> edited 05:21, 28 Jul 2010