From 9428e73891da5f925addf49e08e97c289952239c Mon Sep 17 00:00:00 2001
From: Lonami Exo
Date: Sat, 8 Apr 2017 14:07:36 +0200
Subject: [PATCH] Core documentation index should really be at the root
---
docs/docs_writer.py | 5 ++++-
docs/generate.py | 7 ++-----
docs/generate_core.py | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/docs/docs_writer.py b/docs/docs_writer.py
index 2dbc5a58..750b0f92 100644
--- a/docs/docs_writer.py
+++ b/docs/docs_writer.py
@@ -227,7 +227,10 @@ class DocsWriter:
# With block
def __enter__(self):
# Sanity check
- os.makedirs(os.path.dirname(self.filename), exist_ok=True)
+ parent = os.path.dirname(self.filename)
+ if parent:
+ os.makedirs(parent, exist_ok=True)
+
self.handle = open(self.filename, 'w', encoding='utf-8')
return self
diff --git a/docs/generate.py b/docs/generate.py
index 159b53dd..537d41a3 100644
--- a/docs/generate.py
+++ b/docs/generate.py
@@ -70,7 +70,7 @@ def get_path_for_type(type, relative_to='.'):
this method works in the same way, returning a relative path"""
if type.lower() in {'int', 'long', 'int128', 'int256', 'double',
'vector', 'string', 'bool', 'true', 'bytes', 'date'}:
- path = 'core/index.html#%s' % type.lower()
+ path = 'index.html#%s' % type.lower()
elif '.' in type:
# If it's not a core type, then it has to be a custom Telegram type
@@ -178,7 +178,7 @@ def generate_documentation(scheme_file):
original_paths = {
'css': 'css/docs.css',
'arrow': 'img/arrow.svg',
- 'index_all': 'core/index.html',
+ 'index_all': 'index.html',
'index_types': 'types/index.html',
'index_methods': 'methods/index.html',
'index_constructors': 'constructors/index.html'
@@ -251,9 +251,6 @@ def generate_documentation(scheme_file):
docs.end_body()
- # TODO Explain the difference between functions, types and constructors
- # TODO Write the core/index.html containing the core types
- #
# Find all the available types (which are not the same as the constructors)
# Each type has a list of constructors associated to it, so it should be a map
print('Generating types documentation...')
diff --git a/docs/generate_core.py b/docs/generate_core.py
index 99a0b254..7212b288 100644
--- a/docs/generate_core.py
+++ b/docs/generate_core.py
@@ -15,7 +15,7 @@ def write_core_index(docs, tlobjects, layer):
types.clear()
# Write the head and the full HTML
- docs.write_head('Telethon API', relative_css_path='../css/docs.css')
+ docs.write_head('Telethon API', relative_css_path='css/docs.css')
# Welcome text, small explanation about this page
docs.write('''Telethon API
@@ -31,7 +31,7 @@ be useful for any other Telegram library out there.
'''
# Methods section
'''Methods
Currently there are {methodcount} methods available for the layer
-{layer}. The complete list can be seen here.
+{layer}. The complete list can be seen here.
To invoke any of these methods (also called requests), you can do
as shown on the following example:
'''
@@ -84,7 +84,7 @@ you're still able to invoke these methods manually.'''
# Types section
'''Types
Currently there are {typecount} types. You can see the full
-list here.
+list here.
The Telegram types are the abstract results that you receive
after invoking a request. They are "abstract" because they can have
@@ -99,7 +99,7 @@ an instance of it by using one of its, possibly multiple, constructors.
'''
# Constructors section
'''Constructors
Currently there are {constructorcount} constructors. You can see
-the full list here.
+the full list here.
Constructors are the way you can create instances of the abstract types
described above, and also the instances which are actually returned from