diff --git a/Elternbeirat.Web.Tests/RouteSmokeTests.cs b/Elternbeirat.Web.Tests/RouteSmokeTests.cs index 888f739..e30c7c8 100644 --- a/Elternbeirat.Web.Tests/RouteSmokeTests.cs +++ b/Elternbeirat.Web.Tests/RouteSmokeTests.cs @@ -239,7 +239,7 @@ public sealed partial class RouteSmokeTests : IDisposable var client = _factory.CreateClient(); var posts = await client.GetStringAsync(new Uri("/posts", UriKind.Relative)); - posts.ShouldContain("Beiträge"); // heading from the page title + WebUtility.HtmlDecode(posts).ShouldContain("Beiträge"); // heading from the page title; the "ä" is encoded posts.ShouldContain("Neuigkeiten aus dem Elternbeirat."); // the page body var events = await client.GetStringAsync(new Uri("/events", UriKind.Relative)); @@ -375,8 +375,9 @@ public sealed partial class RouteSmokeTests : IDisposable html.ShouldContain(">Willkommen"); html.ShouldNotContain(">Elternbeirat der IGMH"); // the fallback title - html.ShouldContain(""""""); - html.ShouldContain(""""""); + // Scoped CSS adds a b-… attribute after href, so the tag is not closed there. + html.ShouldMatch("""]"""); + html.ShouldMatch("""]"""); } [Fact] @@ -441,7 +442,7 @@ public sealed partial class RouteSmokeTests : IDisposable var html = await client.GetStringAsync(new Uri("/events", UriKind.Relative)); Regex.Count(html, Regex.Escape("Sitzungen und Veranstaltungen auf einen Blick.")).ShouldBe(1); - html.ShouldContain(""""""); + html.ShouldMatch("""]"""); html.ShouldContain("Kalender abonnieren"); } @@ -450,14 +451,15 @@ public sealed partial class RouteSmokeTests : IDisposable { var client = _factory.CreateClient(); - var html = await client.GetStringAsync(new Uri("/events", UriKind.Relative)); + // Decoded because the dash in "20.–22. Juli" is written as an entity. + var html = WebUtility.HtmlDecode(await client.GetStringAsync(new Uri("/events", UriKind.Relative))); var past = PastEvents().Match(html); past.Success.ShouldBeTrue(); past.Value.ShouldContain("Vergangene Termine anzeigen (2)"); past.Value.ShouldContain("Infoabend Klasse 5"); past.Value.ShouldNotContain("Elternbeiratssitzung"); // upcoming, not past - past.Value.ShouldContain("""

2026

"""); + past.Value.ShouldMatch("""

]*>2026

"""); past.Value.ShouldContain("10. September"); // day without weekday or year past.Value.ShouldContain("19:00 Uhr"); // the time stays, after the title past.Value.ShouldContain("20.–22. Juli"); // several days as a span diff --git a/Elternbeirat.Web/Features/Events/EventDateFormat.cs b/Elternbeirat.Web/Features/Events/EventDateFormat.cs index 5c4051d..495f998 100644 --- a/Elternbeirat.Web/Features/Events/EventDateFormat.cs +++ b/Elternbeirat.Web/Features/Events/EventDateFormat.cs @@ -34,6 +34,15 @@ public static class EventDateFormat /// private const string DayMonth = "d. MMMM"; + /// + /// The short months for the calendar sheet, January first, without periods. + /// + /// + /// Fixed here so they do not depend on the host's ICU version; see . + /// + private static readonly string[] SheetMonths = + ["Jan", "Feb", "März", "Apr", "Mai", "Juni", "Juli", "Aug", "Sept", "Okt", "Nov", "Dez"]; + /// /// Formats the date range of an event. /// @@ -76,10 +85,16 @@ public static class EventDateFormat /// /// Returned in normal case; the sheet's CSS sets it in capitals. The period of the /// abbreviation (Okt.) is dropped because on a sheet it reads as a stray dot. + /// + /// Taken from , not from the culture's MMM + /// format: that comes from the ICU data of the host, and newer CLDR versions + /// abbreviate March as Mär. instead of März, so the sheet + /// would change with the base image. + /// /// /// public static string SheetMonth(DateTime value) - => value.ToString("MMM", Cultures.German).TrimEnd('.'); + => SheetMonths[value.Month - 1]; /// /// The day of the month for the large number on a calendar sheet. diff --git a/Elternbeirat.Web/Shared/Markdown.cs b/Elternbeirat.Web/Shared/Markdown.cs index f87c5f8..498a7b1 100644 --- a/Elternbeirat.Web/Shared/Markdown.cs +++ b/Elternbeirat.Web/Shared/Markdown.cs @@ -108,8 +108,9 @@ public static partial class Markdown /// a list or a ::: block is rarely a sentence that describes the page. /// /// A sentence ends at ., ! or ? followed by a space or - /// the end. A period after a single letter or a number does not count, so - /// z. B. and 13. November do not cut the sentence short. A + /// the end. A period after a single letter or a number of one or two digits + /// does not count, so z. B. and 13. November do not cut the + /// sentence short, while a year such as 2025. still ends it. A /// longer abbreviation such as bzw. still does; that costs the rest /// of a teaser, never the page. /// @@ -276,10 +277,11 @@ public static partial class Markdown /// /// Matches the end mark of a sentence: ., ! or ? before a - /// space or the end, unless it follows a lone letter (z.) or a number - /// (13.). + /// space or the end, unless it follows a lone letter (z.) or an ordinal + /// of one or two digits (13.). A longer number is a year (2025.), + /// which German does not use as an ordinal, so its period ends the sentence. /// - [GeneratedRegex(@"(?