| 1 |
""" |
| 2 |
get_css_properties |
| 3 |
~~~~~~~~~~~~~~~~~~ |
| 4 |
|
| 5 |
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS. |
| 6 |
:license: BSD, see LICENSE for details. |
| 7 |
""" |
| 8 |
|
| 9 |
|
| 10 |
from pygments.util import format_lines |
| 11 |
import json |
| 12 |
import urllib.request |
| 13 |
|
| 14 |
HEADER = '''\ |
| 15 |
""" |
| 16 |
pygments.lexers._css_builtins |
| 17 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 18 |
|
| 19 |
This file is autogenerated by scripts/get_css_properties.py |
| 20 |
|
| 21 |
:copyright: Copyright 2006-present by the Pygments team, see AUTHORS. |
| 22 |
:license: BSD, see LICENSE for details. |
| 23 |
""" |
| 24 |
''' |
| 25 |
|
| 26 |
if __name__ == "__main__": |
| 27 |
data_request = urllib.request.urlopen('https://www.w3.org/Style/CSS/all-properties.en.json') |
| 28 |
data = json.load(data_request) |
| 29 |
names = set([p['property'] for p in data if p['property'] != '--*']) |
| 30 |
|
| 31 |
with open('../pygments/lexers/_css_builtins.py', 'w', encoding='utf-8') as builtin_file: |
| 32 |
builtin_file.write(HEADER) |
| 33 |
builtin_file.write(format_lines('_css_properties', sorted(names))) |