Menu

Tree [c26498] default tip /
 History

Read Only access


File Date Author Commit
 example 2017-07-24 David Handy David Handy [196e2a] Fix bug: All html files regenerated regardless ...
 rstwatch 2019-08-22 David H David H [4b03f9] Moved project to sourceforge; Tested on Python ...
 tests 2017-07-26 David Handy David Handy [1af8dd] Fixed bug in code that augments sys.path when r...
 .hgignore 2019-08-22 David H David H [130532] Ignore .pytest_cache directories
 .hgtags 2019-08-22 David H David H [c26498] Added tag v1.0.3 for changeset 1305326fef73
 LICENSE.txt 2017-07-15 David Handy David Handy [c1e53c] Add LICENSE.txt file stating this is open sourc...
 MANIFEST.in 2017-07-27 David Handy David Handy [0c70f5] Added README.rst
 README.rst 2019-08-22 David H David H [4b03f9] Moved project to sourceforge; Tested on Python ...
 setup.cfg 2017-07-27 David Handy David Handy [0c70f5] Added README.rst
 setup.py 2019-08-22 David H David H [4b03f9] Moved project to sourceforge; Tested on Python ...
 tox.ini 2017-07-25 David Handy David Handy [138257] Add missing __init__.py, added tox.ini for test...

Read Me

rstwatch

Watch directories for changes to RST files and generate HTML

Author:David Handy <cpif@handysoftware.com>

This simple static website generator scans directories for .rst files (text files in reStructuredText format) and converts them to HTML documents using docutils. By default it runs continuously. Whenever an .rst file (or a file included by an .rst file) is added or changed, the associated .html file is immediately created or re-generated.

Example

  • In your web content directory run: rstwatch .
  • Create an .rst file in that directory, e.g. named index.rst
  • Immediately a file named index.html appears in that same directory
  • Point your web browser to the index.html file
  • In your editor window, make a change to index.rst and save it
  • In your browser window, hit the refresh button
  • Boom! You see your changes, converted to HTML, right away
  • When you are done, press Ctrl-C to stop rstwatch

You can use rstwatch to learn and experiment with docutils and the reStructuredText format. This can be a stepping-stone to using a more complicated, fully-featured document generation system based on docutils, such as Sphinx.

Installation Instructions

rstwatch is an open source program written in the Python programming language. (See the license.)

First, install Python if you haven't already. It is freely available for Windows, MacOS, and Linux (it is likely already installed on MacOS or Linux.)

Next, install rstwatch from the Python Package Index using the pip command:

pip install rstwatch

The source code is hosted at: https://sourceforge.net/projects/rstwatch/

Usage

rstwatch [options] <directory>...

Options:

--exit Exit after first pass, instead of repeat scanning
--interval=SECONDS
 Seconds to delay between directory scans [default: 2.0]
--log-config=FILENAME
 (Optional) Custom logging configuration file
--refresh Regenerate all html files on first scan
--writer=WRITER_NAME
 Docutils writer name. [default: html5]

For the (optional) log configuration file format, see: https://docs.python.org/3/library/logging.config.html#configuration-file-format

Example log config file: log-config.ini