convert comments to @.. notation

This commit is contained in:
Trilarion
2020-09-07 20:09:51 +02:00
parent 625871062f
commit ec233f2f6a
286 changed files with 336 additions and 344 deletions

View File

@ -11,6 +11,9 @@ https://github.com/cxong/cdogs-sdl
https://moaiwebsite.github.io/
http://cyxdown.free.fr/bs/
http://cyxdown.free.fr/f2b/
https://github.com/tlgkccampbell/ultraviolet
https://github.com/ianfab/Fairy-Stockfish
https://github.com/tomlooman/SimpleFPSTemplate
https://github.com/nfprojects/nfengine
http://dead-code.org/home/
http://e-adventure.e-ucm.es/login/index.php (games of eAdventure)

View File

@ -11,13 +11,6 @@ from bs4 import BeautifulSoup
from utils import constants as c, utils, osg, osg_github
def developer_info_lookup(name):
for dev in developer_info:
if name == dev['Name']:
return dev
return None
# author names in SF that aren't the author names how we have them
SF_alias_list = {'Erik Johansson (aka feneur)': 'Erik Johansson', 'Itms': 'Nicolas Auvray',
'Wraitii': 'Lancelot de Ferrière', 'Simzer': 'Simon Laszlo', 'armin bajramovic': 'Armin Bajramovic'}
@ -123,46 +116,6 @@ def test():
# store developer info
utils.write_text(os.path.join(c.root_path, 'collected_developer_info.txt'), developers)
def compare_entries_developers(entries, developers):
"""
Cross checks the game entries lists and the developers lists.
:param entries: List of game entries
:param developers: List of developers
"""
# from the entries create a dictionary with developer names
devs1 = {}
for entry in entries:
name = entry['Name']
for dev in entry.get('developer', []):
if dev in devs1:
devs1[dev].append(name)
else:
devs1[dev] = [name]
devs1_names = set(devs1.keys())
# from the developers create a dictionary with developer names
devs2 = dict(zip((dev['Name'] for dev in developers), (dev['Games'] for dev in developers)))
devs2_names = set(devs2.keys())
# devs only in entries
for dev in devs1_names - devs2_names:
print('Warning: dev "{}" only in entries ({}), not in developers'.format(dev, ','.join(devs1[dev])))
# devs only in developers
for dev in devs2_names - devs1_names:
print('Warning: dev "{}" only in developers ({}), not in entries'.format(dev, ','.join(devs2[dev])))
# for those in both, check that the games lists are equal
for dev in devs1_names.intersection(devs2_names):
games1 = set(devs1[dev])
games2 = set(devs2[dev])
delta = games1 - games2
if delta:
print('Warning: dev "{}" has games in entries ({}) that are not present in developers'.format(dev,
', '.join(
delta)))
delta = games2 - games1
if delta:
print('Warning: dev "{}" has games in developers ({}) that are not present in entries'.format(dev, delta))
class DevelopersMaintainer:

View File

@ -41,6 +41,10 @@ valid_properties = ('Home', 'Media', 'Inspirations', 'State', 'Play', 'Download'
# only these fields can be used currently (in this order)
valid_fields = ('File', 'Title') + valid_properties + ('Note', 'Building')
url_fields = ('Home', 'Media', 'Play', 'Download', 'Code repository')
valid_url_prefixes = ('http://', 'https://', 'git://', 'svn://', 'ftp://', 'bzr://', '@see-')
valid_building_properties = ('Build system', 'Build instructions')
valid_building_fields = valid_building_properties + ('Note',)

View File

@ -534,13 +534,12 @@ def check_and_process_entry(entry):
d[field] = value
building = d
# check valid fields TODO should also check order
# check valid fields in building TODO should also check order
for field in building.keys():
if field not in valid_building_fields:
message += 'Building field "{}" invalid\n'.format(field)
entry['Building'] = building
# check canonical file name
file = entry['File']
canonical_file_name = canonical_entry_name(entry['Title']) + '.md'
@ -548,11 +547,38 @@ def check_and_process_entry(entry):
if canonical_file_name != file and canonical_file_name != file[:-5] + '.md':
message += 'file name should be {}\n'.format(canonical_file_name)
# state must contain either beta or mature but not both
state = entry['State']
for t in state:
if t != 'beta' and t != 'mature' and not t.startswith('inactive since '):
message += 'Unknown state "{}"'.format(t)
if 'beta' in state == 'mature' in state:
message += 'State must be one of <"beta", "mature">'
# check urls
for field in url_fields:
values = entry.get(field, [])
for value in values:
if value.value.startswith('<') and value.value.endswith('>'):
value.value = value.value[1:-1]
if not any(value.startswith(x) for x in valid_url_prefixes):
message += 'URL "{}" in field "{}" does not start with a valid prefix'.format(value, field)
if message:
raise RuntimeError(message)
return entry
def extract_inactive_year(entry):
state = entry['State']
phrase = 'inactive since '
inactive_year = [x[len(phrase):] for x in state if x.startswith(phrase)]
assert len(inactive_year) <= 1
if inactive_year:
return inactive_year[0]
else:
return None
def write_entries(entries):
"""

View File

@ -14,7 +14,7 @@ class ListingTransformer(lark.Transformer):
"""
def unquoted_value(self, x):
return x[0].value
return x[0].value.strip()
def quoted_value(self, x):
return x[0].value[1:-1].strip() # remove quotation marks and strip whitespaces
@ -33,7 +33,7 @@ class ListingTransformer(lark.Transformer):
:param x:
:return:
"""
return 'Name', x[0].value
return 'Name', x[0].value.strip()
def entry(self, x):
"""
@ -56,13 +56,13 @@ class ListingTransformer(lark.Transformer):
class EntryTransformer(lark.Transformer):
def unquoted_value(self, x):
return x[0].value
return x[0].value.strip()
def quoted_value(self, x):
return x[0].value[1:-1] # remove quotation marks
return x[0].value[1:-1].strip() # remove quotation marks
def comment_value(self, x):
return x[0].value[1:-1] # remove parenthesis
return x[0].value[1:-1].strip() # remove parenthesis
def value(self, x):
if len(x) == 1:
@ -77,10 +77,10 @@ class EntryTransformer(lark.Transformer):
:param x:
:return:
"""
return x[0].value, x[1:]
return x[0].value.strip(), x[1:]
def title(self, x):
return 'Title', x[0].value
return 'Title', x[0].value.strip()
def note(self, x):
"""
@ -109,6 +109,12 @@ class ValueWithComment:
self.value = value
self.comment = comment
def is_empty(self):
return self.value == ''
def startswith(self, str):
return self.value.startswith(str)
def __contains__(self, item):
return item in self.value