parent
0b2f9b5c12
commit
70a760489e
2 changed files with 7 additions and 3 deletions
|
@ -81,9 +81,9 @@ L.Util.toHTML = function (r) {
|
|||
r = r.replace(/\[\[([^|]*?)\|(.*?)\]\]/g, '<a href="$1">$2</a>');
|
||||
|
||||
// iframe
|
||||
r = r.replace(/{{{(h_t_t_ps?[^ |]*)}}}/g, '<iframe frameborder="0" src="$1" width="100%" height="300px"></iframe>');
|
||||
r = r.replace(/{{{(h_t_t_ps?[^ |]*)\|(\d*)(px)?}}}/g, '<iframe frameborder="0" src="$1" width="100%" height="$2px"></iframe>');
|
||||
r = r.replace(/{{{(h_t_t_ps?[^ |]*)\|(\d*)(px)?\*(\d*)(px)?}}}/g, '<iframe frameborder="0" src="$1" width="$4px" height="$2px"></iframe>');
|
||||
r = r.replace(/{{{(h_t_t_ps?[^ |{]*)}}}/g, '<iframe frameborder="0" src="$1" width="100%" height="300px"></iframe>');
|
||||
r = r.replace(/{{{(h_t_t_ps?[^ |{]*)\|(\d*)(px)?}}}/g, '<iframe frameborder="0" src="$1" width="100%" height="$2px"></iframe>');
|
||||
r = r.replace(/{{{(h_t_t_ps?[^ |{]*)\|(\d*)(px)?\*(\d*)(px)?}}}/g, '<iframe frameborder="0" src="$1" width="$4px" height="$2px"></iframe>');
|
||||
|
||||
// images
|
||||
r = r.replace(/{{([^\]|]*?)}}/g, '<img src="$1">');
|
||||
|
|
|
@ -94,6 +94,10 @@ describe('L.Util', function () {
|
|||
assert.equal(L.Util.toHTML('A simple iframe: {{{https://osm.org/?url=https%3A//anotherurl.com}}}'), 'A simple iframe: <iframe frameborder="0" src="https://osm.org/?url=https%3A//anotherurl.com" width="100%" height="300px"></iframe>');
|
||||
});
|
||||
|
||||
it('should handle iframe with height with px', function () {
|
||||
assert.equal(L.Util.toHTML('A double iframe: {{{https://osm.org/pouet}}}{{{https://osm.org/boudin}}}'), 'A double iframe: <iframe frameborder="0" src="https://osm.org/pouet" width="100%" height="300px"></iframe><iframe frameborder="0" src="https://osm.org/boudin" width="100%" height="300px"></iframe>');
|
||||
});
|
||||
|
||||
it('http link with http link as parameter as variable', function () {
|
||||
assert.equal(L.Util.toHTML('A phrase with a [[http://iframeurl.com?to=http://another.com]].'), 'A phrase with a <a target="_blank" href="http://iframeurl.com?to=http://another.com">http://iframeurl.com?to=http://another.com</a>.');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue