diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..b00af57
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,14 @@
+name: Check and run
+on: [push, pull_request]
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Install lua
+ run: |
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq --no-install-recommends lua5.3 lua-check
+ - name: Check lua files
+ run: bin/check-lua-scripts.sh
+
diff --git a/config/shortbread.lua b/config/shortbread.lua
index a32fd3b..e9d9a5b 100644
--- a/config/shortbread.lua
+++ b/config/shortbread.lua
@@ -6,6 +6,13 @@
--
-- ---------------------------------------------------------------------------
+-- Set these to true in order to create a config or taginfo file
+-- If you are creating a tilekiln config you must also create
+-- the 'shortbread_config' directory.
+local TREX = false
+local TILEKILN = false
+local TAGINFO = false
+
local themepark = require('themepark')
themepark.debug = false
@@ -59,24 +66,23 @@ themepark:add_topic('shortbread_v1/addresses')
-- Create config files only in create mode, not when updating the database.
-- This protects the file in case it contains manual edits.
if osm2pgsql.mode == 'create' then
--- Enable if you want to create a config file for the T-Rex tile server.
---
--- themepark:plugin('t-rex'):write_config('t-rex-config.toml', {})
-
--- Enable if you want to create a config file for the Tilekiln tile server.
--- (You must also create the directory 'shortbread_config'.)
---
--- themepark:plugin('tilekiln'):write_config('shortbread_config', {
--- tileset = 'shortbread_v1',
--- name = 'OpenStreetMap Shortbread',
--- attribution = '© OpenStreetMap'
--- })
-
--- Enable if you want to create a taginfo project file.
---
--- themepark:plugin('taginfo'):write_config('taginfo-shortbread', {
--- project = { name = 'shortbread' }
--- })
+ if TREX then
+ themepark:plugin('t-rex'):write_config('t-rex-config.toml', {})
+ end
+
+ if TILEKILN then
+ themepark:plugin('tilekiln'):write_config('shortbread_config', {
+ tileset = 'shortbread_v1',
+ name = 'OpenStreetMap Shortbread',
+ attribution = '© OpenStreetMap'
+ })
+ end
+
+ if TAGINFO then
+ themepark:plugin('taginfo'):write_config('taginfo-shortbread', {
+ project = { name = 'shortbread' }
+ })
+ end
end
-- ---------------------------------------------------------------------------
diff --git a/config/shortbread_gen.lua b/config/shortbread_gen.lua
index 7128d6f..dea432a 100644
--- a/config/shortbread_gen.lua
+++ b/config/shortbread_gen.lua
@@ -6,6 +6,12 @@
--
-- ---------------------------------------------------------------------------
+-- Set these to true in order to create a config file
+-- If you are creating a tilekiln config you must also create
+-- the 'shortbread_config' directory.
+local TREX = false
+local TILEKILN = false
+
local themepark = require('themepark')
themepark.debug = false
@@ -63,46 +69,44 @@ themepark:add_topic('shortbread_v1/addresses')
-- Create config files only in create mode, not when updating the database.
-- This protects the file in case it contains manual edits.
if osm2pgsql.mode == 'create' then
--- Enable if you want to create a config file for the T-Rex tile server
---
--- themepark:plugin('t-rex'):write_config('t-rex-config.toml', {
--- tileset = 'osm',
--- extra_layers = {
--- {
--- buffer_size = 10,
--- name = 'street_labels',
--- geometry_type = 'LINESTRING',
--- query = {
--- {
--- minzoom = 14,
--- sql = [[
--- SELECT "name","name_de","name_en","kind","layer","ref","ref_rows","ref_cols","z_order","geom"
--- FROM "streets"
--- WHERE "geom" && !bbox! AND !zoom! >= "minzoom"
--- ORDER BY "z_order" asc]]
--- },
--- {
--- minzoom = 11,
--- maxzoom = 13,
--- sql = [[
--- SELECT "name","name_de","name_en","kind","layer","ref","ref_rows","ref_cols","z_order","geom"
--- FROM "streets_med"
--- WHERE "geom" && !bbox! AND !zoom! >= "minzoom"
--- ORDER BY "z_order" asc]]
--- },
--- }
--- }
--- }
--- })
-
--- Enable if you want to create a config file for the Tilekiln tile server.
--- (You must also create the directory 'shortbread_config'.)
---
--- themepark:plugin('tilekiln'):write_config('shortbread_config', {
--- tileset = 'shortbread_v1',
--- name = 'OpenStreetMap Shortbread',
--- attribution = '© OpenStreetMap'
--- })
+ if TREX then
+ themepark:plugin('t-rex'):write_config('t-rex-config.toml', {
+ tileset = 'osm',
+ extra_layers = {
+ {
+ buffer_size = 10,
+ name = 'street_labels',
+ geometry_type = 'LINESTRING',
+ query = {
+ {
+ minzoom = 14,
+ sql = [[
+SELECT "name","name_de","name_en","kind","layer","ref","ref_rows","ref_cols","z_order","geom"
+ FROM "streets"
+ WHERE "geom" && !bbox! AND !zoom! >= "minzoom"
+ ORDER BY "z_order" asc]]
+ },
+ {
+ minzoom = 11,
+ maxzoom = 13,
+ sql = [[
+SELECT "name","name_de","name_en","kind","layer","ref","ref_rows","ref_cols","z_order","geom"
+ FROM "streets_med"
+ WHERE "geom" && !bbox! AND !zoom! >= "minzoom"
+ ORDER BY "z_order" asc]]
+ },
+ }
+ }
+ }
+ })
+ end
+ if TILEKILN then
+ themepark:plugin('tilekiln'):write_config('shortbread_config', {
+ tileset = 'shortbread_v1',
+ name = 'OpenStreetMap Shortbread',
+ attribution = '© OpenStreetMap'
+ })
+ end
end
-- ---------------------------------------------------------------------------
diff --git a/themes/shortbread_v1_gen/topics/boundaries.lua b/themes/shortbread_v1_gen/topics/boundaries.lua
index edb4ce6..4b73f9f 100644
--- a/themes/shortbread_v1_gen/topics/boundaries.lua
+++ b/themes/shortbread_v1_gen/topics/boundaries.lua
@@ -193,7 +193,8 @@ end)
local function gen_commands(sql, level)
local c = gen_config[level]
- table.insert(sql, 'CREATE TABLE {schema}.boundaries_' .. level .. '_new (LIKE {schema}.boundaries_' .. level .. ' INCLUDING IDENTITY)')
+ table.insert(sql, 'CREATE TABLE {schema}.boundaries_' .. level ..
+ '_new (LIKE {schema}.boundaries_' .. level .. ' INCLUDING IDENTITY)')
table.insert(sql, [[
WITH simplified AS (
@@ -201,7 +202,8 @@ WITH simplified AS (
FROM {schema}.boundaries ]] .. c.condition .. [[
)
INSERT INTO {schema}.boundaries_]] .. level .. [[_new (way_ids, relation_ids, admin_level, maritime, disputed, geom)
- SELECT way_ids, relation_ids, admin_level, maritime, disputed, geom FROM simplified WHERE ST_Length(geom) > ]] .. c.minlength)
+ SELECT way_ids, relation_ids, admin_level, maritime, disputed, geom
+ FROM simplified WHERE ST_Length(geom) > ]] .. c.minlength)
table.insert(sql, 'ANALYZE {schema}.boundaries_' .. level .. '_new')
table.insert(sql, 'CREATE INDEX ON {schema}.boundaries_' .. level .. '_new USING GIST (geom)')
diff --git a/themes/shortbread_v1_gen/topics/streets.lua b/themes/shortbread_v1_gen/topics/streets.lua
index a1f735a..990cdf9 100644
--- a/themes/shortbread_v1_gen/topics/streets.lua
+++ b/themes/shortbread_v1_gen/topics/streets.lua
@@ -424,7 +424,9 @@ themepark:add_proc('gen', function(data)
description = 'Merge street lines for medium zoom levels',
transaction = true,
sql = {
- themepark.expand_template('CREATE TABLE {schema}.streets_med_new (LIKE {schema}.streets_med INCLUDING IDENTITY)'),
+ themepark.expand_template([[
+CREATE TABLE {schema}.streets_med_new
+ (LIKE {schema}.streets_med INCLUDING IDENTITY)]]),
themepark.expand_template([[
CREATE OR REPLACE FUNCTION osm2pgsql_shortbread_streets_med() RETURNS void AS $$
DECLARE
@@ -469,7 +471,9 @@ $$ LANGUAGE plpgsql]]),
description = 'Merge street lines for low zoom levels',
transaction = true,
sql = {
- themepark.expand_template('CREATE TABLE {schema}.streets_low_new (LIKE {schema}.streets_low INCLUDING IDENTITY)'),
+ themepark.expand_template([[
+CREATE TABLE {schema}.streets_low_new
+(LIKE {schema}.streets_low INCLUDING IDENTITY)]]),
themepark.expand_template([[
WITH
merged AS
diff --git a/themes/shortbread_v1_gen/topics/water.lua b/themes/shortbread_v1_gen/topics/water.lua
index 8c347de..7c1bbd8 100644
--- a/themes/shortbread_v1_gen/topics/water.lua
+++ b/themes/shortbread_v1_gen/topics/water.lua
@@ -268,7 +268,9 @@ themepark:add_proc('gen', function(data)
if_has_rows = themepark.expand_template('SELECT 1 FROM {schema}.expire_water_lines LIMIT 1'),
transaction = true,
sql = {
- themepark.expand_template('CREATE TABLE {schema}.water_lines_gen_new (LIKE {schema}.water_lines_gen INCLUDING IDENTITY)'),
+ themepark.expand_template([[
+CREATE TABLE {schema}.water_lines_gen_new
+(LIKE {schema}.water_lines_gen INCLUDING IDENTITY)]]),
themepark.expand_template([[
WITH merged AS
(SELECT ]] .. name_list .. [[, kind, tunnel, bridge, ST_LineMerge(ST_Collect(geom)) AS geom