mirror of
https://github.com/enzet/map-machine.git
synced 2025-05-21 13:06:25 +02:00
Add Moire parser extension for HTML.
This commit is contained in:
parent
6635cf8b5b
commit
bcc8680f5a
1 changed files with 36 additions and 1 deletions
|
@ -5,7 +5,7 @@ import argparse
|
|||
from abc import ABC
|
||||
|
||||
from moire.moire import Tag
|
||||
from moire.default import Default, DefaultMarkdown, DefaultWiki
|
||||
from moire.default import Default, DefaultHTML, DefaultMarkdown, DefaultWiki
|
||||
|
||||
from roentgen.icon import ShapeExtractor
|
||||
from pathlib import Path
|
||||
|
@ -120,6 +120,41 @@ class RoentgenMoire(Default, ABC):
|
|||
raise NotImplementedError
|
||||
|
||||
|
||||
class RoentgenHTML(RoentgenMoire, DefaultHTML):
|
||||
"""
|
||||
Simple HTML.
|
||||
"""
|
||||
|
||||
images = {}
|
||||
|
||||
def osm(self, args: Arguments) -> str:
|
||||
"""OSM tag key or key–value pair of tag."""
|
||||
return osm(self, args)
|
||||
|
||||
def color(self, args: Arguments) -> str:
|
||||
"""Simple color sample."""
|
||||
return (
|
||||
f'<span class="color" '
|
||||
f'style="background-color: {self.clear(args[0])};"></span>'
|
||||
)
|
||||
|
||||
def icon(self, args: Arguments) -> str:
|
||||
"""Image with Röntgen icon."""
|
||||
size: str = self.clear(args[1]) if len(args) > 1 else 16
|
||||
return (
|
||||
f'<img class="icon" style="width: {size}px; height: {size}px;" '
|
||||
f'src="icon_set/ids/{self.clear(args[0])}.svg" />'
|
||||
)
|
||||
|
||||
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]))
|
||||
|
||||
|
||||
class RoentgenOSMWiki(RoentgenMoire, DefaultWiki):
|
||||
"""
|
||||
OpenStreetMap wiki.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue