Metadata-Version: 2.4
Name: rtd-redirects
Version: 1.0.1
Summary: Manage redirects in the ReadTheDocs admin, programmatically
Home-page: https://github.com/honzajavorek/rtd-redirects
Author: Honza Javorek
Author-email: mail@honzajavorek.cz
License: MIT License
        
        Copyright (c) 2017-? Honza Javorek
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: readthedocs documentation redirects sphinx mkdocs
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Documentation
Classifier: Topic :: Documentation :: Sphinx
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Internet
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: lxml
Requires-Dist: cssselect
Requires-Dist: click
Requires-Dist: pyaml
Provides-Extra: tests
Requires-Dist: flake8; extra == "tests"
Provides-Extra: release
Requires-Dist: python-semantic-release; extra == "release"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: summary

rtd-redirects
=============

|PyPI version| |Build Status|

Manage redirects in the `ReadTheDocs <http://readthedocs.org/>`__ admin, programmatically.

Installation
------------

Requires **Python 3.6** and higher.

.. code:: sh

    $ pip install rtd-redirects

Usage
-----

.. code:: sh

    $ rtd-redirects project-name ./redirects.yml --username=honzajavorek

Uploads redirects defined in the ``redirects.yml`` file to ReadTheDocs redirects administration of the ``project-name`` project.

The tool uses ReadTheDocs' HTML interface (there's no official API for redirects), so you need to provide your username and password. HTTPS is used to transfer the credentials to ReadTheDocs.

``rtd-redirects`` tries to be idempotent, i.e. you can run it several times in row and it should always end with the same results. If there are any redirects with the same source path, the tool will replace them with whatever is defined in the ``redirects.yml`` file. Existing redirects which do not collide with contents of ``redirects.yml`` won't be affected.

redirects.yml
-------------

Only **page redirects** are supported at the moment. The format of the file is as follows:

.. code:: yaml

    redirects:
      # Following redirects have to be done because we've migrated from MkDocs to Sphinx
      "/example/": "/example.html"
      "/python/": "/python.html"

      # Following pages has been removed in favor of sections
      "/green.html": "/colors.html#green"

      # Following redirects are only for convenience
      "/praha.html": "/prague.html"

Why `YAML <https://en.wikipedia.org/wiki/YAML>`__? Because it's easy to read by humans, easy to write by humans, and above all, it has support for comments. Redirects are *corrections* and you should document why they're necessary.

License: MIT
------------

© 2017-? Honza Javorek mail@honzajavorek.cz

This work is licensed under `MIT
license <https://en.wikipedia.org/wiki/MIT_License>`__.

.. |PyPI version| image:: https://badge.fury.io/py/rtd-redirects.svg
   :target: https://badge.fury.io/py/rtd-redirects
.. |Build Status| image:: https://travis-ci.org/honzajavorek/rtd-redirects.svg?branch=master
   :target: https://travis-ci.org/honzajavorek/rtd-redirects
