Add some documentation on builtin tag renderings

This commit is contained in:
pietervdvn 2022-02-14 23:42:32 +01:00
parent 18b41b3bd8
commit b43fa5dd39
3 changed files with 35 additions and 1 deletions

View file

@ -3,6 +3,11 @@ import * as icons from "../assets/tagRenderings/icons.json";
import {Utils} from "../Utils";
import TagRenderingConfig from "../Models/ThemeConfig/TagRenderingConfig";
import {TagRenderingConfigJson} from "../Models/ThemeConfig/Json/TagRenderingConfigJson";
import BaseUIElement from "../UI/BaseUIElement";
import Combine from "../UI/Base/Combine";
import Title from "../UI/Base/Title";
import {FixedUiElement} from "../UI/Base/FixedUiElement";
import List from "../UI/Base/List";
export default class SharedTagRenderings {
@ -73,4 +78,31 @@ export default class SharedTagRenderings {
}
public static HelpText(): BaseUIElement {
return new Combine([
new Combine([
new Title("Builtin questions",1),
"The following items can be easily reused in your layers"
]).SetClass("flex flex-col"),
... Array.from( SharedTagRenderings.SharedTagRendering.keys()).map(key => {
const tr = SharedTagRenderings.SharedTagRendering.get(key)
let mappings: BaseUIElement = undefined
if(tr.mappings?.length > 0){
mappings = new List(tr.mappings.map(m => m.then.textFor("en")))
}
return new Combine([
new Title(key),
tr.render?.textFor("en"),
tr.question?.textFor("en") ?? new FixedUiElement("Read-only tagrendering").SetClass("font-bold"),
mappings
]).SetClass("flex flex-col")
})
]).SetClass("flex flex-col")
}
}

View file

@ -41,7 +41,7 @@ export class ExtractImages extends Conversion<LayoutConfigJson, string[]> {
const fromPath = Utils.CollectPath(trpath.path, foundImage)
for (const img of fromPath) {
if (typeof img !== "string") {
(this._isOfficial ? errors: warnings).push("Found an image path that is not a path at " + context + "." + metapath.path.join(".") + ": " + JSON.stringify(img))
(this._isOfficial ? errors: warnings).push(context+": found an image path that is not a path at " + context + "." + metapath.path.join(".") + ": " + JSON.stringify(img))
}
}
allFoundImages.push(...fromPath.filter(i => typeof i === "string"))

View file

@ -16,6 +16,7 @@ import {QueryParameters} from "../Logic/Web/QueryParameters";
import QueryParameterDocumentation from "../UI/QueryParameterDocumentation";
import ScriptUtils from "./ScriptUtils";
import List from "../UI/Base/List";
import SharedTagRenderings from "../Customizations/SharedTagRenderings";
function WriteFile(filename, html: BaseUIElement, autogenSource: string[]): void {
@ -51,6 +52,7 @@ WriteFile("./Docs/CalculatedTags.md", new Combine([new Title("Metatags", 1),
["SimpleMetaTagger", "ExtraFunction"])
WriteFile("./Docs/SpecialInputElements.md", ValidatedTextField.HelpText(), ["ValidatedTextField.ts"]);
WriteFile("./Docs/BuiltinLayers.md", AllKnownLayouts.GenLayerOverviewText(), ["AllKnownLayers.ts"])
WriteFile("./Docs/BuiltinQuestions.md", SharedTagRenderings.HelpText(), ["SharedTagRendings.ts","assets/tagRenderings/questions.json"])
{
// Generate the builtinIndex which shows interlayer dependencies