summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-datasette-leaflet.spec363
-rw-r--r--sources1
3 files changed, 365 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..6632a22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/datasette-leaflet-0.2.2.tar.gz
diff --git a/python-datasette-leaflet.spec b/python-datasette-leaflet.spec
new file mode 100644
index 0000000..32a338f
--- /dev/null
+++ b/python-datasette-leaflet.spec
@@ -0,0 +1,363 @@
+%global _empty_manifest_terminate_build 0
+Name: python-datasette-leaflet
+Version: 0.2.2
+Release: 1
+Summary: A plugin that bundles Leaflet.js for Datasette
+License: Apache License, Version 2.0
+URL: https://github.com/simonw/datasette-leaflet
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/88/6e/444b1ded1cd8f71cd86f4461c06ee88be2bb0682b0d54aa942c323f91411/datasette-leaflet-0.2.2.tar.gz
+BuildArch: noarch
+
+Requires: python3-datasette
+Requires: python3-pytest
+Requires: python3-pytest-asyncio
+
+%description
+# datasette-leaflet
+
+[![PyPI](https://img.shields.io/pypi/v/datasette-leaflet.svg)](https://pypi.org/project/datasette-leaflet/)
+[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-leaflet?include_prereleases&label=changelog)](https://github.com/simonw/datasette-leaflet/releases)
+[![Tests](https://github.com/simonw/datasette-leaflet/workflows/Test/badge.svg)](https://github.com/simonw/datasette-leaflet/actions?query=workflow%3ATest)
+[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-leaflet/blob/main/LICENSE)
+
+Datasette plugin adding the [Leaflet](https://leafletjs.com/) JavaScript library.
+
+A growing number of Datasette plugins depend on the Leaflet JavaScript mapping library. They each have their own way of loading Leaflet, which could result in loading it multiple times (with multiple versions) if more than one plugin is installed.
+
+This library is intended to solve this problem, by providing a single plugin they can all depend on that loads Leaflet in a reusable way.
+
+Plugins that use this:
+
+- [datasette-leaflet-freedraw](https://datasette.io/plugins/datasette-leaflet-freedraw)
+- [datasette-leaflet-geojson](https://datasette.io/plugins/datasette-leaflet-geojson)
+- [datasette-cluster-map](https://datasette.io/plugins/datasette-cluster-map)
+
+## Installation
+
+You can install this plugin like so:
+
+ datasette install datasette-leaflet
+
+Usually this plugin will be a dependency of other plugins, so it should be installed automatically when you install them.
+
+## Usage
+
+The plugin makes `leaflet.js` and `leaflet.css` available as static files. It provides two custom template variables with the URLs of those two files.
+
+- `{{ datasette_leaflet_url }}` is the URL to the JavaScript
+- `{{ datasette_leaflet_css_url }}` is the URL to the CSS
+
+These URLs are also made available as global JavaScript constants:
+
+- `datasette.leaflet.JAVASCRIPT_URL`
+- `datasette.leaflet.CSS_URL`
+
+The JavaScript is packaed as a [JavaScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). You can dynamically import the JavaScript from a custom template like this:
+
+```html+jinja
+<script type="module">
+import('{{ datasette_leaflet_url }}')
+ .then((leaflet) => {
+ /* Use leaflet here */
+ });
+</script>
+```
+
+You can load the CSS like this:
+
+```html+jinja
+<link rel="stylesheet" href="{{ datasette_leaflet_css_url }}">
+```
+
+Or dynamically like this:
+
+```html+jinja
+<script>
+let link = document.createElement('link');
+link.rel = 'stylesheet';
+link.href = '{{ datasette_leaflet_css_url }}';
+document.head.appendChild(link);
+</script>
+```
+
+Here's a full example that loads the JavaScript and CSS and renders a map:
+
+```html+jinja
+<script type="module">
+window.DATASETTE_CLUSTER_MAP_TILE_LAYER = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
+window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS = {"maxZoom": 19, "detectRetina": true, "attribution": "&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"};
+let link = document.createElement('link');
+link.rel = 'stylesheet';
+link.href = '{{ datasette_leaflet_css_url }}';
+document.head.appendChild(link);
+import('{{ datasette_leaflet_url }}')
+ .then((leaflet) => {
+ let div = document.createElement('div');
+ div.style.height = '400px';
+ document.querySelector('.content').appendChild(div);
+ let tiles = leaflet.tileLayer(
+ window.DATASETTE_CLUSTER_MAP_TILE_LAYER,
+ window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS
+ );
+ let map = leaflet.map(div, {
+ center: leaflet.latLng(0, 0),
+ zoom: 2,
+ layers: [tiles]
+ });
+ });
+</script>
+```
+
+
+
+
+%package -n python3-datasette-leaflet
+Summary: A plugin that bundles Leaflet.js for Datasette
+Provides: python-datasette-leaflet
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-datasette-leaflet
+# datasette-leaflet
+
+[![PyPI](https://img.shields.io/pypi/v/datasette-leaflet.svg)](https://pypi.org/project/datasette-leaflet/)
+[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-leaflet?include_prereleases&label=changelog)](https://github.com/simonw/datasette-leaflet/releases)
+[![Tests](https://github.com/simonw/datasette-leaflet/workflows/Test/badge.svg)](https://github.com/simonw/datasette-leaflet/actions?query=workflow%3ATest)
+[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-leaflet/blob/main/LICENSE)
+
+Datasette plugin adding the [Leaflet](https://leafletjs.com/) JavaScript library.
+
+A growing number of Datasette plugins depend on the Leaflet JavaScript mapping library. They each have their own way of loading Leaflet, which could result in loading it multiple times (with multiple versions) if more than one plugin is installed.
+
+This library is intended to solve this problem, by providing a single plugin they can all depend on that loads Leaflet in a reusable way.
+
+Plugins that use this:
+
+- [datasette-leaflet-freedraw](https://datasette.io/plugins/datasette-leaflet-freedraw)
+- [datasette-leaflet-geojson](https://datasette.io/plugins/datasette-leaflet-geojson)
+- [datasette-cluster-map](https://datasette.io/plugins/datasette-cluster-map)
+
+## Installation
+
+You can install this plugin like so:
+
+ datasette install datasette-leaflet
+
+Usually this plugin will be a dependency of other plugins, so it should be installed automatically when you install them.
+
+## Usage
+
+The plugin makes `leaflet.js` and `leaflet.css` available as static files. It provides two custom template variables with the URLs of those two files.
+
+- `{{ datasette_leaflet_url }}` is the URL to the JavaScript
+- `{{ datasette_leaflet_css_url }}` is the URL to the CSS
+
+These URLs are also made available as global JavaScript constants:
+
+- `datasette.leaflet.JAVASCRIPT_URL`
+- `datasette.leaflet.CSS_URL`
+
+The JavaScript is packaed as a [JavaScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). You can dynamically import the JavaScript from a custom template like this:
+
+```html+jinja
+<script type="module">
+import('{{ datasette_leaflet_url }}')
+ .then((leaflet) => {
+ /* Use leaflet here */
+ });
+</script>
+```
+
+You can load the CSS like this:
+
+```html+jinja
+<link rel="stylesheet" href="{{ datasette_leaflet_css_url }}">
+```
+
+Or dynamically like this:
+
+```html+jinja
+<script>
+let link = document.createElement('link');
+link.rel = 'stylesheet';
+link.href = '{{ datasette_leaflet_css_url }}';
+document.head.appendChild(link);
+</script>
+```
+
+Here's a full example that loads the JavaScript and CSS and renders a map:
+
+```html+jinja
+<script type="module">
+window.DATASETTE_CLUSTER_MAP_TILE_LAYER = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
+window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS = {"maxZoom": 19, "detectRetina": true, "attribution": "&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"};
+let link = document.createElement('link');
+link.rel = 'stylesheet';
+link.href = '{{ datasette_leaflet_css_url }}';
+document.head.appendChild(link);
+import('{{ datasette_leaflet_url }}')
+ .then((leaflet) => {
+ let div = document.createElement('div');
+ div.style.height = '400px';
+ document.querySelector('.content').appendChild(div);
+ let tiles = leaflet.tileLayer(
+ window.DATASETTE_CLUSTER_MAP_TILE_LAYER,
+ window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS
+ );
+ let map = leaflet.map(div, {
+ center: leaflet.latLng(0, 0),
+ zoom: 2,
+ layers: [tiles]
+ });
+ });
+</script>
+```
+
+
+
+
+%package help
+Summary: Development documents and examples for datasette-leaflet
+Provides: python3-datasette-leaflet-doc
+%description help
+# datasette-leaflet
+
+[![PyPI](https://img.shields.io/pypi/v/datasette-leaflet.svg)](https://pypi.org/project/datasette-leaflet/)
+[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-leaflet?include_prereleases&label=changelog)](https://github.com/simonw/datasette-leaflet/releases)
+[![Tests](https://github.com/simonw/datasette-leaflet/workflows/Test/badge.svg)](https://github.com/simonw/datasette-leaflet/actions?query=workflow%3ATest)
+[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-leaflet/blob/main/LICENSE)
+
+Datasette plugin adding the [Leaflet](https://leafletjs.com/) JavaScript library.
+
+A growing number of Datasette plugins depend on the Leaflet JavaScript mapping library. They each have their own way of loading Leaflet, which could result in loading it multiple times (with multiple versions) if more than one plugin is installed.
+
+This library is intended to solve this problem, by providing a single plugin they can all depend on that loads Leaflet in a reusable way.
+
+Plugins that use this:
+
+- [datasette-leaflet-freedraw](https://datasette.io/plugins/datasette-leaflet-freedraw)
+- [datasette-leaflet-geojson](https://datasette.io/plugins/datasette-leaflet-geojson)
+- [datasette-cluster-map](https://datasette.io/plugins/datasette-cluster-map)
+
+## Installation
+
+You can install this plugin like so:
+
+ datasette install datasette-leaflet
+
+Usually this plugin will be a dependency of other plugins, so it should be installed automatically when you install them.
+
+## Usage
+
+The plugin makes `leaflet.js` and `leaflet.css` available as static files. It provides two custom template variables with the URLs of those two files.
+
+- `{{ datasette_leaflet_url }}` is the URL to the JavaScript
+- `{{ datasette_leaflet_css_url }}` is the URL to the CSS
+
+These URLs are also made available as global JavaScript constants:
+
+- `datasette.leaflet.JAVASCRIPT_URL`
+- `datasette.leaflet.CSS_URL`
+
+The JavaScript is packaed as a [JavaScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules). You can dynamically import the JavaScript from a custom template like this:
+
+```html+jinja
+<script type="module">
+import('{{ datasette_leaflet_url }}')
+ .then((leaflet) => {
+ /* Use leaflet here */
+ });
+</script>
+```
+
+You can load the CSS like this:
+
+```html+jinja
+<link rel="stylesheet" href="{{ datasette_leaflet_css_url }}">
+```
+
+Or dynamically like this:
+
+```html+jinja
+<script>
+let link = document.createElement('link');
+link.rel = 'stylesheet';
+link.href = '{{ datasette_leaflet_css_url }}';
+document.head.appendChild(link);
+</script>
+```
+
+Here's a full example that loads the JavaScript and CSS and renders a map:
+
+```html+jinja
+<script type="module">
+window.DATASETTE_CLUSTER_MAP_TILE_LAYER = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
+window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS = {"maxZoom": 19, "detectRetina": true, "attribution": "&copy; <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"};
+let link = document.createElement('link');
+link.rel = 'stylesheet';
+link.href = '{{ datasette_leaflet_css_url }}';
+document.head.appendChild(link);
+import('{{ datasette_leaflet_url }}')
+ .then((leaflet) => {
+ let div = document.createElement('div');
+ div.style.height = '400px';
+ document.querySelector('.content').appendChild(div);
+ let tiles = leaflet.tileLayer(
+ window.DATASETTE_CLUSTER_MAP_TILE_LAYER,
+ window.DATASETTE_CLUSTER_MAP_TILE_LAYER_OPTIONS
+ );
+ let map = leaflet.map(div, {
+ center: leaflet.latLng(0, 0),
+ zoom: 2,
+ layers: [tiles]
+ });
+ });
+</script>
+```
+
+
+
+
+%prep
+%autosetup -n datasette-leaflet-0.2.2
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-datasette-leaflet -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Fri May 05 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.2-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..ff2a2bc
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+e442179a8137242282f7c102a0ed0380 datasette-leaflet-0.2.2.tar.gz