mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
Fix docs generation on Windows and search bar
This commit is contained in:
parent
c1ae7d67a9
commit
c11d71c3cd
|
@ -35,7 +35,8 @@ class DocsWriter:
|
||||||
Get the relative path for the given path from the current
|
Get the relative path for the given path from the current
|
||||||
file by working around https://bugs.python.org/issue20012.
|
file by working around https://bugs.python.org/issue20012.
|
||||||
"""
|
"""
|
||||||
return os.path.relpath(str(path), self._parent)
|
return os.path.relpath(
|
||||||
|
str(path), self._parent).replace(os.path.sep, '/')
|
||||||
|
|
||||||
# High level writing
|
# High level writing
|
||||||
def write_head(self, title, css_path, default_css):
|
def write_head(self, title, css_path, default_css):
|
||||||
|
@ -253,9 +254,10 @@ class DocsWriter:
|
||||||
self.write('<button onclick="cp(\'{}\');">{}</button>'
|
self.write('<button onclick="cp(\'{}\');">{}</button>'
|
||||||
.format(text_to_copy, text))
|
.format(text_to_copy, text))
|
||||||
|
|
||||||
def add_script(self, src='', relative_src=None):
|
def add_script(self, src='', path=None):
|
||||||
if relative_src:
|
if path:
|
||||||
self._script += '<script src="{}"></script>'.format(relative_src)
|
self._script += '<script src="{}"></script>'.format(
|
||||||
|
self._rel(path))
|
||||||
elif src:
|
elif src:
|
||||||
self._script += '<script>{}</script>'.format(src)
|
self._script += '<script>{}</script>'.format(src)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import functools
|
import functools
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
@ -401,7 +402,7 @@ def _write_html_pages(root, tlobjects, methods, layer, input_res):
|
||||||
|
|
||||||
depth = '../' * (2 if tlobject.namespace else 1)
|
depth = '../' * (2 if tlobject.namespace else 1)
|
||||||
docs.add_script(src='prependPath = "{}";'.format(depth))
|
docs.add_script(src='prependPath = "{}";'.format(depth))
|
||||||
docs.add_script(relative_src=paths['search.js'])
|
docs.add_script(path=paths['search.js'])
|
||||||
docs.end_body()
|
docs.end_body()
|
||||||
|
|
||||||
# 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)
|
||||||
|
@ -567,7 +568,8 @@ def _write_html_pages(root, tlobjects, methods, layer, input_res):
|
||||||
constructor_names = fmt(cs)
|
constructor_names = fmt(cs)
|
||||||
|
|
||||||
def fmt(xs, formatter):
|
def fmt(xs, formatter):
|
||||||
return ', '.join('"{}"'.format(formatter(x)) for x in xs)
|
return ', '.join('"{}"'.format(
|
||||||
|
formatter(x)).replace(os.path.sep, '/') for x in xs)
|
||||||
|
|
||||||
type_names = fmt(types, formatter=lambda x: x)
|
type_names = fmt(types, formatter=lambda x: x)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user