diff --git a/README.md b/README.md index 4a31b1d..b8f0277 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ + + **Röntgen** (or **Roentgen** when ASCII is preferred) project consists of * simple Python [OpenStreetMap](http://openstreetmap.org) renderer (see [usage](#usage), [renderer documentation](#map-generation)), @@ -9,16 +11,20 @@ Unlike standard OpenStreetMap layers, **Röntgen is a playground for experiments Röntgen is intended to be highly configurable, so it can generate precise but messy maps for OSM contributors as well as pretty and clean maps for OSM users, can use slow algorithms for some experimental features. -Usage ------ - -To get SVG map, just run +Usage example +------------- ```bash -python roentgen.py render -b ,,, +roentgen render -b 2.284,48.860,2.290,48.865 ``` -(e.g. `python roentgen.py render -b 2.284,48.86,2.29,48.865`). It will automatically download OSM data and write output map to `out/map.svg`. For more options see [Map generation](#map-generation). +will automatically download OSM data and write output SVG map of the specified area to `out/map.svg`. See [Map generation](#map-generation). + +```bash +roentgen tile -b 2.361,48.871,2.368,48.875 +``` + +will automatically download OSM data and write output PNG tiles that cover the specified area to `out/tiles` directory. See [Tile generation](#tile-generation). Map features ------------ @@ -32,9 +38,9 @@ Röntgen features: * display [directions](#direction) with gradient sectors, * use width to display roads. -### Simple building shapes ### +### Isometric building shapes ### -Simple shapes for walls and shade in proportion to [`building:levels`](https://wiki.openstreetmap.org/wiki/Key:building:levels), [`building:min_level`](https://wiki.openstreetmap.org/wiki/Key:building:min_level), [`height`](https://wiki.openstreetmap.org/wiki/Key:height) and [`min_height`](https://wiki.openstreetmap.org/wiki/Key:min_height) values. +Isometric shapes for walls and shade in proportion to [`building:levels`](https://wiki.openstreetmap.org/wiki/Key:building:levels), [`building:min_level`](https://wiki.openstreetmap.org/wiki/Key:building:min_level), [`height`](https://wiki.openstreetmap.org/wiki/Key:height) and [`min_height`](https://wiki.openstreetmap.org/wiki/Key:min_height) values. ![3D buildings](doc/buildings.png) @@ -71,7 +77,11 @@ There are [special symbols](https://en.wikipedia.org/wiki/List_of_Japanese_map_s Icon set -------- -If tag is drawable it is displayed using icon combination and colors. All icons are under [CC BY](http://creativecommons.org/licenses/by/4.0/) license. So, do whatever you want but give appropriate credit. Icon set is heavily inspired by [Maki](https://github.com/mapbox/maki), [Osmic](https://github.com/gmgeo/osmic), and [Temaki](https://github.com/ideditor/temaki) icon sets. +The central feature of the project is Röntgen icon set. It is a set of monochrome 14 × 14 px pixel-aligned icons. Unlike the Röntgen source code, which is under MIT license, all icons are under [CC BY](http://creativecommons.org/licenses/by/4.0/) license. So, with the appropriate credit icon set can be used outside the project. Some icons can be used as emoji symbols. + +All icons tend to support common design style, which is heavily inspired by [Maki](https://github.com/mapbox/maki), [Osmic](https://github.com/gmgeo/osmic), and [Temaki](https://github.com/ideditor/temaki). + +Icons are used to visualize tags for nodes and areas. Unlike other renderers, Röntgen can use more than one icon to visualize an entity and use colors to visualize [`colour`](https://wiki.openstreetmap.org/wiki/Key:colour) value or other entity properties (like material or genus). ![Icons](doc/grid.png) @@ -79,26 +89,14 @@ Feel free to request new icons via issues for whatever you want to see on the ma Generate icon grid and sets of individual icons with `python roentgen.py icons`. It will create `out/icon_grid.svg` file, and SVG files in `out/icons_by_id` directory where files are named using shape identifiers (e.g. `power_tower_portal_2_level.svg`) and in `icons_by_name` directory where files are named using shape names (e.g. `Röntgen portal two-level transmission tower.svg`). Files from the last directory are used in OpenStreetMap wiki (e.g. [`File:Röntgen_portal_two-level_transmission_tower.svg`](https://wiki.openstreetmap.org/wiki/File:R%C3%B6ntgen_portal_two-level_transmission_tower.svg)). -### Icon combination ### +### Shape combination ### -Some icons can be combined into new icons. +Röntgen constructs icons from the shapes extracted from the sketch SVG file. Some icons consists of just one shape, to construct other it may be necessary to combine two or more shapes. ![Bus stop icon combination](doc/bus_stop.png) -Map styles ----------- - -### All tags style ### - -Options: `--show-missing-tags --overlap 0`. - -Display as many OpenStreetMap data tags on the map as possible. - -### Pretty style ### - -Options: `--draw-captions main --level overground`. - -Display only not overlapping icons and main captions. +Wireframe view +-------------- ### Creation time mode ### @@ -115,7 +113,7 @@ Every way and node displayed with the random color picked for each author with ` Installation ------------ -Requirements: Python (at least 3.9). +Requirements: Python 3.9. To install all packages, run: @@ -126,65 +124,68 @@ pip install -r requirements.txt Map generation -------------- -Command: `render`. - -There are simple Python renderer that generates SVG map from OpenStreetMap data. You can run it using: +Command `render` is used to generates SVG map from OpenStreetMap data. You can run it using: ```bash -python roentgen.py render \ - -b ${LONGITUDE_1},${LATITUDE_1},${LONGITUDE_2},${LATITUDE_2} \ - -o ${OUTPUT_FILE_NAME} \ - -s ${OSM_ZOOM_LEVEL} +roentgen render \ + -b ,,, \ + -o \ + -s \ + ``` -Example: +### Example ### ```bash -python roentgen.py render -b 2.284,48.86,2.29,48.865 +roentgen render \ + --boundary-box 2.284,48.860,2.290,48.865 \ + --output out/esplanade_du_trocadéro.svg ``` +will download OSM data to `cache/2.284,48.860,2.290,48.865.osm` and write output SVG map of the specified area to `out/esplanade_du_trocadéro.svg`. + ### Arguments ### | Option | Description | |---|---| -| `-i`, `--input` | input XML file name or names (if not specified, file will be downloaded using OpenStreetMap API) | -| `-o`, `--output` | output SVG file name, default value: `out/map.svg` | -| `-b`, `--boundary-box` | geo boundary box, use space before "-" if the first value is negative | -| `-s`, `--scale` | OSM zoom level (may not be integer), default value: 18 | -| `--cache` | path for temporary OSM files, default value: `cache` | -| `--labels` | label drawing mode: `no`, `main`, or `all`, default value: `main` | -| `--overlap` | how many pixels should be left around icons and text, default value: 12 | -| `--mode` | map drawing mode, default value: `normal` | -| `--seed` | seed for random | -| `--level` | display only this floor level | +| `-i`, `--input` `` | input XML file name or names (if not specified, file will be downloaded using OpenStreetMap API) | +| `-o`, `--output` `` | output SVG file name, default value: `out/map.svg` | +| `-b`, `--boundary-box` `,,,` | geo boundary box; if first value is negative, enclose the value with quotes and use space before `-` | +| `-s`, `--scale` `` | OSM zoom level (may not be integer), default value: 18 | +| `--cache` `` | path for temporary OSM files, default value: `cache` | +| `--labels` | label drawing mode: `no`, `main`, or `all`, default value: `main` | +| `--overlap` | how many pixels should be left around icons and text, default value: 12 | +| `--mode` | map drawing mode, default value: `normal` | +| `--seed` | seed for random | +| `--level` | display only this floor level | Tile generation --------------- -Command: `tile`. +Command `tile` is used to generate PNG tiles for [slippy maps](https://wiki.openstreetmap.org/wiki/Slippy_Map). To use them, run [Röntgen tile server](#tile-server). | Option | Description | |---|---| -| `-c`, `--coordinates` | coordinates of any location inside the tile | -| `-s`, `--scale` | OSM zoom level, default value: 18 | -| `-t`, `--tile` | tile specification | -| `--cache` | path for temporary OSM files, default value: `cache` | -| `-b`, `--boundary-box` | construct the minimum amount of tiles that cover requested boundary box | +| `-c`, `--coordinates` `,` | coordinates of any location inside the tile | +| `-s`, `--scale` `` | OSM zoom level, default value: 18 | +| `-t`, `--tile` `//` | tile specification | +| `--cache` `` | path for temporary OSM files, default value: `cache` | +| `-b`, `--boundary-box` `,,,` | construct the minimum amount of tiles that cover requested boundary box | ### Generate one tile ### Specify tile coordinates: ```bash -python roentgen.py tile --tile ${OSM_ZOOM_LEVEL}/${X}/${Y} +roentgen tile --tile // ``` or specify any geographical coordinates inside a tile: ```bash -python roentgen.py tile \ - --coordinates ${LATITUDE},${LONGITUDE} \ - --scale ${OSM_ZOOM_LEVEL} +roentgen tile \ + --coordinates , \ + --scale ``` Tile will be stored as SVG file `out/tiles/tile___.svg` and PNG file `out/tiles/tile___.svg`, where `x` and `y` are tile coordinates. `--scale` option will be ignored if it is used with `--tile` option. @@ -192,7 +193,7 @@ Tile will be stored as SVG file `out/tiles/tile___.svg` and PN Example: ```bash -python roentgen.py tile -c 55.7510637,37.6270761 -s 18 +roentgen tile -c 55.7510637,37.6270761 -s 18 ``` will generate SVG file `out/tiles/tile_18_158471_81953.svg` and PNG file `out/tiles/tile_18_158471_81953.png`. @@ -202,9 +203,9 @@ will generate SVG file `out/tiles/tile_18_158471_81953.svg` and PNG file `out/ti Specify boundary box to get the minimal set of tiles that covers the area: ```bash -python roentgen.py tile \ - --boundary-box ${LONGITUDE_1},${LATITUDE_1},${LONGITUDE_2},${LATITUDE_2} \ - --scale ${OSM_ZOOM_LEVEL} +roentgen tile \ + --boundary-box ,,, \ + --scale ``` Boundary box will be extended to the boundaries of the minimal tile set that covers the area, then it will be extended a bit more to avoid some artifacts on the edges rounded to 3 digits after the decimal point. Map with new boundary box coordinates will be written to the cache directory as SVG and PNG files. All tiles will be stored as SVG files `out/tiles/tile___.svg` and PNG files `out/tiles/tile___.svg`, where `x` and `y` are tile coordinates. @@ -212,33 +213,42 @@ Boundary box will be extended to the boundaries of the minimal tile set that cov Example: ```bash -roentgen.py tile -b 2.361,48.871,2.368,48.875 +roentgen tile -b 2.361,48.871,2.368,48.875 ``` will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files `cache/2.360,48.869,2.370,48.877.svg` and `cache/2.360,48.869,2.370,48.877.png`. +Tile server +----------- + +Command `server` is used to run tile server for slippy maps. + +``` +roentgen server +``` + +Stop server interrupting process with Ctrl + C. + MapCSS 0.2 generation --------------------- -Command: `mapcss`. +Command `mapcss` is used to generate MapCSS scheme. `roentgen mapcss` will create `out/roentgen_mapcss` directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas: `.mapcss` file and directory with icons. -`python roentgen.py mapcss` will create `out/roentgen_mapcss` directory with simple MapCSS 0.2 scheme adding icons from Röntgen icon set to nodes and areas: `.mapcss` file and directory with icons. - -To create MapCSS with only Röntgen icons run `python roentgen.py mapcss --no-ways`. +To create MapCSS with only Röntgen icons run `roentgen mapcss --no-ways`. | Option | Description | |---|---| -| `--icons` | add icons for nodes and areas, set by default | -| `--ways` | add style for ways and relations, set by default | -| `--lifecycle` | add icons for lifecycle tags; be careful: this will increase the number of node and area selectors by 9 times, set by default | +| `--icons` | add icons for nodes and areas, set by default | +| `--ways` | add style for ways and relations, set by default | +| `--lifecycle` | add icons for lifecycle tags; be careful: this will increase the number of node and area selectors by 9 times, set by default | ### Use Röntgen as JOSM map paint style ### + * Run `roentgen mapcss`. * Open [JOSM](https://josm.openstreetmap.de/). * Go to Preferences → Third tab on the left → Map Paint Styles. * Active styles: press +. * URL / File: set path to `out/roentgen_mapcss/roentgen.mapcss`. - * OkOK. To enable / disable Röntgen map paint style go to ViewMap Paint StylesRöntgen. diff --git a/doc/readme.moi b/doc/readme.moi index 5ea5d86..9bc9743 100644 --- a/doc/readme.moi +++ b/doc/readme.moi @@ -1,3 +1,6 @@ +\title {Röntgen} +\page_icon {out/icons_by_id/book.svg} + \b {Röntgen} (or \b {Roentgen} when ASCII is preferred) project consists of \list @@ -10,13 +13,15 @@ Unlike standard OpenStreetMap layers, \b {Röntgen is a playground for experimen Röntgen is intended to be highly configurable, so it can generate precise but messy maps for OSM contributors as well as pretty and clean maps for OSM users, can use slow algorithms for some experimental features. -\2 {Usage} {usage} +\2 {Usage example} {usage-example} -To get SVG map, just run +\code {roentgen render -b 2.284,48.860,2.290,48.865} {bash} -\code {python roentgen.py render -b ,,,} {bash} +will automatically download OSM data and write output SVG map of the specified area to \m {out/map.svg}. See \ref {#map-generation} {Map generation}. -(e.g. \m {python roentgen.py render -b 2.284,48.86,2.29,48.865}). It will automatically download OSM data and write output map to \m {out/map.svg}. For more options see \ref {#map-generation} {Map generation}. +\code {roentgen tile -b 2.361,48.871,2.368,48.875} {bash} + +will automatically download OSM data and write output PNG tiles that cover the specified area to \m {out/tiles} directory. See \ref {#tile-generation} {Tile generation}. \2 {Map features} {features} @@ -29,9 +34,9 @@ Röntgen features\: {display \ref {#direction} {directions} with gradient sectors,} {use width to display roads.} -\3 {Simple building shapes} {levels} +\3 {Isometric building shapes} {levels} -Simple shapes for walls and shade in proportion to \osm {building:levels}, \osm {building:min_level}, \osm {height} and \osm {min_height} values. +Isometric shapes for walls and shade in proportion to \osm {building:levels}, \osm {building:min_level}, \osm {height} and \osm {min_height} values. \image {doc/buildings.png} {3D buildings} @@ -41,6 +46,8 @@ Visualization of tree leaf types (broadleaved or needleleaved) and genus or taxo /* +Visualization of tree \icon {tree} leaf types (broadleaved \icon {tree_with_leaf} or needleleaved \icon {needleleaved_tree}) and genus or taxon by means of icon shapes and leaf cycles (unknown \color {#98AC64}, deciduous \color {#fcaf3e} or evergreen \color {#688C44}) by means of color. If diameter, circumference, and/or diameter_crown are specified, we draw crown and trunk as circles. We also have special icons for some genus and taxons\: birch (\i {Betula}) \icon {betula}, palm (\i {Arecaceae}) \icon {palm}, maple (\i {Acer}) \icon {tree}\icon {leaf_maple}. + \table {{\osm {natural=tree}} {\icon {tree}}} {{\osm {leaf_type=broadleaved}} {\icon {tree_with_leaf}}} @@ -82,7 +89,11 @@ There are \ref {https://en.wikipedia.org/wiki/List_of_Japanese_map_symbols} {spe \2 {Icon set} {icon-set} -If tag is drawable it is displayed using icon combination and colors. All icons are under \ref {http://creativecommons.org/licenses/by/4.0/} {CC BY} license. So, do whatever you want but give appropriate credit. Icon set is heavily inspired by \ref {https://github.com/mapbox/maki} {Maki}, \ref {https://github.com/gmgeo/osmic} {Osmic}, and \ref {https://github.com/ideditor/temaki} {Temaki} icon sets. +The central feature of the project is Röntgen icon set. It is a set of monochrome 14 × 14 px pixel-aligned icons. Unlike the Röntgen source code, which is under MIT license, all icons are under \ref {http://creativecommons.org/licenses/by/4.0/} {CC BY} license. So, with the appropriate credit icon set can be used outside the project. Some icons can be used as emoji symbols. + +All icons tend to support common design style, which is heavily inspired by \ref {https://github.com/mapbox/maki} {Maki}, \ref {https://github.com/gmgeo/osmic} {Osmic}, and \ref {https://github.com/ideditor/temaki} {Temaki}. + +Icons are used to visualize tags for nodes and areas. Unlike other renderers, Röntgen can use more than one icon to visualize an entity and use colors to visualize \osm {colour} value or other entity properties (like material or genus). \image {doc/grid.png} {Icons} @@ -90,9 +101,9 @@ Feel free to request new icons via issues for whatever you want to see on the ma 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}}). -\3 {Icon combination} {icon_combination} +\3 {Shape combination} {shape_combination} -Some icons can be combined into new icons. +Röntgen constructs icons from the shapes extracted from the sketch SVG file. Some icons consists of just one shape, to construct other it may be necessary to combine two or more shapes. \image {doc/bus_stop.png} {Bus stop icon combination} @@ -134,19 +145,7 @@ Countries with right-to-left script direction\: */ -\2 {Map styles} {map-styles} - -\3 {All tags style} {all_tags_style} - -Options\: \m {--show-missing-tags --overlap 0}. - -Display as many OpenStreetMap data tags on the map as possible. - -\3 {Pretty style} {pretty_style} - -Options\: \m {--draw-captions main --level overground}. - -Display only not overlapping icons and main captions. +\2 {Wireframe view} {wireframe-view} \3 {Creation time mode} {time_mode} @@ -162,7 +161,7 @@ Every way and node displayed with the random color picked for each author with \ \2 {Installation} {installation} -Requirements\: Python (at least 3.9). +Requirements\: Python 3.9/* or higher*/. To install all packages, run\: @@ -170,18 +169,21 @@ To install all packages, run\: \2 {Map generation} {map-generation} -Command\: \m {render}. +Command \m {render} is used to generates SVG map from OpenStreetMap data. You can run it using\: -There are simple Python renderer that generates SVG map from OpenStreetMap data. You can run it using\: +\code {roentgen render \\ + -b \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\ + -o \formal {output file name} \\ + -s \formal {osm zoom level} \\ + \formal {other arguments}} {bash} -\code {python roentgen.py render \\ - -b $\{LONGITUDE_1\},$\{LATITUDE_1\},$\{LONGITUDE_2\},$\{LATITUDE_2\} \\ - -o $\{OUTPUT_FILE_NAME\} \\ - -s $\{OSM_ZOOM_LEVEL\}} {bash} +\3 {Example} {example-2} -Example\: +\code {roentgen render \\ + --boundary-box 2.284,48.860,2.290,48.865 \\ + --output out/esplanade_du_trocadéro.svg} {bash} -\code {python roentgen.py render -b 2.284,48.86,2.29,48.865} {bash} +will download OSM data to \m {cache/2.284,48.860,2.290,48.865.osm} and write output SVG map of the specified area to \m {out/esplanade_du_trocadéro.svg}. \3 {Arguments} {arguments} @@ -189,7 +191,7 @@ Example\: \2 {Tile generation} {tile-generation} -Command\: \m {tile}. +Command \m {tile} is used to generate PNG tiles for \ref {https://wiki.openstreetmap.org/wiki/Slippy_Map} {slippy maps}. To use them, run \ref {#tile-server} {Röntgen tile server}. \options {tile} @@ -197,19 +199,19 @@ Command\: \m {tile}. Specify tile coordinates\: -\code {python roentgen.py tile --tile $\{OSM_ZOOM_LEVEL\}/$\{X\}/$\{Y\}} {bash} +\code {roentgen tile --tile \formal {OSM zoom level}/\formal {x}/\formal {y}} {bash} or specify any geographical coordinates inside a tile\: -\code {python roentgen.py tile \\ - --coordinates $\{LATITUDE\},$\{LONGITUDE\} \\ - --scale $\{OSM_ZOOM_LEVEL\}} {bash} +\code {roentgen tile \\ + --coordinates \formal {latitude},\formal {longitude} \\ + --scale \formal {OSM zoom level}} {bash} Tile will be stored as SVG file \m {out/tiles/tile___.svg} and PNG file \m {out/tiles/tile___.svg}, where \m {x} and \m {y} are tile coordinates. \m {--scale} option will be ignored if it is used with \m {--tile} option. Example\: -\code {python roentgen.py tile -c 55.7510637,37.6270761 -s 18} {bash} +\code {roentgen tile -c 55.7510637,37.6270761 -s 18} {bash} will generate SVG file \m {out/tiles/tile_18_158471_81953.svg} and PNG file \m {out/tiles/tile_18_158471_81953.png}. @@ -217,35 +219,41 @@ will generate SVG file \m {out/tiles/tile_18_158471_81953.svg} and PNG file \m { Specify boundary box to get the minimal set of tiles that covers the area\: -\code {python roentgen.py tile \\ - --boundary-box $\{LONGITUDE_1\},$\{LATITUDE_1\},$\{LONGITUDE_2\},$\{LATITUDE_2\} \\ - --scale $\{OSM_ZOOM_LEVEL\}} {bash} +\code {roentgen tile \\ + --boundary-box \formal {min longitude},\formal {min latitude},\formal {max longitude},\formal {max latitude} \\ + --scale \formal {OSM zoom level}} {bash} Boundary box will be extended to the boundaries of the minimal tile set that covers the area, then it will be extended a bit more to avoid some artifacts on the edges rounded to 3 digits after the decimal point. Map with new boundary box coordinates will be written to the cache directory as SVG and PNG files. All tiles will be stored as SVG files \m {out/tiles/tile___.svg} and PNG files \m {out/tiles/tile___.svg}, where \m {x} and \m {y} are tile coordinates. Example\: -\code {roentgen.py tile -b 2.361,48.871,2.368,48.875} {bash} +\code {roentgen tile -b 2.361,48.871,2.368,48.875} {bash} -will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files \m {cache/2.360,48.869,2.370,48.877.svg} and \m {cache/2.360,48.869,2.370,48.877.png}. +will generate 36 PNG tiles at scale 18 from tile 18/132791/90164 all the way to 18/132796/90169 and two cached files \m {cache/2.360,48.869,2.370,48.877.svg} and \m {cache/2.360,48.869,2.370,48.877.png}. + +\2 {Tile server} {tile-server} + +Command \m {server} is used to run tile server for slippy maps. + +\code {roentgen server} + +Stop server interrupting process with \kbd {Ctrl} + \kbd {C}. \2 {MapCSS 0.2 generation} {mapcss-0-2-generation} -Command\: \m {mapcss}. +Command \m {mapcss} is used to generate MapCSS scheme. \m {roentgen mapcss} will create \m {out/roentgen_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. -\m {python roentgen.py mapcss} will create \m {out/roentgen_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 only Röntgen icons run \m {python roentgen.py mapcss --no-ways}. +To create MapCSS with only Röntgen icons run \m {roentgen mapcss --no-ways}. \options {mapcss} \3 {Use Röntgen as JOSM map paint style} \list + {Run \m {roentgen 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 {+}.} {URL / File: set path to \m {out/roentgen_mapcss/roentgen.mapcss}.} - {\kbd {Ok} → \kbd {OK}.} To enable / disable Röntgen map paint style go to \kbd {View} → \kbd {Map Paint Styles} → \kbd {Röntgen}. diff --git a/roentgen/moire_manager.py b/roentgen/moire_manager.py index 8c63e4d..fd38a5c 100644 --- a/roentgen/moire_manager.py +++ b/roentgen/moire_manager.py @@ -29,17 +29,14 @@ def parse_text(text: str, margins: str, tag_id: str) -> Code: result: Code = [] inside: bool = False - for c in text: - if c in margins: - if word: - if not inside: - result.append(word) - else: - result.append(Tag(tag_id, [word])) - word = "" - inside = not inside - else: - word += c + for character in text: + if character not in margins: + word += character + continue + if word: + result.append(Tag(tag_id, [word]) if inside else word) + word = "" + inside = not inside if word: result.append(word) @@ -208,6 +205,10 @@ class RoentgenMoire(Default, ABC): """Keyboard key.""" return self.m(args) + def no_wrap(self, args: Arguments) -> str: + """Do not wrap text at white spaces.""" + return self.parse(args[0]) + class RoentgenHTML(RoentgenMoire, DefaultHTML): """ @@ -219,6 +220,7 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML): self.images: dict = {} def table(self, arg: Arguments) -> str: + """Simple table. First row is treated as header.""" content: str = "" cell: str = "".join( ["" + self.parse(td, inblock=True) + "" for td in arg[0]] @@ -252,7 +254,10 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML): def page_icon(self, args: Arguments) -> str: """HTML page icon.""" - return f'' + return ( + f'' + ) def no_wrap(self, args: Arguments) -> str: """Do not wrap text at white spaces.""" @@ -261,6 +266,7 @@ class RoentgenHTML(RoentgenMoire, DefaultHTML): ) def formal(self, args: Arguments) -> str: + """Formal variable.""" return f'{self.parse(args[0])}' @@ -323,3 +329,7 @@ class RoentgenMarkdown(RoentgenMoire, DefaultMarkdown): return ( f'{self.parse(args[0])}' ) + + def formal(self, args: Arguments) -> str: + """Formal variable.""" + return f"<{self.parse(args[0])}>" diff --git a/roentgen/ui.py b/roentgen/ui.py index aac3907..6aa7e5e 100644 --- a/roentgen/ui.py +++ b/roentgen/ui.py @@ -123,8 +123,8 @@ def add_render_arguments(parser: argparse.ArgumentParser) -> None: "-b", "--boundary-box", metavar=",,,", - help='geo boundary box, use space before "-" if the first value is ' - "negative", + help="geo boundary box; if first value is negative, enclose the value " + "with quotes and use space before `-`", ) parser.add_argument( "-s",