diff --git a/doc/readme.moi b/doc/readme.moi index 861ed3f..2a4fce1 100644 --- a/doc/readme.moi +++ b/doc/readme.moi @@ -99,7 +99,7 @@ Icons are used to visualize tags for nodes and areas. Unlike other renderers, M Feel free to request new icons via issues for whatever you want to see on the map. No matter how frequently the tag is used in OpenStreetMap since final goal is to cover all tags. However, common used tags have priority, other things being equal. -Generate icon grid and sets of individual icons with \m {\command {Test icon generation}}. It will create \m {out/icon_grid.svg} file, and SVG files in \m {out/icons_by_id} directory where files are named using shape identifiers (e.g. \m {power_tower_portal_2_level.svg}) and in \m {icons_by_name} directory where files are named using shape names (e.g. \m {Röntgen portal two-level transmission tower.svg}). Files from the last directory are used in OpenStreetMap wiki (e.g. \ref {https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg} {\m {File:Röntgen_portal_two-level_transmission_tower.svg}}). +Generate icon grid and sets of individual icons with \m {\command {icons}}. It will create \m {out/icon_grid.svg} file, and SVG files in \m {out/icons_by_id} directory where files are named using shape identifiers (e.g. \m {power_tower_portal_2_level.svg}) and in \m {icons_by_name} directory where files are named using shape names (e.g. \m {Röntgen portal two-level transmission tower.svg}). Files from the last directory are used in OpenStreetMap wiki (e.g. \ref {https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg} {\m {File:Röntgen_portal_two-level_transmission_tower.svg}}). \3 {Shape combination} {shape_combination} @@ -283,7 +283,7 @@ Map configuration options used by \m {render} and \m {tile} commands: \2 {MapCSS 0.2 generation} {mapcss-0-2-generation} -Command \m {mapcss} is used to generate MapCSS scheme. \m {\command {Test MapCSS 0.2 generation}} will create \m {out/map_machine_mapcss} directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas\: \m {.mapcss} file and directory with icons. +Command \m {mapcss} is used to generate MapCSS scheme. \m {\command {mapcss}} will create \m {out/map_machine_mapcss} directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas\: \m {.mapcss} file and directory with icons. To create MapCSS with Map Machine style also for ways and relations, run \m {map-machine mapcss --ways}. @@ -292,7 +292,7 @@ To create MapCSS with Map Machine style also for ways and relations, run \m {map \3 {Use Map Machine as JOSM map paint style} \list - {Run \m {\command {Test MapCSS 0.2 generation}}.} + {Run \m {\command {mapcss}}.} {Open \ref {https://josm.openstreetmap.de/} {JOSM}.} {Go to \kbd {Preferences} → Third tab on the left → \kbd {Map Paint Styles}.} {Active styles: press \kbd {+}.} diff --git a/map_machine/moire_manager.py b/map_machine/moire_manager.py index b039079..b8934d1 100644 --- a/map_machine/moire_manager.py +++ b/map_machine/moire_manager.py @@ -6,12 +6,12 @@ from abc import ABC from pathlib import Path from typing import Any, Union -import yaml from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki from moire.moire import Tag from map_machine import ui from map_machine.icon import ShapeExtractor +from map_machine.ui import COMMANDS from map_machine.workspace import workspace __author__ = "Sergey Vartanov" @@ -115,34 +115,6 @@ class ArgumentParser(argparse.ArgumentParser): return Tag("table", table) -class TestConfiguration: - """ - GitHub Actions test configuration. - """ - - def __init__(self, test_config: Path) -> None: - self.steps: dict[str, Any] = {} - - with test_config.open() as input_file: - content: dict[str, Any] = yaml.load( - input_file, Loader=yaml.FullLoader - ) - steps: list[dict[str, Any]] = content["jobs"]["build"]["steps"] - for step in steps: - if "name" not in step: - continue - self.steps[step["name"]] = step - - def get_command(self, name: str) -> str: - """Get shell script commands for the test.""" - return self.steps[name]["run"].strip() - - -test_configuration: TestConfiguration = TestConfiguration( - workspace.GITHUB_TEST_PATH -) - - class MapMachineMoire(Default, ABC): """ Moire extension stub for Map Machine. @@ -170,12 +142,8 @@ class MapMachineMoire(Default, ABC): return "" def command(self, args: Arguments) -> str: - """ - Bash command from GitHub Actions configuration. - - See .github/workflows/test.yml - """ - return test_configuration.get_command(self.clear(args[0])) + """Bash command from integration tests.""" + return "map-machine " + " ".join(COMMANDS[self.clear(args[0])]) def icon(self, args: Arguments) -> str: """Image with Röntgen icon.""" @@ -225,12 +193,12 @@ class MapMachineHTML(MapMachineMoire, DefaultHTML): """Simple table. First row is treated as header.""" content: str = "" cell: str = "".join( - ["