Swedish adaptation: Instegscertifikat and HAREC
- Editions replaced by INSTEG, HAREC and UPPGRADERING (Instegscertifikat -> HAREC) - Question pool optional; simulator, homework tool and solutions switch off without one - All UI strings, templates, renderers and project JS localised to sv-SE (decimal comma, Swedish non-breaking-space rules, Å/Ä/Ö in Morse table) - DARC branding, membership CTA and German links removed; attribution footer added - Page names centralised in src/pages.py - README and docs rewritten in Swedish Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -103,7 +103,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
return None
|
||||
|
||||
def render_quote(self, token):
|
||||
return f"„{self.render_inner(token)}“"
|
||||
return f"”{self.render_inner(token)}”"
|
||||
|
||||
def render_underline(self, token):
|
||||
return f"<u>{self.render_inner(token)}</u>"
|
||||
@@ -111,8 +111,8 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
@classmethod
|
||||
def render_unit(cls, token: Unit):
|
||||
unit = token.prefix + cls.convert_unit_helper(token.unit)
|
||||
if token.unit in ["°", "%"]:
|
||||
# Special cases with no space between value and unit.
|
||||
if token.unit == "°":
|
||||
# Special case with no space between value and unit.
|
||||
return f"{token.value}{unit}"
|
||||
else:
|
||||
# Default case is rendered with a narrow no-break space.
|
||||
@@ -120,6 +120,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
|
||||
units = {
|
||||
"Ohm": "Ω",
|
||||
"ohm": "Ω",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@@ -234,7 +235,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
return (
|
||||
f'<figure class="picture" id="ref_{marker}" name="{marker}">\n'
|
||||
f' <img src="pictures/{id}.svg" alt="{alt_text}">\n'
|
||||
f" <figcaption>Abbildung {label}: {text}</figcaption>\n"
|
||||
f" <figcaption>Figur {label}: {text}</figcaption>\n"
|
||||
"</figure>\n"
|
||||
)
|
||||
|
||||
@@ -243,7 +244,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
return f"""
|
||||
<figure class="photo" id="ref_{ref}" name="{ref}">
|
||||
<img src="photos/{id}.png" alt="{alt_text}">
|
||||
<figcaption>Abbildung {label}: {text}</figcaption>
|
||||
<figcaption>Figur {label}: {text}</figcaption>
|
||||
</figure>
|
||||
"""
|
||||
|
||||
@@ -276,7 +277,7 @@ class FiftyOhmHtmlRenderer(HtmlRenderer):
|
||||
caption_text = token.caption
|
||||
label = self._format_reference_label(token.name)
|
||||
if label:
|
||||
caption_text = f"Tabelle {label}: {token.caption}"
|
||||
caption_text = f"Tabell {label}: {token.caption}"
|
||||
table += f"<caption>{caption_text}</caption>\n"
|
||||
|
||||
table += "</table>"
|
||||
|
||||
@@ -5,11 +5,11 @@ from mistletoe.span_token import SpanToken
|
||||
|
||||
class HalfwidthSpaces(SpanToken):
|
||||
"""
|
||||
Insert halfwidth space into span token (Z. B.)
|
||||
Identifies "z.B.", "d.h." and "D.h." with and without space in between.
|
||||
Insert halfwidth space into span token (t. ex.)
|
||||
Identifies "t.ex." and "T.ex." with and without space in between.
|
||||
"""
|
||||
|
||||
pattern = re.compile(r"\b(z|Z|d|D)\.\s?(B|h)\.")
|
||||
pattern = re.compile(r"\b(t|T)\.\s?(ex)\.")
|
||||
|
||||
def __init__(self, match_object):
|
||||
self.first = match_object.group(1)
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ class Image(ReferencedToken):
|
||||
"""
|
||||
Block token for pictures and photos.
|
||||
Examples:
|
||||
[picture:727:amplitude_periode_halbwellen:Positive und negative Halbwellen einer Sinusschwingung]
|
||||
[photo:123:n_wasserfalldiagramm_trx_collage:Ansichten verschiedener Transceiver]
|
||||
[picture:727:amplitude_period_halvvagor:Positiva och negativa halvvågor hos en sinusvåg]
|
||||
[photo:123:n_vattenfall_trx_collage:Vyer av olika transceivrar]
|
||||
"""
|
||||
|
||||
pattern = re.compile(r"^\[(?P<kind>picture|photo):(?P<id>\d+):(?P<marker>[^:\]]+):(?P<text>[^:\]]+)\]$")
|
||||
|
||||
+2
-2
@@ -42,10 +42,10 @@ class Morse(SpanToken):
|
||||
"x": [dah, dit, dit, dah],
|
||||
"y": [dah, dit, dah, dah],
|
||||
"z": [dah, dah, dit, dit],
|
||||
"å": [dit, dah, dah, dit, dah],
|
||||
"ä": [dit, dah, dit, dah],
|
||||
"ö": [dah, dah, dah, dit],
|
||||
"ü": [dit, dit, dah, dah],
|
||||
"ß": [dit, dit, dit, dah, dah, dit, dit],
|
||||
"é": [dit, dit, dah, dit, dit],
|
||||
"0": [dah, dah, dah, dah, dah],
|
||||
"1": [dit, dah, dah, dah, dah],
|
||||
"2": [dit, dit, dah, dah, dah],
|
||||
|
||||
@@ -5,15 +5,16 @@ from mistletoe.span_token import SpanToken
|
||||
|
||||
class NonbreakingSpaces(SpanToken):
|
||||
"""
|
||||
Insert unbreakable space into span token (§ 3)
|
||||
Identifies "§$number", "Abs.$number", "Klasse [A,E,N]" w/ and without space between.
|
||||
Insert unbreakable space into span token (3 §)
|
||||
Identifies "$number §", "$number kap.", "$number st.", "$number mom." as well as
|
||||
"PTSFS $number", "Report $number", "Rec. $number" and "Bilaga $number" w/ and without space between.
|
||||
"""
|
||||
|
||||
pattern = re.compile(r"(§|Abs\.|Klasse)\s?(\d|[NEA])")
|
||||
pattern = re.compile(r"(?:\b(\d+)\s?(§|kap\.|st\.|mom\.)|\b(PTSFS|Report|Rec\.|Bilaga|bilaga)\s?(\d))")
|
||||
|
||||
def __init__(self, match_object):
|
||||
self.first = match_object.group(1)
|
||||
self.second = match_object.group(2)
|
||||
self.first = match_object.group(1) or match_object.group(3)
|
||||
self.second = match_object.group(2) or match_object.group(4)
|
||||
|
||||
|
||||
class NonbreakingSpacesDots(SpanToken):
|
||||
|
||||
+3
-2
@@ -9,8 +9,8 @@ class Unit(SpanToken):
|
||||
"Ah",
|
||||
"A/mm²",
|
||||
"baud",
|
||||
"Bit",
|
||||
"Bit/s",
|
||||
"bit",
|
||||
"bit/s",
|
||||
"dB",
|
||||
"dBi",
|
||||
"dBm",
|
||||
@@ -23,6 +23,7 @@ class Unit(SpanToken):
|
||||
"m",
|
||||
"m²",
|
||||
"Ohm",
|
||||
"ohm",
|
||||
"ppm",
|
||||
"pps",
|
||||
"s",
|
||||
|
||||
Reference in New Issue
Block a user