diff --git a/docs/generate.py b/docs/generate.py index ec5d5574..424fb24b 100644 --- a/docs/generate.py +++ b/docs/generate.py @@ -339,17 +339,34 @@ def generate_documentation(scheme_file): types.add(tlobject.result) + types = sorted(types) + methods = sorted(methods, key=lambda m: m.name) + + request_names = ', '.join('"' + get_class_name(m) + '"' for m in methods) + type_names = ', '.join('"' + get_class_name(t) + '"' for t in types) + + request_urls = ', '.join('"' + get_create_path_for(m) + '"' for m in methods) + type_urls = ', '.join('"' + get_path_for_type(t) + '"' for t in types) + replace_dict = { 'type_count': len(types), 'method_count': len(methods), 'constructor_count': len(methods) - len(tlobjects), - 'layer': layer + 'layer': layer, + + 'request_names': request_names, + 'type_names': type_names, + 'request_urls': request_urls, + 'type_urls': type_urls } with open('../res/core.html') as infile: with open(original_paths['index_all'], 'w') as outfile: - outfile.write(infile.read() - .format_map(replace_dict)) + text = infile.read() + for key, value in replace_dict.items(): + text = text.replace('{' + key + '}', str(value)) + + outfile.write(text) # Everything done print('Documentation generated.') diff --git a/docs/res/core.html b/docs/res/core.html index 6dcec346..d36f11d2 100644 --- a/docs/res/core.html +++ b/docs/res/core.html @@ -6,9 +6,22 @@ +
+ + +
+
+
+ +

Telethon API

This documentation was generated straight from the scheme.tl provided by Telegram. However, there is no official documentation per se @@ -140,5 +153,71 @@ messages = result.messages

+ + diff --git a/docs/res/css/docs.css b/docs/res/css/docs.css index d8e9feb1..e41e5da8 100644 --- a/docs/res/css/docs.css +++ b/docs/res/css/docs.css @@ -108,6 +108,20 @@ span.sh4 { color: #06c; } +#searchBox { + width: 100%; + border: none; + height: 20px; + padding: 8px; + font-size: 16px; + border-radius: 2px; + border: 2px solid #ddd; +} + +#searchBox:placeholder-shown { + font-style: italic; +} + @media (max-width: 640px) { h1 { font-size: 18px;