mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Core documentation index should really be at the root
This commit is contained in:
parent
df7f4bc47c
commit
9428e73891
|
@ -227,7 +227,10 @@ class DocsWriter:
|
||||||
# With block
|
# With block
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
# Sanity check
|
# 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')
|
self.handle = open(self.filename, 'w', encoding='utf-8')
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ def get_path_for_type(type, relative_to='.'):
|
||||||
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 type.lower() in {'int', 'long', 'int128', 'int256', 'double',
|
||||||
'vector', 'string', 'bool', 'true', 'bytes', 'date'}:
|
'vector', 'string', 'bool', 'true', 'bytes', 'date'}:
|
||||||
path = 'core/index.html#%s' % type.lower()
|
path = 'index.html#%s' % type.lower()
|
||||||
|
|
||||||
elif '.' in type:
|
elif '.' in type:
|
||||||
# If it's not a core type, then it has to be a custom Telegram 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 = {
|
original_paths = {
|
||||||
'css': 'css/docs.css',
|
'css': 'css/docs.css',
|
||||||
'arrow': 'img/arrow.svg',
|
'arrow': 'img/arrow.svg',
|
||||||
'index_all': 'core/index.html',
|
'index_all': 'index.html',
|
||||||
'index_types': 'types/index.html',
|
'index_types': 'types/index.html',
|
||||||
'index_methods': 'methods/index.html',
|
'index_methods': 'methods/index.html',
|
||||||
'index_constructors': 'constructors/index.html'
|
'index_constructors': 'constructors/index.html'
|
||||||
|
@ -251,9 +251,6 @@ def generate_documentation(scheme_file):
|
||||||
|
|
||||||
docs.end_body()
|
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)
|
# 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
|
# Each type has a list of constructors associated to it, so it should be a map
|
||||||
print('Generating types documentation...')
|
print('Generating types documentation...')
|
||||||
|
|
|
@ -15,7 +15,7 @@ def write_core_index(docs, tlobjects, layer):
|
||||||
types.clear()
|
types.clear()
|
||||||
|
|
||||||
# Write the head and the full HTML
|
# 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
|
# Welcome text, small explanation about this page
|
||||||
docs.write('''<h1>Telethon API</h1>
|
docs.write('''<h1>Telethon API</h1>
|
||||||
|
@ -31,7 +31,7 @@ be useful for any other Telegram library out there.</p>'''
|
||||||
# Methods section
|
# Methods section
|
||||||
'''<h3 id="methods">Methods</h3>
|
'''<h3 id="methods">Methods</h3>
|
||||||
<p>Currently there are <b>{methodcount} methods</b> available for the layer
|
<p>Currently there are <b>{methodcount} methods</b> available for the layer
|
||||||
{layer}. The complete list can be seen <a href="../methods/index.html">here</a>.
|
{layer}. The complete list can be seen <a href="methods/index.html">here</a>.
|
||||||
<br />
|
<br />
|
||||||
To invoke any of these methods (also called <i>requests</i>), you can do
|
To invoke any of these methods (also called <i>requests</i>), you can do
|
||||||
as shown on the following example:</p>'''
|
as shown on the following example:</p>'''
|
||||||
|
@ -84,7 +84,7 @@ you're still able to invoke these methods manually.</p>'''
|
||||||
# Types section
|
# Types section
|
||||||
'''<h3 id="types">Types</h3>
|
'''<h3 id="types">Types</h3>
|
||||||
<p>Currently there are <b>{typecount} types</b>. You can see the full
|
<p>Currently there are <b>{typecount} types</b>. You can see the full
|
||||||
list <a href="../types/index.html">here</a>.</p>
|
list <a href="types/index.html">here</a>.</p>
|
||||||
|
|
||||||
<p>The Telegram types are the <i>abstract</i> results that you receive
|
<p>The Telegram types are the <i>abstract</i> results that you receive
|
||||||
after invoking a request. They are "abstract" because they can have
|
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.</p>'''
|
||||||
# Constructors section
|
# Constructors section
|
||||||
'''<h3 id="constructors">Constructors</h3>
|
'''<h3 id="constructors">Constructors</h3>
|
||||||
<p>Currently there are <b>{constructorcount} constructors</b>. You can see
|
<p>Currently there are <b>{constructorcount} constructors</b>. You can see
|
||||||
the full list <a href="../constructors/index.html">here</a>.</p>
|
the full list <a href="constructors/index.html">here</a>.</p>
|
||||||
|
|
||||||
<p>Constructors are the way you can create instances of the abstract types
|
<p>Constructors are the way you can create instances of the abstract types
|
||||||
described above, and also the instances which are actually returned from
|
described above, and also the instances which are actually returned from
|
||||||
|
|
Loading…
Reference in New Issue
Block a user