style(coach): italic square names instead of a gold box
public
style(coach): italic square names instead of a gold box Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| Changeset | 3415dd0b7179fbd9bd10e7bdb1e384fa861da36b |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@nullachtvierzehn.de>, |
| Parents | b21cd2b69a71 |
| Children | 7448e7956cae |
| Pushlog | by timo via ssh by timo via ssh |
modified schach/training.py +2 −2
| @@ -101,12 +101,12 @@ TAG_RE = re.compile(r"(<[^>]*>)") | ||
| 101 | 101 | |
| 102 | 102 | |
| 103 | 103 | def mark_squares(markup): |
| 104 | - """Feldnamen im Pango-Markup blassgelb hinterlegen – wie das goldene Leuchten auf dem Brett.""" | |
| 104 | + """Feldnamen im Pango-Markup kursiv setzen: Maus darüber, und das Feld leuchtet auf dem Brett.""" | |
| 105 | 105 | parts = TAG_RE.split(markup) |
| 106 | 106 | for i in range(0, len(parts), 2): # gerade Stellen sind Text, ungerade Tags |
| 107 | 107 | text = parts[i] |
| 108 | 108 | for start, end, _sq in reversed(squares_in(text)): |
| 109 | - text = (f"{text[:start]}<span bgcolor='#f5c219' bgalpha='35%'>{text[start:end]}</span>" | |
| 109 | + text = (f"{text[:start]}<i>{text[start:end]}</i>" | |
| 110 | 110 | f"{text[end:]}") |
| 111 | 111 | parts[i] = text |
| 112 | 112 | return "".join(parts) |
modified tests/test_opening.py +2 −2
| @@ -215,5 +215,5 @@ class SquareNamesTest(unittest.TestCase) | ||
| 215 | 215 | from schach.training import mark_squares |
| 216 | 216 | out = mark_squares("<span alpha='70%'>Warum?</span>\n<b>3. Lc4</b> – auf f7") |
| 217 | 217 | self.assertIn("<span alpha='70%'>Warum?</span>", out) |
| 218 | - self.assertEqual(out.count("bgcolor"), 2) | |
| 219 | - self.assertIn(">c4</span></b>", out) | |
| 218 | + self.assertEqual(out.count("<i>"), 2) | |
| 219 | + self.assertIn("<i>c4</i></b>", out) | |