diff --git a/noshadows.py b/noshadows.py index 524e02c..fc31652 100644 --- a/noshadows.py +++ b/noshadows.py @@ -49,16 +49,25 @@ def skip_whitespace(nodes): return filter(lambda node: node.type != "whitespace", nodes) +SHADOW_CSS_PROPERTIES = { + "box-shadow", + "text-shadow", +} + + def has_shadow(rule): if not rule.content: return False for a, b, c in tripletwise(skip_whitespace(rule.content)): - if isinstance(a, tokens.IdentToken) and a.value == "box-shadow": + if isinstance(a, tokens.IdentToken) and a.value in SHADOW_CSS_PROPERTIES: assert isinstance( c, (tokens.IdentToken, tokens.DimensionToken, tokens.NumberToken) ), f"Unexpected node type {c.type}" - return isinstance(c, (tokens.DimensionToken, tokens.NumberToken)) + if isinstance(c, (tokens.DimensionToken, tokens.NumberToken)): + return True + + return False def find_shadow(rules): @@ -138,16 +147,21 @@ def test_skip_whitespace(self): ) # attr, colon, value, semicolon def test_has_shadow(self): - (rule,) = parse_stylesheet("html {box-shadow: 10px 5px 5px red;}") - self.assertTrue(has_shadow(rule)) - - def test_has_shadow_with_box_shadow_none(self): - (rule,) = parse_stylesheet("html {box-shadow: none;}") - self.assertFalse(has_shadow(rule)) - - def test_has_shadow_empty_rule(self): - (rule,) = parse_stylesheet("html {}") - self.assertFalse(has_shadow(rule)) + for expected, css in [ + (True, "html {box-shadow: 10px 5px 5px red;}"), + (True, "html {text-shadow: 1px 1px 2px pink;}"), + (True, "html {text-shadow: 5px 5px #558ABB;}"), + (False, "html {box-shadow: none;}"), + (False, "html {text-shadow: none;}"), + (True, "html {text-shadow: 5px 5px #558ABB; box-shadow: none;}"), + (True, "html {text-shadow: none; box-shadow: 10px 5px 5px red;}"), + (False, "html {}"), + (False, "html {color: red; font-weight: bold;}"), + ]: + with self.subTest(css=css, expected=expected): + (rule,) = parse_stylesheet(css) + assert_method = self.assertTrue if expected else self.assertFalse + assert_method(has_shadow(rule)) def test_selector_str_tag(self): (rule,) = parse_stylesheet("html {}") @@ -191,6 +205,7 @@ def test_selector_str_pseudoclass_nonstandard(self): // fit well with our design. @mixin noshadow { box-shadow: none; + text-shadow: none; border-radius: unset; } """ diff --git a/scss/_noshadows.scss b/scss/_noshadows.scss index b95f4de..ccc91e3 100644 --- a/scss/_noshadows.scss +++ b/scss/_noshadows.scss @@ -1,9 +1,10 @@ -// Generated by noshadows.py on 2024-01-18T15:52:50.928155 +// Generated by noshadows.py on 2024-01-26T15:44:23.711667 // Trac uses box-shadow and text-shadow everywhere but their 90s look doesn't // fit well with our design. @mixin noshadow { box-shadow: none; + text-shadow: none; border-radius: unset; } @@ -80,6 +81,7 @@ fieldset, #mainnav, div.trac-content, .foldable :link, .foldable :visited, +fieldset > legend.foldable :link, fieldset > legend.foldable :visited, #prefs, pre.wiki, pre.literal-block, table.wiki, diff --git a/scss/trachacks.scss b/scss/trachacks.scss index a7e5816..96061e8 100644 --- a/scss/trachacks.scss +++ b/scss/trachacks.scss @@ -71,10 +71,15 @@ div.trac-content { max-width: 1400px; } -#changelog h3 { +#ticketchange h3.change, #changelog h3.change { margin-top: 10px; margin-bottom: 5px; padding: 5px; + background: $green-very-light; + + &:target { + background: $green-light; + } } #changelog p { @@ -403,6 +408,7 @@ div[role="main"]{ tr { td { padding: 0.5em !important; // :( + text-indent: 0 !important; // Used on the /rpc page } } } diff --git a/trac-env/templates/django_theme.html b/trac-env/templates/django_theme.html index fb1292f..405d262 100644 --- a/trac-env/templates/django_theme.html +++ b/trac-env/templates/django_theme.html @@ -34,18 +34,19 @@ # if resourcepath_template: # include resourcepath_template ignore missing # endif + + # if chrome.ctxtnav:
+ # endif ${jmacros.warnings(chrome.warnings)}