doxa-maps/internal/check-map-attribution.mjs
Doxa Maps 2c397d25ef Source comments state design history and measurements as facts, without quoting or naming anyone
Comments in library/ and internal/ that quoted a person, attributed a decision to one, used first person,
named fleet agents or carried private host names now state the same technical fact in neutral words:
poster-render (including the comments it writes into generated posters), packet-render, the poster and
research scripts, PosterWall, DataTable, the legends, the layouts and the gates. The network-policy note
states the policy itself. Behaviour is unchanged: a few printed gate messages and reason labels drop an
agent name, the poster-render integrity pin follows its comment-only edit, and series.json changes only in
its _meta and _why notes. The historical poster design snapshots (library/scripts/posters/snapshots/),
which nothing reads, are removed.
2026-10-01 00:37:17 +00:00

32 lines
2.7 KiB
JavaScript

#!/usr/bin/env node
/**
* check-map-attribution — the credit line names the basemap of the engine that actually drew the map.
*
* WHY (licence credit, row 28 at ccc2b1bb): addMapAttribution always credited "Mapbox ·
* © OpenStreetMap". Under MapLibre the tiles are OpenFreeMap's (OpenMapTiles on OpenStreetMap), so
* gospel-resources, key-cities and cities-internet credited Mapbox, which served nothing, and omitted
* the OpenMapTiles credit. Headless: the real module against stand-in map classes and a minimal DOM.
* EXIT 0 pass · 1 fail
*/
const made = []
globalThis.window = globalThis
globalThis.document = { createElement: () => { const el = { style: {}, className: '', innerHTML: '' }; made.push(el); return el } }
class MapboxMap { addControl(c) { this.ctrl = c.onAdd() } }
class MaplibreMap { addControl(c) { this.ctrl = c.onAdd() } }
window.mapboxgl = { Map: MapboxMap }
window.maplibregl = { Map: MaplibreMap }
const { addMapAttribution, attributionText, ATTRIBUTION_TEXT } = await import('../library/composables/useMapAttribution.js')
let bad = 0
const check = (name, ok, got) => { if (!ok) bad++; console.log(` ${ok ? 'ok ' : 'FAIL'} ${name}${ok ? '' : ' — ' + got}`) }
const ml = new MaplibreMap(); addMapAttribution(ml, { boundaries: true })
check('MapLibre map credits OpenFreeMap, OpenMapTiles and OSM contributors', /OpenFreeMap/.test(ml.ctrl.innerHTML) && /OpenMapTiles/.test(ml.ctrl.innerHTML) && /OpenStreetMap contributors/.test(ml.ctrl.innerHTML), ml.ctrl.innerHTML)
check('MapLibre map does NOT credit Mapbox', !/Mapbox/.test(ml.ctrl.innerHTML), ml.ctrl.innerHTML)
const mb = new MapboxMap(); addMapAttribution(mb, { boundaries: true })
check('Mapbox map credits Mapbox and OpenStreetMap', /Mapbox/.test(mb.ctrl.innerHTML) && /OpenStreetMap/.test(mb.ctrl.innerHTML), mb.ctrl.innerHTML)
check('both credit geoBoundaries', /geoBoundaries/.test(ml.ctrl.innerHTML) && /geoBoundaries/.test(mb.ctrl.innerHTML), '')
const nb = new MaplibreMap(); addMapAttribution(nb, { boundaries: true, basemap: false })
check('basemap:false leaves only the boundaries credit', !/OpenFreeMap|Mapbox/.test(nb.ctrl.innerHTML), nb.ctrl.innerHTML)
check('print text for maplibre names OpenMapTiles, not Mapbox', /OpenMapTiles/.test(attributionText('maplibre')) && !/Mapbox/.test(attributionText('maplibre')), attributionText('maplibre'))
check('ATTRIBUTION_TEXT (existing importers) is unchanged', ATTRIBUTION_TEXT === 'Boundaries: geoBoundaries (geoboundaries.org) · © Mapbox © OpenStreetMap', ATTRIBUTION_TEXT)
if (bad) { console.log(`MAP-ATTRIBUTION: FAIL — ${bad} case(s).`); process.exit(1) }
console.log('MAP-ATTRIBUTION: PASS — the credit names the basemap of the engine that drew the map.')