forked from MapComplete/MapComplete
Housekeeping...
This commit is contained in:
parent
7017caf502
commit
d5d2c08706
120 changed files with 8537 additions and 2515 deletions
|
@ -13,8 +13,8 @@ import QueryParameterDocumentation from "../UI/QueryParameterDocumentation"
|
|||
import ScriptUtils from "./ScriptUtils"
|
||||
import List from "../UI/Base/List"
|
||||
import SharedTagRenderings from "../Customizations/SharedTagRenderings"
|
||||
import {writeFile} from "fs";
|
||||
import Translations from "../UI/i18n/Translations";
|
||||
import { writeFile } from "fs"
|
||||
import Translations from "../UI/i18n/Translations"
|
||||
import * as themeOverview from "../assets/generated/theme_overview.json"
|
||||
|
||||
function WriteFile(
|
||||
|
@ -63,11 +63,14 @@ function WriteFile(
|
|||
/**
|
||||
* The wikitable is updated as some tools show an overview of apps based on the wiki.
|
||||
*/
|
||||
function generateWikipage(){
|
||||
|
||||
function generateWikiEntry(layout: { hideFromOverview: boolean, id: string, shortDescription: any }) {
|
||||
function generateWikipage() {
|
||||
function generateWikiEntry(layout: {
|
||||
hideFromOverview: boolean
|
||||
id: string
|
||||
shortDescription: any
|
||||
}) {
|
||||
if (layout.hideFromOverview) {
|
||||
return "";
|
||||
return ""
|
||||
}
|
||||
|
||||
const languagesInDescr = []
|
||||
|
@ -75,8 +78,8 @@ function generateWikipage(){
|
|||
languagesInDescr.push(shortDescriptionKey)
|
||||
}
|
||||
|
||||
const languages = languagesInDescr.map(ln => `{{#language:${ln}|en}}`).join(", ")
|
||||
let auth = "Yes";
|
||||
const languages = languagesInDescr.map((ln) => `{{#language:${ln}|en}}`).join(", ")
|
||||
let auth = "Yes"
|
||||
return `{{service_item
|
||||
|name= [https://mapcomplete.osm.be/${layout.id} ${layout.id}]
|
||||
|region= Worldwide
|
||||
|
@ -84,32 +87,32 @@ function generateWikipage(){
|
|||
|descr= A MapComplete theme: ${Translations.T(layout.shortDescription)
|
||||
.textFor("en")
|
||||
.replace("<a href='", "[[")
|
||||
.replace(/'>.*<\/a>/, "]]")
|
||||
}
|
||||
.replace(/'>.*<\/a>/, "]]")}
|
||||
|material= {{yes|[https://mapcomplete.osm.be/ ${auth}]}}
|
||||
|image= MapComplete_Screenshot.png
|
||||
|genre= POI, editor, ${layout.id}
|
||||
}}`
|
||||
}
|
||||
|
||||
let wikiPage = "{|class=\"wikitable sortable\"\n" +
|
||||
let wikiPage =
|
||||
'{|class="wikitable sortable"\n' +
|
||||
"! Name, link !! Genre !! Covered region !! Language !! Description !! Free materials !! Image\n" +
|
||||
"|-";
|
||||
"|-"
|
||||
|
||||
for (const layout of (themeOverview["default"] ?? themeOverview)) {
|
||||
for (const layout of themeOverview["default"] ?? themeOverview) {
|
||||
if (layout.hideFromOverview) {
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
wikiPage += "\n" + generateWikiEntry(layout);
|
||||
wikiPage += "\n" + generateWikiEntry(layout)
|
||||
}
|
||||
|
||||
wikiPage += "\n|}"
|
||||
|
||||
writeFile("Docs/wikiIndex.txt", wikiPage, (err) => {
|
||||
if (err !== null) {
|
||||
console.log("Could not save wikiindex", err);
|
||||
console.log("Could not save wikiindex", err)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
console.log("Starting documentation generation...")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue