diff --git a/docs/.gitignore b/docs/.gitignore index 46f739f0..f4277e00 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,4 +1,4 @@ constructors/ -functions/ +methods/ types/ core/ diff --git a/docs/css/docs.css b/docs/css/docs.css index 3ac8a3e0..1bcea661 100644 --- a/docs/css/docs.css +++ b/docs/css/docs.css @@ -95,7 +95,7 @@ pre::-webkit-scrollbar-thumb:horizontal { #dev_page_content_wrap { padding-top: 12px; } - + #dev_page_title { margin-top: 10px; margin-bottom: 20px; diff --git a/docs/generate.py b/docs/generate.py index 5f110dbf..868eb416 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -69,13 +69,14 @@ def write_code(file, tlobject, filename): def get_class_name(tlobject): """Gets the class name following the Python style guidelines, in ThisClassFormat""" # Courtesy of http://stackoverflow.com/a/31531797/4759433 - result = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), tlobject.name) + name = tlobject.name if isinstance(tlobject, TLObject) else tlobject + result = re.sub(r'_([a-z])', lambda m: m.group(1).upper(), name) # Replace '_' with '' once again to make sure it doesn't appear on the name result = result[:1].upper() + result[1:].replace('_', '') # If it's a function, let it end with "Request" to identify them more easily - if tlobject.is_function: + if isinstance(tlobject, TLObject) and tlobject.is_function: result += 'Request' return result @@ -104,7 +105,7 @@ def get_create_path_for(tlobject): for the given 'tlobject', relative to nothing; only its local path""" # Determine the output directory - out_dir = 'functions' if tlobject.is_function else 'constructors' + out_dir = 'methods' if tlobject.is_function else 'constructors' if tlobject.namespace: out_dir = os.path.join(out_dir, tlobject.namespace) @@ -116,7 +117,7 @@ def get_create_path_for(tlobject): return os.path.join(out_dir, get_file_name(tlobject, add_extension=True)) -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 to have the TLObject itself but rather its name (the type); this method works in the same way, returning a relative path""" @@ -149,13 +150,13 @@ def get_relative_paths(original, relative_to): def generate_documentation(scheme_file): - """Generates the documentation HTML files from from scheme.tl to /functions and /types""" + """Generates the documentation HTML files from from scheme.tl to /methods and /constructors, etc.""" original_paths = { 'css': 'css/docs.css', 'arrow': 'img/arrow.svg', 'index_all': 'core/index.html', 'index_types': 'types/index.html', - 'index_functions': 'functions/index.html', + 'index_methods': 'methods/index.html', 'index_constructors': 'constructors/index.html' } @@ -200,9 +201,9 @@ def generate_documentation(scheme_file): file.write('' % paths['arrow']) file.write('