Update docs: add release notes from GitHub
This commit is contained in:
parent
a35e2620f8
commit
0ea512bbc3
80
docs/releases.py
Normal file
80
docs/releases.py
Normal file
@ -0,0 +1,80 @@
|
||||
# Pyrogram - Telegram MTProto API Client Library for Python
|
||||
# Copyright (C) 2017-2019 Dan Tès <https://github.com/delivrance>
|
||||
#
|
||||
# This file is part of Pyrogram.
|
||||
#
|
||||
# Pyrogram is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Pyrogram is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import shutil
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
import pypandoc
|
||||
import requests
|
||||
|
||||
URL = "https://api.github.com/repos/pyrogram/pyrogram/releases"
|
||||
DEST = Path("source/releases")
|
||||
INTRO = """
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
Release notes for Pyrogram releases will describe what's new in each version, and will also make you aware of any
|
||||
backwards-incompatible changes made in that version.
|
||||
|
||||
When upgrading to a new version of Pyrogram, you will need to check all the breaking changes in order to find
|
||||
incompatible code in your application, but also to take advantage of new features and improvements.
|
||||
|
||||
Releases
|
||||
--------
|
||||
|
||||
""".lstrip("\n")
|
||||
|
||||
shutil.rmtree(DEST, ignore_errors=True)
|
||||
DEST.mkdir(parents=True)
|
||||
|
||||
releases = requests.get(URL).json()
|
||||
|
||||
with open(DEST / "index.rst", "w") as index:
|
||||
index.write(INTRO)
|
||||
|
||||
tags = []
|
||||
|
||||
for release in releases:
|
||||
tag = release["tag_name"]
|
||||
title = release["name"]
|
||||
name = title.split(" - ")[1]
|
||||
|
||||
date = datetime.strptime(
|
||||
release["published_at"],
|
||||
"%Y-%m-%dT%H:%M:%SZ"
|
||||
).strftime("%b %d, %Y - %H:%M:%S (UTC)")
|
||||
|
||||
body = pypandoc.convert_text(
|
||||
release["body"].replace(r"\r\n", "\n"),
|
||||
"rst",
|
||||
format="markdown_github",
|
||||
extra_args=["--wrap=none"]
|
||||
)
|
||||
|
||||
index.write("- :doc:`{} <{}>`\n".format(title, tag))
|
||||
tags.append(tag)
|
||||
|
||||
with open(DEST / "{}.rst".format(tag), "w") as page:
|
||||
page.write("Pyrogram " + tag + "\n" + "=" * (len(tag) + 9) + "\n\n")
|
||||
page.write("--- *Released on " + str(date) + "*\n\n")
|
||||
page.write(name + "\n" + "-" * len(name) + "\n\n")
|
||||
page.write(body + "\n\n")
|
||||
|
||||
index.write("\n.. toctree::\n :hidden:\n\n")
|
||||
index.write("\n".join(" {}".format(tag) for tag in tags))
|
@ -58,7 +58,7 @@ html_show_copyright = False
|
||||
html_theme_options = {
|
||||
"canonical_url": "https://docs.pyrogram.org/",
|
||||
"collapse_navigation": True,
|
||||
"sticky_navigation": False,
|
||||
"sticky_navigation": True,
|
||||
"logo_only": True,
|
||||
"display_version": True,
|
||||
"style_external_links": True
|
||||
|
@ -83,10 +83,10 @@ Meta
|
||||
|
||||
- :doc:`Pyrogram FAQ <faq>`: Answers to common Pyrogram questions.
|
||||
- :doc:`Pyrogram Glossary <glossary>`: List of words with brief explanations.
|
||||
- :doc:`Release Notes <releases>`: Release notes for Pyrogram releases.
|
||||
- :doc:`Powered by Pyrogram <powered-by>`: Collection of Pyrogram Projects.
|
||||
- :doc:`Support Pyrogram <support-pyrogram>`: Ways to show your appreciation.
|
||||
- :doc:`About the License <license>`: Information about the Project license.
|
||||
- :doc:`Release Notes <releases/index>`: Release notes for Pyrogram releases.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
@ -146,10 +146,10 @@ Meta
|
||||
|
||||
faq
|
||||
glossary
|
||||
releases
|
||||
powered-by
|
||||
support-pyrogram
|
||||
license
|
||||
releases/index
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
@ -1,13 +0,0 @@
|
||||
Release Notes
|
||||
=============
|
||||
|
||||
Release notes for Pyrogram releases will describe what's new in each version, and will also make you aware of any
|
||||
backwards-incompatible changes made in that version.
|
||||
|
||||
When upgrading to a new version of Pyrogram, you will need to check all the breaking changes in order to find
|
||||
incompatible code in your application, but also to take advantage of new features and improvements.
|
||||
|
||||
.. note::
|
||||
|
||||
Currently, all Pyrogram release notes live inside the GitHub repository web page:
|
||||
https://github.com/pyrogram/pyrogram/releases.
|
@ -2,7 +2,7 @@ More on Updates
|
||||
===============
|
||||
|
||||
Here we'll show some advanced usages when working with :doc:`update handlers <../start/updates>` and
|
||||
:doc:`filters <filters>`.
|
||||
:doc:`filters <use-filters>`.
|
||||
|
||||
Handler Groups
|
||||
--------------
|
||||
|
Loading…
Reference in New Issue
Block a user