SF.net SVN: docutils:[10024] trunk/docutils/docutils

aa-turner--- via Docutils-checkins <[email protected]> Sat, 08 Mar 2025 00:20:23 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10024
          http://sourceforge.net/p/docutils/code/10024
Author:   aa-turner
Date:     2025-03-08 00:20:22 +0000 (Sat, 08 Mar 2025)
Log Message:
-----------
Resolve Ruff lint warnings

Modified Paths:
--------------
    trunk/docutils/docutils/nodes.py
    trunk/docutils/docutils/writers/_html_base.py

Modified: trunk/docutils/docutils/nodes.py
===================================================================
--- trunk/docutils/docutils/nodes.py	2025-03-07 23:06:43 UTC (rev 10023)
+++ trunk/docutils/docutils/nodes.py	2025-03-08 00:20:22 UTC (rev 10024)
@@ -3195,7 +3195,7 @@
         value = 1
     else:
         try:
-            value, unit = parse_measure(measure, unit_pattern='[*]?')
+            value, _unit = parse_measure(measure, unit_pattern='[*]?')
         except ValueError:
             value = -1
     if value <= 0:

Modified: trunk/docutils/docutils/writers/_html_base.py
===================================================================
--- trunk/docutils/docutils/writers/_html_base.py	2025-03-07 23:06:43 UTC (rev 10023)
+++ trunk/docutils/docutils/writers/_html_base.py	2025-03-08 00:20:22 UTC (rev 10024)
@@ -495,11 +495,14 @@
         # Apply image node attributes:
         if 'style' in atts:
             # update style declarations
-            style_att = f"{svg.get('style', '')}; {atts['style']}"
-            style_att = [d.partition(':') for d in style_att.split(';')
-                         if d.strip()]
-            style_att = dict((k.strip(), v.strip()) for k, p, v in style_att)
-            style_att = ' '.join(f'{k}: {v};' for k, v in style_att.items())
+            clean_atts = {}
+            style_atts = [svg.get('style', '')] + atts['style'].split(';')
+            for att in style_atts:
+                if not att.strip():
+                    continue
+                key, _, value = att.partition(':')
+                clean_atts[key.strip()] = value.strip()
+            style_att = ' '.join(f'{k}: {v};' for k, v in clean_atts.items())
             svg.set('style', style_att)
         for dimension in ('width', 'height'):
             if dimension in atts:

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.