Make relative urls work for jsfiddle
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
|
||||
<link rel="stylesheet" href="../css/ol.css" type="text/css">
|
||||
<link rel="stylesheet" href="./resources/layout.css" type="text/css">
|
||||
{{{ extraHead }}}
|
||||
{{{ extraHead.local }}}
|
||||
{{{ css.tag }}}
|
||||
<script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
|
||||
<title>{{ title }}</title>
|
||||
@@ -46,7 +46,7 @@
|
||||
<textarea class="hidden" name="css">{{ css.source }}</textarea>
|
||||
<textarea class="hidden" name="html">{{ contents }}</textarea>
|
||||
<input type="hidden" name="wrap" value="l">
|
||||
<input type="hidden" name="resources" value="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js,http://openlayers.org/en/v{{ olVersion }}/css/ol.css,http://openlayers.org/en/v{{ olVersion }}/build/ol.js">
|
||||
<input type="hidden" name="resources" value="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js,http://openlayers.org/en/v{{ olVersion }}/css/ol.css,http://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}">
|
||||
</form>
|
||||
<pre><code id="example-source" class="language-markup"><!DOCTYPE html>
|
||||
<html>
|
||||
@@ -57,7 +57,7 @@
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
<link rel="stylesheet" href="http://openlayers.org/en/v{{ olVersion }}/css/ol.css" type="text/css">
|
||||
<script src="http://openlayers.org/en/v{{ olVersion }}/build/ol.js"></script>
|
||||
{{ extraHead }}
|
||||
{{ extraHead.remote }}
|
||||
{{#if css.source}}
|
||||
<style>
|
||||
{{ css.source }}
|
||||
|
||||
@@ -108,18 +108,33 @@ function augmentExamples(files, metalsmith, done) {
|
||||
// add additional resources
|
||||
if (file.resources) {
|
||||
var resources = [];
|
||||
var remoteResources = [];
|
||||
var fiddleResources = [];
|
||||
for (var i = 0, ii = file.resources.length; i < ii; ++i) {
|
||||
var resource = file.resources[i];
|
||||
var remoteResource = resource.indexOf('//') === -1 ?
|
||||
'http://openlayers.org/en/v' + pkg.version + '/examples/' +
|
||||
resource : resource;
|
||||
fiddleResources[i] = remoteResource;
|
||||
if (isJsRegEx.test(resource)) {
|
||||
resources[i] = '<script src="' + resource + '"></script>';
|
||||
remoteResources[i] = '<script src="' + remoteResource +
|
||||
'"></script>';
|
||||
} else if (isCssRegEx.test(resource)) {
|
||||
resources[i] = '<link rel="stylesheet" href="' + resource + '">';
|
||||
remoteResources[i] = '<link rel="stylesheet" href="' +
|
||||
remoteResource + '">';
|
||||
} else {
|
||||
throw new Error('Invalid value for resource: ' +
|
||||
resource + ' is not .js or .css: ' + filename);
|
||||
}
|
||||
}
|
||||
file.extraHead = resources.join('\n');
|
||||
file.extraHead = {
|
||||
local: resources.join('\n'),
|
||||
remote: remoteResources.join('\n'),
|
||||
};
|
||||
file.extraResources = file.resources.length ?
|
||||
',' + fiddleResources.join(',') : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user