Metadata-Version: 2.4
Name: rst2txt
Version: 1.2.0
Summary: Convert reStructuredText to plain text
Author-email: Stephen Finucane <stephen@that.guru>
License: Copyright (c) 2018 by Stephen Finucane <stephen@that.guru>
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are
        met:
        
        * Redistributions of source code must retain the above copyright
          notice, this list of conditions and the following disclaimer.
        
        * Redistributions in binary form must reproduce the above copyright
          notice, this list of conditions and the following disclaimer in the
          documentation and/or other materials provided with the distribution.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
        "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
        LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
        A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
        OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
        LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Homepage, https://github.com/stephenfin/rst2txt
Project-URL: Download, https://pypi.org/project/rst2txt
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Documentation
Classifier: Topic :: Internet :: WWW/HTTP :: Site Management
Classifier: Topic :: Printing
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Text Processing
Classifier: Topic :: Text Processing :: General
Classifier: Topic :: Text Processing :: Markup
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: docutils>=0.11
Requires-Dist: pygments
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Dynamic: license-file

=======
rst2txt
=======

.. image:: https://badge.fury.io/py/rst2txt.svg
   :target: https://badge.fury.io/py/rst2txt
   :alt: PyPi Status

.. image:: https://travis-ci.org/stephenfin/rst2txt.svg?branch=master
   :target: https://travis-ci.org/stephenfin/rst2txt
   :alt: Build Status

reStructuredText is pretty-damn consumable in its raw form, but extensive use
of directives and roles can hamper things or leave the document incomplete in
its raw form (cough, ``.. include``, cough).

*rst2txt* allows you to work around this by evaluating the reStructuredText
source and stripping it of most of its formatting. The end result is a document
that's more readable and has elements that don't make sense in a plain text
document, such as images, stripped.

*rst2txt* is based on the ``sphinx.writer.text.TextWriter`` writer used by
Sphinx's `TextBuilder
<https://www.sphinx-doc.org/en/1.8/usage/builders/index.html#sphinx.builders.text.TextBuilder>`__
but with the Sphinx-specific features stripped out.

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

*rst2txt* is available on PyPI. To install, run:

.. code-block:: shell

   $ pip install --user rst2txt

Usage
-----

Most users will want just the ``rst2txt`` application:

.. code-block:: shell

   $ rst2txt README.rst

It is also possible to call this programmatically though. This can be useful
for things like consuming README files:

.. code-block:: python

   from docutils.core import publish_file
   import rst2txt

   with open('README.rst', 'r') as source:
       publish_file(source=source, destination_path='README.txt',
                    writer=rst2txt.Writer())
