forked from MapComplete/MapComplete
Chore: improve documentation and error messages
This commit is contained in:
parent
5095bffc50
commit
06a9fb3711
7 changed files with 26 additions and 19 deletions
|
@ -7,7 +7,7 @@ export default class OpeningHoursValidator extends Validator {
|
|||
"opening_hours",
|
||||
[
|
||||
"Has extra elements to easily input when a POI is opened.",
|
||||
"### Helper arguments",
|
||||
"#### Helper arguments",
|
||||
"Only one helper argument named `options` can be provided. It is a JSON-object of type `{ prefix: string, postfix: string }`:",
|
||||
MarkdownUtils.table(
|
||||
["subarg", "doc"],
|
||||
|
@ -22,7 +22,7 @@ export default class OpeningHoursValidator extends Validator {
|
|||
],
|
||||
]
|
||||
),
|
||||
"### Example usage",
|
||||
"#### Example usage",
|
||||
"To add a conditional (based on time) access restriction:\n\n```\n" +
|
||||
`
|
||||
"freeform": {
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
import Combine from "../../Base/Combine"
|
||||
import Wikidata, { WikidataResponse } from "../../../Logic/Web/Wikidata"
|
||||
import { Validator } from "../Validator"
|
||||
import { Translation } from "../../i18n/Translation"
|
||||
import Translations from "../../i18n/Translations"
|
||||
import Title from "../../Base/Title"
|
||||
import Table from "../../Base/Table"
|
||||
import MarkdownUtils from "../../../Utils/MarkdownUtils"
|
||||
|
||||
export default class WikidataValidator extends Validator {
|
||||
public static readonly _searchCache = new Map<string, Promise<WikidataResponse[]>>()
|
||||
|
||||
public static docs = [
|
||||
"### Helper arguments",
|
||||
private static docs = [
|
||||
"#### Helper arguments",
|
||||
MarkdownUtils.table(
|
||||
["name", "doc"],
|
||||
[
|
||||
|
@ -25,7 +22,7 @@ export default class WikidataValidator extends Validator {
|
|||
],
|
||||
]
|
||||
),
|
||||
"#### Suboptions",
|
||||
"##### Suboptions",
|
||||
MarkdownUtils.table(
|
||||
["subarg", "doc"],
|
||||
[
|
||||
|
@ -50,7 +47,7 @@ export default class WikidataValidator extends Validator {
|
|||
),
|
||||
].join("\n\n")
|
||||
private static readonly docsExampleUsage: string =
|
||||
"### Example usage\n\n" +
|
||||
"#### Example usage\n\n" +
|
||||
`The following is the 'freeform'-part of a layer config which will trigger a search for the wikidata item corresponding with the name of the selected feature. It will also remove '-street', '-square', ... if found at the end of the name
|
||||
|
||||
\`\`\`json
|
||||
|
@ -113,7 +110,7 @@ Another example is to search for species and trees:
|
|||
return !str.split(";").some((str) => Wikidata.ExtractKey(str) === undefined)
|
||||
}
|
||||
|
||||
getFeedback(s: string, _?: () => string): Translation | undefined {
|
||||
getFeedback(s: string): Translation | undefined {
|
||||
const t = Translations.t.validation.wikidata
|
||||
if (s === "") {
|
||||
return t.empty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue