Docs should not let core types be searched

This commit is contained in:
Lonami Exo 2017-07-08 13:35:10 +02:00
parent 4563875ab5
commit 5f19f22d46

View File

@ -75,12 +75,19 @@ def get_create_path_for(tlobject):
return os.path.join(out_dir, get_file_name(tlobject, add_extension=True)) return os.path.join(out_dir, get_file_name(tlobject, add_extension=True))
def is_core_type(type_):
"""Returns "true" if the type is considered a core type"""
return type_.lower() in {
'int', 'long', 'int128', 'int256', 'double',
'vector', 'string', 'bool', 'true', 'bytes', 'date'
}
def get_path_for_type(type_, relative_to='.'): def get_path_for_type(type_, relative_to='.'):
"""Similar to getting the path for a TLObject, it might not be possible """Similar to getting the path for a TLObject, it might not be possible
to have the TLObject itself but rather its name (the type); to have the TLObject itself but rather its name (the type);
this method works in the same way, returning a relative path""" this method works in the same way, returning a relative path"""
if type_.lower() in {'int', 'long', 'int128', 'int256', 'double', if is_core_type(type_):
'vector', 'string', 'bool', 'true', 'bytes', 'date'}:
path = 'index.html#%s' % type_.lower() path = 'index.html#%s' % type_.lower()
elif '.' in type_: elif '.' in type_:
@ -440,7 +447,11 @@ def generate_documentation(scheme_file):
else: else:
constructors.append(tlobject) constructors.append(tlobject)
types.add(tlobject.result) if not is_core_type(tlobject.result):
if re.search('^vector<', tlobject.result, re.IGNORECASE):
types.add(tlobject.result.split('<')[1].strip('>'))
else:
types.add(tlobject.result)
types = sorted(types) types = sorted(types)
methods = sorted(methods, key=lambda m: m.name) methods = sorted(methods, key=lambda m: m.name)