From ac201afb402499eb591a729751896a8cfec95bdb Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Thu, 24 Jun 2021 14:03:02 +0200 Subject: [PATCH] Documentation update --- Docs/CalculatedTags.md | 7 +++++++ Docs/SpecialRenderings.md | 29 ++++++++++++++++++++++++++--- Logic/SimpleMetaTagger.ts | 4 ++-- UI/SpecialVisualizations.ts | 2 +- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/Docs/CalculatedTags.md b/Docs/CalculatedTags.md index 166f1d7929..c1df5523b6 100644 --- a/Docs/CalculatedTags.md +++ b/Docs/CalculatedTags.md @@ -40,6 +40,13 @@ The surface area of the feature, in square meters and in hectare. Not set on poi The total length of a feature in meters (and in kilometers, rounded to one decimal for '_length:km'). For a surface, the length of the perimeter +### Theme-defined keys + + + +If 'units' is defined in the layoutConfig, then this metatagger will rewrite the specified keys to have the canonical form (e.g. `1meter` will be rewritten to `1m`) + + ### _country diff --git a/Docs/SpecialRenderings.md b/Docs/SpecialRenderings.md index 2b60a8112b..928c670ff0 100644 --- a/Docs/SpecialRenderings.md +++ b/Docs/SpecialRenderings.md @@ -1,7 +1,7 @@ ### Special tag renderings - In a tagrendering, some special values are substituted by an advanced UI-element. This allows advanced features and visualizations to be reused by custom themes or even to query third-party API's. General usage is {func_name()} or {func_name(arg, someotherarg)}. Note that you do not need to use quotes around your arguments, the comma is enough to seperate them. This also implies you cannot use a comma in your args + In a tagrendering, some special values are substituted by an advanced UI-element. This allows advanced features and visualizations to be reused by custom themes or even to query third-party API's. General usage is `{func_name()}`, `{func_name(arg, someotherarg)}` or `{func_name(args):cssStyle}`. Note that you _do not_fcs need to use quotes around your arguments, the comma is enough to seperate them. This also implies you cannot use a comma in your args ### all_tags Prints all key-value pairs of the object - used for debugging @@ -36,6 +36,18 @@ image-key | image | Image tag to add the URL to (or image-tag:0, image-tag:1 whe #### Example usage {image_upload(image)} +### minimap + + A small map showing the selected feature. Note that no styling is applied, wrap this in a div + +name | default | description +------ | --------- | ------------- +zoomlevel | 18 | The zoomlevel: the higher, the more zoomed in with 1 being the entire world and 19 being really close +idKey | id | (Matches all resting arguments) This argument should be the key of a property of the feature. The corresponding value is interpreted as either the id or the a list of ID's. The features with these ID's will be shown on this minimap. + +#### Example usage + + `{minimap()}`, `{minimap(17, id, _list_of_embedded_feature_ids_calculated_by_calculated_tag):height:10rem; border: 2px solid black}` ### reviews Adds an overview of the mangrove-reviews of this object. Mangrove.Reviews needs - in order to identify the reviewed object - a coordinate and a name. By default, the name of the object is given, but this can be overwritten @@ -81,7 +93,7 @@ name | default | description key | undefined | The key to be read and to generate a histogram from title | | The text to put above the given values column countHeader | | The text to put above the counts -colors | undefined | (Matches all resting arguments - optional) Matches a regex onto a color value, e.g. `3[a-zA-Z+-]*:#33cc33` +colors* | undefined | (Matches all resting arguments - optional) Matches a regex onto a color value, e.g. `3[a-zA-Z+-]*:#33cc33` #### Example usage @@ -96,4 +108,15 @@ url | undefined | The url to share (default: current URL) #### Example usage - {share_link()} to share the current page, {share_link()} to share the given url Generated from UI/SpecialVisualisations.ts \ No newline at end of file + {share_link()} to share the current page, {share_link()} to share the given url +### canonical + + Converts a short, canonical value into the long, translated text + +name | default | description +------ | --------- | ------------- +key | undefined | The key of the tag to give the canonical text for + +#### Example usage + + {canonical(length)} will give 42 metre (in french) Generated from UI/SpecialVisualisations.ts \ No newline at end of file diff --git a/Logic/SimpleMetaTagger.ts b/Logic/SimpleMetaTagger.ts index afb0cea476..fed4ce5c6c 100644 --- a/Logic/SimpleMetaTagger.ts +++ b/Logic/SimpleMetaTagger.ts @@ -79,7 +79,7 @@ export default class SimpleMetaTagger { private static canonicalize = new SimpleMetaTagger( { doc: "If 'units' is defined in the layoutConfig, then this metatagger will rewrite the specified keys to have the canonical form (e.g. `1meter` will be rewritten to `1m`)", - keys: [] + keys: ["Theme-defined keys"], }, (feature => { @@ -405,7 +405,7 @@ export default class SimpleMetaTagger { this._f = f; this.includesDates = docs.includesDates ?? false; for (const key of docs.keys) { - if (!key.startsWith('_')) { + if (!key.startsWith('_') && key.toLowerCase().indexOf("theme") < 0) { throw `Incorrect metakey ${key}: it should start with underscore (_)` } } diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index 7927e03b51..3de0e66cad 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -392,7 +392,7 @@ export default class SpecialVisualizations { return new Combine([ new Title("Special tag renderings", 3), "In a tagrendering, some special values are substituted by an advanced UI-element. This allows advanced features and visualizations to be reused by custom themes or even to query third-party API's.", - "General usage is {func_name()}, {func_name(arg, someotherarg)} or {func_name(args):cssStyle}. Note that you do not need to use quotes around your arguments, the comma is enough to seperate them. This also implies you cannot use a comma in your args", + "General usage is `{func_name()}`, `{func_name(arg, someotherarg)}` or `{func_name(args):cssStyle}`. Note that you _do not_fcs need to use quotes around your arguments, the comma is enough to seperate them. This also implies you cannot use a comma in your args", ...helpTexts ] );