forked from MapComplete/MapComplete
Style: show a space around all special visualisations of 'title()'
This commit is contained in:
parent
8dfef62432
commit
7c66854822
1 changed files with 43 additions and 36 deletions
|
@ -11,7 +11,7 @@ import {UploadToOsmViz} from "./Popup/UploadToOsmViz"
|
||||||
import {MultiApplyViz} from "./Popup/MultiApplyViz"
|
import {MultiApplyViz} from "./Popup/MultiApplyViz"
|
||||||
import {AddNoteCommentViz} from "./Popup/AddNoteCommentViz"
|
import {AddNoteCommentViz} from "./Popup/AddNoteCommentViz"
|
||||||
import {PlantNetDetectionViz} from "./Popup/PlantNetDetectionViz"
|
import {PlantNetDetectionViz} from "./Popup/PlantNetDetectionViz"
|
||||||
import {ConflateButton, ImportPointButton, ImportWayButton} from "./Popup/ImportButton"
|
import {ConflateButton, ImportWayButton} from "./Popup/ImportButton"
|
||||||
import TagApplyButton from "./Popup/TagApplyButton"
|
import TagApplyButton from "./Popup/TagApplyButton"
|
||||||
import {CloseNoteButton} from "./Popup/CloseNoteButton"
|
import {CloseNoteButton} from "./Popup/CloseNoteButton"
|
||||||
import {MapillaryLinkVis} from "./Popup/MapillaryLinkVis"
|
import {MapillaryLinkVis} from "./Popup/MapillaryLinkVis"
|
||||||
|
@ -72,6 +72,7 @@ import SplitRoadWizard from "./Popup/SplitRoadWizard"
|
||||||
import {ExportAsGpxViz} from "./Popup/ExportAsGpxViz"
|
import {ExportAsGpxViz} from "./Popup/ExportAsGpxViz"
|
||||||
import WikipediaPanel from "./Wikipedia/WikipediaPanel.svelte"
|
import WikipediaPanel from "./Wikipedia/WikipediaPanel.svelte"
|
||||||
import TagRenderingEditable from "./Popup/TagRendering/TagRenderingEditable.svelte";
|
import TagRenderingEditable from "./Popup/TagRendering/TagRenderingEditable.svelte";
|
||||||
|
import {ImportPointButton} from "./Popup/ImportButtons/ImportPointButton";
|
||||||
|
|
||||||
class NearbyImageVis implements SpecialVisualization {
|
class NearbyImageVis implements SpecialVisualization {
|
||||||
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
|
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
|
||||||
|
@ -325,7 +326,7 @@ export default class SpecialVisualizations {
|
||||||
matched[1],
|
matched[1],
|
||||||
extraMappings
|
extraMappings
|
||||||
)
|
)
|
||||||
const argument = matched[2].trim()
|
const argument = matched[2] /* .trim() // We don't trim, as spaces might be relevant, e.g. "what is ... of {title()}"*/
|
||||||
const style = matched[3]?.substring(1) ?? ""
|
const style = matched[3]?.substring(1) ?? ""
|
||||||
const partAfter = SpecialVisualizations.constructSpecification(
|
const partAfter = SpecialVisualizations.constructSpecification(
|
||||||
matched[4],
|
matched[4],
|
||||||
|
@ -355,13 +356,19 @@ export default class SpecialVisualizations {
|
||||||
// Let's to a small sanity check to help the theme designers:
|
// Let's to a small sanity check to help the theme designers:
|
||||||
if (template.search(/{[^}]+\([^}]*\)}/) >= 0) {
|
if (template.search(/{[^}]+\([^}]*\)}/) >= 0) {
|
||||||
// Hmm, we might have found an invalid rendering name
|
// Hmm, we might have found an invalid rendering name
|
||||||
|
|
||||||
|
let suggestion = ""
|
||||||
|
if (SpecialVisualizations.specialVisualizations?.length > 0) {
|
||||||
|
suggestion =
|
||||||
|
"did you mean one of: " +
|
||||||
|
SpecialVisualizations.specialVisualizations
|
||||||
|
.map((sp) => sp.funcName + "()")
|
||||||
|
.join(", ")
|
||||||
|
}
|
||||||
|
|
||||||
console.warn(
|
console.warn(
|
||||||
"Found a suspicious special rendering value in: ",
|
"Found a suspicious special rendering value in: ",
|
||||||
template,
|
template, suggestion
|
||||||
" did you mean one of: "
|
|
||||||
/*SpecialVisualizations.specialVisualizations
|
|
||||||
.map((sp) => sp.funcName + "()")
|
|
||||||
.join(", ")*/
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,7 +1034,7 @@ export default class SpecialVisualizations {
|
||||||
if (title === undefined) {
|
if (title === undefined) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
return new SubstitutedTranslation(title, tagsSource, state)
|
return new SubstitutedTranslation(title, tagsSource, state).SetClass("px-1")
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue