- 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]>
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
import re
|
|
|
|
from mistletoe.span_token import SpanToken
|
|
|
|
|
|
class NonbreakingSpaces(SpanToken):
|
|
"""
|
|
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"(?:\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) or match_object.group(3)
|
|
self.second = match_object.group(2) or match_object.group(4)
|
|
|
|
|
|
class NonbreakingSpacesDots(SpanToken):
|
|
"""
|
|
Insert unbreakable space before and after "..." if there is a space
|
|
Identifies "..." with leading and/or trailing space
|
|
"""
|
|
|
|
pattern = re.compile(r"(\s?)(\.\.\.)(\s?)")
|
|
|
|
def __init__(self, match_object):
|
|
self.first = match_object.group(1)
|
|
self.second = match_object.group(2)
|
|
self.third = match_object.group(3)
|