gocept.template-rewrite 1.1
A tool to rewrite parts of template files (DTML, ZPT).
License: MIT
Requires Python: >=3.6, <4
Keywords: Zope DTML ZPT pagetemplates migrate Python 3

=======================
gocept.template_rewrite
=======================


.. image:: https://img.shields.io/pypi/v/gocept.template_rewrite.svg
    :target: https://pypi.org/project/gocept.template_rewrite/

.. image:: https://img.shields.io/pypi/pyversions/gocept.template_rewrite.svg
    :target: https://pypi.org/project/gocept.template_rewrite/

.. image:: https://github.com/gocept/gocept.template_rewrite/workflows/tests/badge.svg
    :target: https://github.com/gocept/gocept.template_rewrite/actions?query=workflow%3Atests

.. image:: https://coveralls.io/repos/github/gocept/gocept.template_rewrite/badge.svg
    :target: https://coveralls.io/github/gocept/gocept.template_rewrite

A tool to rewrite parts of template files (DTML, ZPT and XPT).

The initial use case is to have a pluggable system to convert Python 2
expressions in templates to Python 3.

This package runs on Python 3.6 up to 3.10.


Requirements
============

For the rewrite to work properly, it is necessary to have this structure
``attr="value"`` for attributes in tags with no whitespaces around the ``=``,
as otherwise the values will get lost.

Caveats
=======

- During rewrite double hyphens within HTML-comments are removed as the Chameleon
  engine in Zope 4 (and the `actual specification`_) is very strict about it.

- The underlying lib2to3 does not take into account, that the `cmp` function
  is no longer available in Python 3.

- This tool converts Python 2 to Python 3 - that means the code may not be
  compatible with Python 2 any more. For these edge cases manual changes are required to make it
  compatible with both versions.

.. _actual specification: http://www.htmlhelp.com/reference/wilbur/misc/comment.html


==================================
Developing gocept.template_rewrite
==================================

:Author:
    `gocept <http://gocept.com/>`_ <mail@gocept.com>

:Issues:
    https://github.com/gocept/gocept.template_rewrite/issues

:Source code:
    https://github.com/gocept/gocept.template_rewrite

:Current change log:
    https://raw.githubusercontent.com/gocept/gocept.template_rewrite/master/CHANGES.rst

:Installation:
    ``pip3 install gocept.template_rewrite``

:Run the tests:
    ``$ tox``


======================================
Change log for gocept.template_rewrite
======================================

1.1 (2022-04-29)
================

- Convert single quotes used for HTML attributes into double quotes.
  (`#25 <https://github.com/gocept/gocept.template_rewrite/pull/25>`_)

- Add support for Python 3.9 and 3.10.

- Ensure compatibility with ``pytest >= 6.0``.

- Use GHA as CI system.


1.0 (2020-04-07)
================

- Print exact location of error in case of problems parsing Page Templates.

- Add parameter `--collect-errors` that continues to parse all given files and
  prints all found parsing errors but exits with an error and does not replace
  any files if an error was found. This replaces the argument
  `--only-show-errors` present in earlier versions. This allows to create a
  full list of errors to be fixed before a rewrite is possible.

- Add notes about more caveats.

- File discovery now also includes TrustedFSPageTemplate files, which
  are registered with the file ending `.xpt`.