diff --git a/Makefile b/Makefile index f56d48150c..bcccf0b198 100644 --- a/Makefile +++ b/Makefile @@ -109,6 +109,14 @@ build/jsdoc-$(BRANCH)-timestamp: $(SRC) $(shell find doc/template -type f) $(JSDOC) -t doc/template -r src -d build/gh-pages/$(BRANCH)/apidoc touch $@ +.PHONY: hostexamples +hostexamples: build examples + mkdir -p build/gh-pages/$(BRANCH)/examples + mkdir -p build/gh-pages/$(BRANCH)/build + cp $(EXAMPLES) $(subst .html,.js,$(EXAMPLES)) examples/style.css build/gh-pages/$(BRANCH)/examples/ + cp build/loader_hosted_examples.js build/gh-pages/$(BRANCH)/examples/loader.js + cp build/ol.js build/ol.css build/gh-pages/$(BRANCH)/build/ + .PHONY: test test: $(INTERNAL_SRC) $(PHANTOMJS) test/phantom-jasmine/run_jasmine_test.coffee test/ol.html diff --git a/authors.txt b/authors.txt index dfcd9ff2fd..057978f513 100644 --- a/authors.txt +++ b/authors.txt @@ -27,6 +27,7 @@ Eric Lemoine Philip Lindsay Martijn van Oosterhout David Overstrom +Tom Payne Corey Puffault Peter William Robins Gregers Rygg diff --git a/bin/generate-exports b/bin/generate-exports index 4239c8eed7..49360b47d7 100755 --- a/bin/generate-exports +++ b/bin/generate-exports @@ -114,9 +114,10 @@ class ObjectLiteral(Exportable): class Symbol(Exportable): - def __init__(self, name, export_symbol): + def __init__(self, name, export_symbol, export_as=None): Exportable.__init__(self, name) self.export_symbol = export_symbol + self.export_as = export_as or self.name self.props = set() __repr__ = simplerepr @@ -124,7 +125,7 @@ class Symbol(Exportable): def export(self): lines = [] if self.export_symbol: - lines.append('\n\ngoog.exportSymbol(\n \'%s\',\n %s);\n' % (self.name, self.name)) + lines.append('\n\ngoog.exportSymbol(\n \'%s\',\n %s);\n' % (self.name, self.export_as)) lines.extend('goog.exportProperty(\n %s,\n \'%s\',\n %s.%s);\n' % (self.name, prop, self.name, prop) for prop in sorted(self.props)) return ''.join(lines) @@ -193,14 +194,16 @@ def main(argv): objects[name] = symbol symbol.props.add(prop) continue - m = re.match(r'@exportSymbol\s+(?P\S+)\Z', line) + m = re.match(r'@exportSymbol\s+(?P\S+)(?:\s+(?P\S+))?\Z', line) if m: name = m.group('name') if name in objects: raise RuntimeError(line) # Name already defined - symbol = Symbol(name, True) + export_as = m.group('export_as') + symbol = Symbol(name, True, export_as) objects[name] = symbol - requires.add(name) + if not export_as: + requires.add(name) continue raise RuntimeError(line) diff --git a/build/loader_hosted_examples.js b/build/loader_hosted_examples.js new file mode 100644 index 0000000000..3ec22aa5e2 --- /dev/null +++ b/build/loader_hosted_examples.js @@ -0,0 +1,46 @@ +/** + * + * Loader to add ol.css, ol.js and the example-specific js file to the + * documents. + * + * This loader is used for the hosted examples. It is used in place of the + * development loader (examples/loader.js). + * + * ol.css and ol.js are built with Plovr/Closure, based build/ol.json. + * (`make build` should build them). They are located in the ../build/ + * directory, relatively to this script. + * + * The script should be named loader.js. So it needs to be renamed to + * loader.js from loader_hosted_examples.js. + * + * Usage: + * + * + */ + +(function() { + var scripts = document.getElementsByTagName('script'); + + var i, src, index, search, chunks, pair, params = {}; + for (i = scripts.length - 1; i >= 0; --i) { + src = scripts[i].getAttribute('src'); + if (~(index = src.indexOf('loader.js?'))) { + search = src.substr(index + 10); + chunks = search ? search.split('&') : []; + for (i = chunks.length - 1; i >= 0; --i) { + pair = chunks[i].split('='); + params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); + } + break; + } + } + + document.write(''); + document.write('' + + ''); + document.write('' + + ''); +}()); diff --git a/examples/full-screen.html b/examples/full-screen.html index f61977613c..f4fb9d5b62 100644 --- a/examples/full-screen.html +++ b/examples/full-screen.html @@ -2,6 +2,7 @@ + - ol3 full-screen demo diff --git a/examples/loader.js b/examples/loader.js index 3ea91f7536..7c56ba7ff6 100644 --- a/examples/loader.js +++ b/examples/loader.js @@ -1,10 +1,12 @@ /** - * Loader to add the plovr generated script to the document. The following - * default values may be overridden with query string parameters: + * Loader to add the plovr generated script and ol.css to the document. * - * * hostname - the current hostname + * The following default values may be overridden with query string + * parameters: + * + * * hostname - the current hostname (window.location.hostname) * * port - 9810 * * mode - ADVANCED * * id - id param in loader.js query string; defaults to 'ol' if not set @@ -54,6 +56,8 @@ pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(params[key])); } + document.write(''); var url = 'http://' + host + '/compile?' + pairs.join('&'); document.write(''); }()); diff --git a/examples/overlay-and-popup.html b/examples/overlay-and-popup.html index 67bba0aa9b..37b6aa871b 100644 --- a/examples/overlay-and-popup.html +++ b/examples/overlay-and-popup.html @@ -2,6 +2,7 @@ + - ol3 overlay-and-popup demo diff --git a/examples/side-by-side.html b/examples/side-by-side.html index c1c16f3220..3e5ee89250 100644 --- a/examples/side-by-side.html +++ b/examples/side-by-side.html @@ -2,7 +2,7 @@ - +