Add and copy 404.html to the generated docs

This commit is contained in:
Lonami Exo 2017-09-24 13:40:54 +02:00
parent d5ba259d4e
commit 9787fb8c46
2 changed files with 53 additions and 6 deletions

View File

@ -218,6 +218,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',
'404': '404.html',
'index_all': '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',
@ -540,8 +541,10 @@ def generate_documentation(scheme_file):
'constructor_urls': constructor_urls 'constructor_urls': constructor_urls
} }
with open('../res/core.html') as infile: shutil.copy('../res/404.html', original_paths['404'])
with open(original_paths['index_all'], 'w') as outfile:
with open('../res/core.html') as infile,\
open(original_paths['index_all'], 'w') as outfile:
text = infile.read() text = infile.read()
for key, value in replace_dict.items(): for key, value in replace_dict.items():
text = text.replace('{' + key + '}', str(value)) text = text.replace('{' + key + '}', str(value))

44
docs/res/404.html Normal file
View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html><head>
<title>Oopsie! | Telethon</title>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
body {
background-color: #f0f4f8;
font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
div {
width: 560px;
margin: 5em auto;
padding: 50px;
background-color: #fff;
border-radius: 1em;
}
a:link, a:visited {
color: #38488f;
text-decoration: none;
}
@media (max-width: 700px) {
body {
background-color: #fff;
}
div {
width: auto;
margin: 0 auto;
border-radius: 0;
padding: 1em;
}
}
</style>
</head>
<body>
<div>
<h1>You seem a bit lost…</h1>
<p>You seem to be lost! Don't worry, that's just Telegram's API being
itself. Shall we go back to the <a href="index.html">Main Page</a>?</p>
</div>
</body>
</html>