mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 10:53:44 +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
|
||||
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
|
||||
|
||||
|
|
|
@ -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...')
|
||||
|
|
|
@ -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('''<h1>Telethon API</h1>
|
||||
|
@ -31,7 +31,7 @@ be useful for any other Telegram library out there.</p>'''
|
|||
# Methods section
|
||||
'''<h3 id="methods">Methods</h3>
|
||||
<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 />
|
||||
To invoke any of these methods (also called <i>requests</i>), you can do
|
||||
as shown on the following example:</p>'''
|
||||
|
@ -84,7 +84,7 @@ you're still able to invoke these methods manually.</p>'''
|
|||
# Types section
|
||||
'''<h3 id="types">Types</h3>
|
||||
<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
|
||||
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
|
||||
'''<h3 id="constructors">Constructors</h3>
|
||||
<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
|
||||
described above, and also the instances which are actually returned from
|
||||
|
|
Loading…
Reference in New Issue
Block a user