[geany/geany-osx] c0c744: Add a script to remove properties from css files
Jiří Techet
git-noreply at xxxxx
Thu Nov 18 21:25:06 UTC 2021
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Thu, 18 Nov 2021 21:25:06 UTC
Commit: c0c7449b60680b883a2dbdb4cdbca169bda87c0a
https://github.com/geany/geany-osx/commit/c0c7449b60680b883a2dbdb4cdbca169bda87c0a
Log Message:
-----------
Add a script to remove properties from css files
Modified Paths:
--------------
utils/remove_property.py
Modified: utils/remove_property.py
24 lines changed, 24 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+
+import sys
+
+# Quick and dirty script to remove all properties of the given name from a css file
+# Usage example: remove_property.py gtk.css "-gtk-icon-shadow"
+
+fname = sys.argv[1]
+property = sys.argv[2]
+
+with open(fname, 'r') as file:
+ data = file.read()
+
+pos1 = data.find(property)
+while pos1 != -1:
+ pos2 = data.find(';', pos1)
+ removed_str = data[pos1:pos2]
+ data = data[:pos1] + data[pos2+1:]
+ if removed_str.find('/*') != -1:
+ print('warning: comment inside removed string: ' + removed_str)
+ pos1 = data.find(property)
+
+with open(fname, "w") as file:
+ file.write(data)
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list