From 8af17c3ed5ed9ff760152eae059813cb120e1698 Mon Sep 17 00:00:00 2001
From: Dan <14043624+delivrance@users.noreply.github.com>
Date: Sun, 24 Apr 2022 11:56:07 +0200
Subject: [PATCH] Documentation improvements
---
README.md | 2 +-
compiler/docs/compiler.py | 3 +++
compiler/docs/template/toctree.txt | 2 ++
docs/Makefile | 3 +--
docs/source/conf.py | 10 +++++-----
docs/source/index.rst | 17 +++--------------
docs/source/topics/serializing.rst | 4 +---
7 files changed, 16 insertions(+), 25 deletions(-)
diff --git a/README.md b/README.md
index 45590867..76452676 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ If you'd like to support Pyrogram, you can consider:
- **Ready**: Install Pyrogram with pip and start building your applications right away.
- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
-- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance crypto library written in pure C.
+- **Fast**: Boosted up by [TgCrypto](https://github.com/pyrogram/tgcrypto), a high-performance cryptography library written in C.
- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
- **Powerful**: Full access to Telegram's API to execute any official client action and more.
diff --git a/compiler/docs/compiler.py b/compiler/docs/compiler.py
index cce4f769..dd857fc3 100644
--- a/compiler/docs/compiler.py
+++ b/compiler/docs/compiler.py
@@ -21,6 +21,8 @@ import os
import re
import shutil
+import pyrogram
+
HOME = "compiler/docs"
DESTINATION = "docs/source/telegram"
PYROGRAM_API_DEST = "docs/source/api"
@@ -112,6 +114,7 @@ def generate(source_path, base):
toctree.format(
title=k.title(),
title_markup="=" * len(k),
+ layer=pyrogram.raw.all.layer,
module=module,
entities="\n ".join(entities)
)
diff --git a/compiler/docs/template/toctree.txt b/compiler/docs/template/toctree.txt
index 717276c4..cc2ca9ac 100644
--- a/compiler/docs/template/toctree.txt
+++ b/compiler/docs/template/toctree.txt
@@ -1,6 +1,8 @@
{title}
{title_markup}
+Layer {layer}
+
.. module:: {module}
.. toctree::
diff --git a/docs/Makefile b/docs/Makefile
index 8eacc12a..c94d48cc 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -21,5 +21,4 @@ help:
lhtml: # live html
sphinx-autobuild --host $(shell ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2) \
- --watch ../pyrogram \
- -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
+ --watch ../pyrogram -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" $(SPHINXOPTS)
diff --git a/docs/source/conf.py b/docs/source/conf.py
index cb273c07..3071cdc1 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -49,7 +49,7 @@ master_doc = "index"
source_suffix = ".rst"
autodoc_member_order = "bysource"
-templates_path = ["_resources/templates"]
+templates_path = ["../resources/templates"]
html_copy_source = False
napoleon_use_rtype = False
@@ -63,7 +63,7 @@ suppress_warnings = ["image.not_readable"]
html_title = "Pyrogram Documentation"
html_theme = "sphinx_rtd_theme"
-html_static_path = ["_resources/static"]
+html_static_path = ["../resources/static"]
html_show_sourcelink = True
html_show_copyright = False
html_theme_options = {
@@ -75,11 +75,11 @@ html_theme_options = {
"style_external_links": True
}
-html_logo = "_resources/static/img/pyrogram.png"
-html_favicon = "_resources/static/img/favicon.ico"
+html_logo = "../resources/static/img/pyrogram.png"
+html_favicon = "../resources/static/img/favicon.ico"
latex_engine = "xelatex"
-latex_logo = "_resources/static/img/pyrogram.png"
+latex_logo = "../resources/static/img/pyrogram.png"
latex_elements = {
"pointsize": "12pt",
diff --git a/docs/source/index.rst b/docs/source/index.rst
index c3f5d352..93605f06 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -14,8 +14,8 @@ Welcome to Pyrogram
Telegram MTProto API Framework for Python
-
- Development
+
+ Website
•
@@ -54,17 +54,6 @@ If you'd like to support Pyrogram, you can consider:
- `Become a LiberaPay patron `_.
- `Become an OpenCollective backer `_.
-Key Features
-------------
-
-- **Ready**: Install Pyrogram with pip and start building your applications right away.
-- **Easy**: Makes the Telegram API simple and intuitive, while still allowing advanced usages.
-- **Elegant**: Low-level details are abstracted and re-presented in a more convenient way.
-- **Fast**: Boosted up by :doc:`TgCrypto `, a high-performance crypto library written in pure C.
-- **Type-hinted**: Types and methods are all type-hinted, enabling excellent editor support.
-- **Async**: Fully asynchronous (also usable synchronously if wanted, for convenience).
-- **Powerful**: Full access to Telegram's API to execute any official client action and more.
-
How the Documentation is Organized
----------------------------------
@@ -172,7 +161,7 @@ Meta
.. toctree::
:hidden:
- :caption: Telegram API
+ :caption: Telegram Raw API
telegram/functions/index
telegram/types/index
diff --git a/docs/source/topics/serializing.rst b/docs/source/topics/serializing.rst
index e12e3f05..6a8082b1 100644
--- a/docs/source/topics/serializing.rst
+++ b/docs/source/topics/serializing.rst
@@ -15,9 +15,7 @@ humans and another more compact for machines that is able to recover the origina
For Humans - str(obj)
---------------------
-If you want a nicely formatted, human readable JSON representation of any object in the API -- namely, any object from
-:doc:`Pyrogram types <../api/types/index>`, :doc:`raw functions <../telegram/functions/index>` and
-:doc:`raw types <../telegram/types/index>` -- you can use ``str(obj)``.
+If you want a nicely formatted, human readable JSON representation of any object in the API you can use ``str(obj)``.
.. code-block:: python