summaryrefslogtreecommitdiffstats
path: root/scripts/get_css_properties.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
commit1f403ad2197fc7442409f434ee574f3e6b46fb73 (patch)
tree0299c6dd11d5edfa918a29b6456bc1875f1d288c /scripts/get_css_properties.py
parentInitial commit. (diff)
downloadpygments-upstream.tar.xz
pygments-upstream.zip
Adding upstream version 2.14.0+dfsg.upstream/2.14.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/get_css_properties.py')
-rw-r--r--scripts/get_css_properties.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/get_css_properties.py b/scripts/get_css_properties.py
new file mode 100644
index 0000000..3afe98e
--- /dev/null
+++ b/scripts/get_css_properties.py
@@ -0,0 +1,33 @@
+"""
+ get_css_properties
+ ~~~~~~~~~~~~~~~~~~
+
+ :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+
+
+from pygments.util import format_lines
+import json
+import urllib.request
+
+HEADER = '''\
+"""
+ pygments.lexers._css_builtins
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ This file is autogenerated by scripts/get_css_properties.py
+
+ :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+"""
+'''
+
+if __name__ == "__main__":
+ data_request = urllib.request.urlopen('https://www.w3.org/Style/CSS/all-properties.en.json')
+ data = json.load(data_request)
+ names = set([p['property'] for p in data if p['property'] != '--*'])
+
+ with open('../pygments/lexers/_css_builtins.py', 'w') as builtin_file:
+ builtin_file.write(HEADER)
+ builtin_file.write(format_lines('_css_properties', sorted(names)))