Update wikiIndex to new format

This commit is contained in:
Pieter Vander Vennet 2020-10-25 17:26:15 +01:00
parent 15693e7a0d
commit e6009af904
3 changed files with 21 additions and 31 deletions

View file

@ -16,7 +16,7 @@ export class PersonalLayout extends Layout {
0, 0,
Translations.t.favourite.description, Translations.t.favourite.description,
); );
this.maintainer = "MapComplete"
this.description = "The personal theme allows to select one or more layers from all the layouts, creating a truly personal editor" this.description = "The personal theme allows to select one or more layers from all the layouts, creating a truly personal editor"
this.icon = "./assets/add.svg" this.icon = "./assets/add.svg"
} }

View file

@ -17,7 +17,7 @@
"startLat": 51.2095, "startLat": 51.2095,
"startZoom": 14, "startZoom": 14,
"startLon": 3.2228, "startLon": 3.2228,
"maintainer": "MapComlete", "maintainer": "MapComplete",
"widenfactor": 0.05, "widenfactor": 0.05,
"roamingRenderings": [ "roamingRenderings": [
{ {

View file

@ -81,34 +81,19 @@ function generateWikiEntry(layout: Layout){
if(layout.hideFromOverview){ if(layout.hideFromOverview){
return ""; return "";
} }
let image = "MapComplete_Screenshot.png"; const languages = layout.supportedLanguages.map(ln => `{{#language:${ln}|en}}`).join(", ")
if(layout.socialImage){ let auth = "Yes";
// image = layout.socialImage; if(layout.maintainer !== "" && layout.maintainer !== "MapComplete"){
auth=`Yes, by ${layout.maintainer};`
} }
return `{{service_item
|name= [https://pietervdvn.github.io/MapComplete/${layout.id}.html ${layout.id}]
if(!image.startsWith("http")){ |region= Worldwide
// image = "https://pietervdvn.github.io/MapComplete/"+image |lang= ${languages}
} |descr= A MapComplete theme: ${Translations.W(layout.description).InnerRender()}
|material= {{yes|[https://github.com/pietervdvn/MapComplete ${auth}]}}
return `{{Software |image= MapComplete_Screenshot.png
|name = ${layout.id} |genre= POI, editor, ${layout.id}
|author = ${layout.maintainer ?? "MapComplete builtin"}
|web = https://pietervdvn.github.io/MapComplete/${layout.id}.html
|repo = https://github.com/pietervdvn/MapComplete
|platform = web
|code = Typescript;HTML;CSS
|languages = ${layout.supportedLanguages.join(";")}
|genre = display;editor
|screenshot = ${image}
|description = A MapComplete theme: ${Translations.W(layout.description)?.InnerRender() ?? ""}
|map = yes
|findLocation = yes
|findNearbyPOI = yes
|addPOI = yes
|editPOI = yes
|editTags = yes
|
}}` }}`
} }
@ -240,7 +225,9 @@ function createLandingPage(layout: Layout) {
const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap"] const blacklist = ["", "test", ".", "..", "manifest", "index", "land", "preferences", "account", "openstreetmap"]
const all = AllKnownLayouts.allSets; const all = AllKnownLayouts.allSets;
let wikiPage = ""; let wikiPage = "{|class=\"wikitable sortable\"\n" +
"! Name, link !! Genre !! Covered region !! Language !! Description !! Free materials !! Image\n" +
"|-";
for (const layoutName in all) { for (const layoutName in all) {
if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) { if (blacklist.indexOf(layoutName.toLowerCase()) >= 0) {
@ -262,8 +249,11 @@ for (const layoutName in all) {
const landing = createLandingPage(layout); const landing = createLandingPage(layout);
writeFile(enc(layout.id) + ".html", landing, err) writeFile(enc(layout.id) + ".html", landing, err)
wikiPage += "\n\n"+generateWikiEntry(layout); wikiPage += "\n"+generateWikiEntry(layout);
} }
wikiPage += "|}"
writeFile("./assets/generated/wikiIndex", wikiPage, (err) => { writeFile("./assets/generated/wikiIndex", wikiPage, (err) => {
if (err !== null) { if (err !== null) {
console.log("Could not save wikiindex", err); console.log("Could not save wikiindex", err);