diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..fa698fb1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,54 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# +# EditorConfig Configuration file, for more details see: +# http://EditorConfig.org +# EditorConfig is a convention description, that could be interpreted +# by multiple editors to enforce common coding conventions for specific +# file types + +# top-most EditorConfig file: +# Will ignore other EditorConfig files in Home directory or upper tree level. +root = true + + +[*] # For All Files +# Unix-style newlines with a newline ending every file +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +# Set default charset +charset = utf-8 +# Indent style default +indent_style = space +# Max Line Length - a hard line wrap, should be disabled +max_line_length = off + +[*.{py,cfg,ini}] +# 4 space indentation +indent_size = 4 + +[*.{yml,zpt,pt,dtml,zcml,html,xml}] +# 2 space indentation +indent_size = 2 + +[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}] # Frontend development +# 2 space indentation +indent_size = 2 +max_line_length = 80 + +[{Makefile,.gitmodules}] +# Tab indentation (no size specified, but view as 4 spaces) +indent_style = tab +indent_size = unset +tab_width = unset + + +## +# Add extra configuration options in .meta.toml: +# [editorconfig] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..38918f42 --- /dev/null +++ b/.flake8 @@ -0,0 +1,22 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[flake8] +doctests = 1 +ignore = + # black takes care of line length + E501, + # black takes care of where to break lines + W503, + # black takes care of spaces within slicing (list[:]) + E203, + # black takes care of spaces after commas + E231, + +## +# Add extra configuration options in .meta.toml: +# [flake8] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.github/workflows/meta.yml b/.github/workflows/meta.yml new file mode 100644 index 00000000..1e444065 --- /dev/null +++ b/.github/workflows/meta.yml @@ -0,0 +1,66 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +name: Meta +on: + push: + branches: + - master + - main + pull_request: + branches: + - master + - main + workflow_dispatch: + +## +# To set environment variables for all jobs, add in .meta.toml: +# [github] +# env = """ +# debug: 1 +# image-name: 'org/image' +# image-tag: 'latest' +# """ +## + +jobs: + qa: + uses: plone/meta/.github/workflows/qa.yml@main + test: + uses: plone/meta/.github/workflows/test.yml@main + coverage: + uses: plone/meta/.github/workflows/coverage.yml@main + release_ready: + uses: plone/meta/.github/workflows/release_ready.yml@main + circular: + uses: plone/meta/.github/workflows/circular.yml@main + +## +# To modify the list of default jobs being created add in .meta.toml: +# [github] +# jobs = [ +# "qa", +# "test", +# "coverage", +# "dependencies", +# "release_ready", +# "circular", +# ] +## + +## +# To request that some OS level dependencies get installed +# when running tests/coverage jobs, add in .meta.toml: +# [github] +# os_dependencies = "git libxml2 libxslt" +## + + +## +# Specify additional jobs in .meta.toml: +# [github] +# extra_lines = """ +# another: +# uses: org/repo/.github/workflows/file.yml@main +# """ +## diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 7d8005d6..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Test - -on: - push: - branches-ignore: - - "master" - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: - - "2.7" - - "3.5" - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "3.10" - - steps: - - uses: actions/checkout@v2 - - - name: Setup Python ${{ matrix.python-version }} - id: setup - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install package - run: | - pip install -c constraints.txt tox coverage - - - name: Run tests - env: - TOXENV: py${{ matrix.python-version }} - run: | - tox - - - name: Run coverage - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coverage combine diff --git a/.gitignore b/.gitignore index 282e1642..486392f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,56 @@ -bin -develop-eggs -docs/_build -parts/ -build/ -_build/ -reports/ -dist/ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +# python related +*.egg-info *.pyc *.pyo -*.egg-info + +# translation related +*.mo + +# tools related +build/ +.coverage +.*project +coverage.xml +dist/ +docs/_build +__pycache__/ +.tox +.vscode/ +node_modules/ + +# venv / buildout related +bin/ +develop-eggs/ +eggs/ .eggs/ +etc/ .installed.cfg -.tox/ -include -lib/python2.7 -.python-version -.cache/ -coverage* -.coverage* +include/ +lib/ +lib64 +.mr.developer.cfg +parts/ +pyvenv.cfg +var/ +local.cfg + +# mxdev +/instance/ +/.make-sentinels/ +/*-mxdev.txt +/reports/ +/sources/ +/venv/ +.installed.txt + + +## +# Add extra configuration options in .meta.toml: +# [gitignore] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/.meta.toml b/.meta.toml new file mode 100644 index 00000000..5978838c --- /dev/null +++ b/.meta.toml @@ -0,0 +1,24 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +[meta] +template = "default" +commit-id = "5d3e918e" + +[github] +jobs = [ + "qa", + "test", + "coverage", + "release_ready", + "circular", + ] + +[pre_commit] +zpretty_extra_lines = """ + # Various test failures when we change xml and html. + files: ".*.(zcml)$" +""" + +[pyproject] +codespell_skip = "*.po,*.min.js,*.graffle,src/diazo/tests/conditional-drop-in-append*" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..68017b1b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,96 @@ +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file +ci: + autofix_prs: false + autoupdate_schedule: monthly + +repos: +- repo: https://github.com/asottile/pyupgrade + rev: v3.15.0 + hooks: + - id: pyupgrade + args: [--py38-plus] +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort +- repo: https://github.com/psf/black + rev: 24.1.1 + hooks: + - id: black +- repo: https://github.com/collective/zpretty + rev: 3.1.0 + hooks: + - id: zpretty + # Various test failures when we change xml and html. + files: ".*.(zcml)$" + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# zpretty_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/PyCQA/flake8 + rev: 7.0.0 + hooks: + - id: flake8 + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# flake8_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# codespell_extra_lines = """ +# _your own configuration lines_ +# """ +## +- repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest +- repo: https://github.com/regebro/pyroma + rev: "4.2" + hooks: + - id: pyroma +- repo: https://github.com/mgedmin/check-python-versions + rev: "0.22.0" + hooks: + - id: check-python-versions + args: ['--only', 'setup.py,pyproject.toml'] +- repo: https://github.com/collective/i18ndude + rev: "6.1.0" + hooks: + - id: i18ndude + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# i18ndude_extra_lines = """ +# _your own configuration lines_ +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pre_commit] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/MANIFEST.in b/MANIFEST.in index 86944beb..5d5589de 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,28 +1,16 @@ # MANIFEST.in - Definition which files should be included in a release: # Files to include: -include *.txt -global-include *.rst -global-include *.cfg -global-include *.xsl -global-include *.py -global-include *.xsl -global-include *.zcml -global-include *.html -global-include *.css -global-include *.js -global-include *.cfg -global-include *.xml +include *.rst # Whitelist / Include Path completely: graft docs graft examples -graft lib -graft lib* -graft templates +graft src # Blacklist / Exclude Files and Path prune docs/_build +prune .tox global-exclude *pyc global-exclude *pyo global-exclude *pydinclude pyproject.toml diff --git a/bootstrap.py b/bootstrap.py deleted file mode 100755 index ed57894b..00000000 --- a/bootstrap.py +++ /dev/null @@ -1,178 +0,0 @@ -############################################################################## -# -# Copyright (c) 2006 Zope Foundation and Contributors. -# All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -"""Bootstrap a buildout-based project - -Simply run this script in a directory containing a buildout.cfg. -The script accepts buildout command-line options, so you can -use the -c option to specify an alternate configuration file. -""" - -import os -import shutil -import sys -import tempfile - -from optparse import OptionParser - -tmpeggs = tempfile.mkdtemp() - -usage = '''\ -[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] - -Bootstraps a buildout-based project. - -Simply run this script in a directory containing a buildout.cfg, using the -Python that you want bin/buildout to use. - -Note that by using --find-links to point to local resources, you can keep -this script from going over the network. -''' - -parser = OptionParser(usage=usage) -parser.add_option("-v", "--version", help="use a specific zc.buildout version") - -parser.add_option("-t", "--accept-buildout-test-releases", - dest='accept_buildout_test_releases', - action="store_true", default=False, - help=("Normally, if you do not specify a --version, the " - "bootstrap script and buildout gets the newest " - "*final* versions of zc.buildout and its recipes and " - "extensions for you. If you use this flag, " - "bootstrap and buildout will get the newest releases " - "even if they are alphas or betas.")) -parser.add_option("-c", "--config-file", - help=("Specify the path to the buildout configuration " - "file to be used.")) -parser.add_option("-f", "--find-links", - help=("Specify a URL to search for buildout releases")) -parser.add_option("--allow-site-packages", - action="store_true", default=False, - help=("Let bootstrap.py use existing site packages")) - - -options, args = parser.parse_args() - -###################################################################### -# load/install setuptools - -try: - if options.allow_site_packages: - import setuptools - import pkg_resources - from urllib.request import urlopen -except ImportError: - from urllib2 import urlopen - -ez = {} -exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) - -if not options.allow_site_packages: - # ez_setup imports site, which adds site packages - # this will remove them from the path to ensure that incompatible versions - # of setuptools are not in the path - import site - # inside a virtualenv, there is no 'getsitepackages'. - # We can't remove these reliably - if hasattr(site, 'getsitepackages'): - for sitepackage_path in site.getsitepackages(): - sys.path[:] = [x for x in sys.path if sitepackage_path not in x] - -setup_args = dict(to_dir=tmpeggs, download_delay=0) -ez['use_setuptools'](**setup_args) -import setuptools -import pkg_resources - -# This does not (always?) update the default working set. We will -# do it. -for path in sys.path: - if path not in pkg_resources.working_set.entries: - pkg_resources.working_set.add_entry(path) - -###################################################################### -# Install buildout - -ws = pkg_resources.working_set - -cmd = [sys.executable, '-c', - 'from setuptools.command.easy_install import main; main()', - '-mZqNxd', tmpeggs] - -find_links = os.environ.get( - 'bootstrap-testing-find-links', - options.find_links or - ('http://downloads.buildout.org/' - if options.accept_buildout_test_releases else None) - ) -if find_links: - cmd.extend(['-f', find_links]) - -setuptools_path = ws.find( - pkg_resources.Requirement.parse('setuptools')).location - -requirement = 'zc.buildout' -version = options.version -if version is None and not options.accept_buildout_test_releases: - # Figure out the most recent final version of zc.buildout. - import setuptools.package_index - _final_parts = '*final-', '*final' - - def _final_version(parsed_version): - for part in parsed_version: - if (part[:1] == '*') and (part not in _final_parts): - return False - return True - index = setuptools.package_index.PackageIndex( - search_path=[setuptools_path]) - if find_links: - index.add_find_links((find_links,)) - req = pkg_resources.Requirement.parse(requirement) - if index.obtain(req) is not None: - best = [] - bestv = None - for dist in index[req.project_name]: - distv = dist.parsed_version - if _final_version(distv): - if bestv is None or distv > bestv: - best = [dist] - bestv = distv - elif distv == bestv: - best.append(dist) - if best: - best.sort() - version = best[-1].version -if version: - requirement = '=='.join((requirement, version)) -cmd.append(requirement) - -import subprocess -if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0: - raise Exception( - "Failed to execute command:\n%s" % repr(cmd)[1:-1]) - -###################################################################### -# Import and run buildout - -ws.add_entry(tmpeggs) -ws.require(requirement) -import zc.buildout.buildout - -if not [a for a in args if '=' not in a]: - args.append('bootstrap') - -# if -c was provided, we push it back into args for buildout' main function -if options.config_file is not None: - args[0:0] = ['-c', options.config_file] - -zc.buildout.buildout.main(args) -shutil.rmtree(tmpeggs) diff --git a/buildout.cfg b/buildout.cfg deleted file mode 100644 index 3812ad2d..00000000 --- a/buildout.cfg +++ /dev/null @@ -1,28 +0,0 @@ -[buildout] -extends = versions.cfg -parts = - diazo - test - wsgi - sphinx -develop = . - -[diazo] -recipe = zc.recipe.egg -eggs = diazo -interpreter = py - -[test] -recipe = zc.recipe.testrunner -eggs = diazo [test] -defaults = ['--auto-color'] - -[wsgi] -recipe = zc.recipe.egg -eggs = - diazo [wsgi] - gearbox -scripts = gearbox - -[sphinx] -recipe = zc.recipe.egg diff --git a/checkdocs.cfg b/checkdocs.cfg deleted file mode 100644 index 18afe5a0..00000000 --- a/checkdocs.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[buildout] -extends = buildout.cfg - -[diazo] -eggs += - collective.checkdocs diff --git a/constraints.txt b/constraints.txt deleted file mode 100644 index c6ad05aa..00000000 --- a/constraints.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Constrains for testing Diazo / Plone Packages -# --------------------------------------------- - diff --git a/docs/advanced.rst b/docs/advanced.rst index a14c0abb..b7dd2cb1 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -127,7 +127,7 @@ For example, if the transform is set up to receive a string parameter -Use the ``if-not`` attribute to negate the conditon, for example:: +Use the ``if-not`` attribute to negate the condition, for example:: @@ -344,7 +344,7 @@ the included WSGI middleware include a ``doctype`` option which may be set to XInclude -------- -You may wish to re-use elements of your rules file across multiple themes. +You may wish to reuse elements of your rules file across multiple themes. This is particularly useful if you have multiple variations on the same theme used to style different pages on a particular website. diff --git a/docs/conf.py b/docs/conf.py index bb2cc956..ae789c75 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # Diazo documentation build configuration file, created by # sphinx-quickstart on Tue Nov 2 18:58:07 2010. @@ -11,102 +10,100 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os - # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'Diazo' -copyright = u'2011, Plone Foundation' +project = "Diazo" +copyright = "2011, Plone Foundation" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '1.0b1' +version = "1.0b1" # The full version, including alpha/beta/rc tags. -release = '1.0b1' +release = "1.0b1" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['_build'] +exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'haiku' +html_theme = "haiku" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". html_title = "Diazo" # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -115,102 +112,98 @@ # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'Diazodoc' +htmlhelp_basename = "Diazodoc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Diazo.tex', u'Diazo Documentation', - u'Plone Foundation', 'manual'), + ("index", "Diazo.tex", "Diazo Documentation", "Plone Foundation", "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'diazo', u'Diazo Documentation', - [u'Plone Foundation'], 1) -] +man_pages = [("index", "diazo", "Diazo Documentation", ["Plone Foundation"], 1)] diff --git a/docs/deployment.rst b/docs/deployment.rst index 26156496..ff518a9f 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -142,12 +142,12 @@ will need to compile Nginx with a special version of the XSLT module that can (optionally) use the HTML parser from libxml2. If you expect the source content to be xhtml well-formed and valid, then you -should be able to avoid the ``xslt_html_parser on;`` directive. You can +should be able to avoid the ``xslt_html_parser on;`` directive. You can achieve this if you generate the source content. -Otherwise, if you expect non-xhtml compliant html, you need to compile Nginx -from source. At the time of this writing, the html-xslt_ project proposes -full Nginx sources for Nginx 0.7 and 0.8, whereas Nginx is now 1.6 and 1.7. +Otherwise, if you expect non-xhtml compliant html, you need to compile Nginx +from source. At the time of this writing, the html-xslt_ project proposes +full Nginx sources for Nginx 0.7 and 0.8, whereas Nginx is now 1.6 and 1.7. Here is an alternative `patch `_ you should be able to apply to any Nginx source code with the command-line @@ -155,7 +155,7 @@ you should be able to apply to any Nginx source code with the command-line In the future, the necessary patches to enable HTML mode parsing will hopefully be part of the standard Nginx distribution. There also is a -`Nginx ticket `_ asking for the +`Nginx ticket `_ asking for the xslt_html_parser in the http_xslt_module. Using a properly patched Nginx, you can configure it with XSLT support like @@ -301,7 +301,7 @@ below uses this parameter to apply a filter:: } In this example the sub-request is set to loop back on itself, so the include -is taken from a themed page. ``filter.xsl`` (in the lib/diazo directory) and +is taken from a themed page. ``filter.xsl`` (in the src/diazo directory) and ``theme.xsl`` should both be placed in the same directory as ``Nginx.conf``. An example buildout is available in ``Nginx.cfg`` in this package. diff --git a/docs/introduction.rst b/docs/introduction.rst index 74655e63..7c3b35a8 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -42,7 +42,7 @@ Bear in mind that: be served from a static webserver, which is normally much faster than serving them from a dynamic application. * You can leave the original theme HTML untouched, which makes it easier to - re-use for other scenarios. For example, you can stitch two unrelated + reuse for other scenarios. For example, you can stitch two unrelated applications together by using a single theme file with separate rules files. This would result in two compiled XSLT files. You could use location match rules or similar techniques to choose which one to invoke for a given diff --git a/lib/diazo/runtrace.py b/lib/diazo/runtrace.py deleted file mode 100644 index 44a50c6e..00000000 --- a/lib/diazo/runtrace.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from diazo.rules import process_rules -from diazo.utils import pkg_xsl -from lxml import etree - -import logging - - -logger = logging.getLogger('diazo') - -_runtrace_to_html = pkg_xsl('runtrace_to_html.xsl') - - -def log_to_xml_string(error_log): - msgs = [l.message for l in error_log if l.message.startswith(' - {message:s} - -""".format(message=''.join(msgs)) - - -def generate_runtrace(rules, error_log, rules_parser=None): - """Annotate a rules file with the results of a transformation""" - def condition_name(trace): - """Generate attribute name for this entry""" - for k in trace.attrib.keys(): - if(k == 'theme_xmlid'): - continue - if(k.startswith('{http://namespaces.plone.org/diazo/css}')): - continue - return 'runtrace-' + k - - rules_doc = process_rules( - rules, - rules_parser=rules_parser, - stop='add_identifiers', - ) - trace_doc = etree.XML(log_to_xml_string(error_log)) - - for trace in trace_doc.xpath('/runtrace/runtrace'): - for el in rules_doc.xpath("id('" + trace.attrib['theme_xmlid'] + "')"): - el.set(condition_name(trace), trace.text or '') - return rules_doc - - -def runtrace_to_html(runtrace_doc): - """Convert the runtrace document into HTML""" - return _runtrace_to_html(runtrace_doc) - - -def error_log_to_html(error_log): - """Convert an error log into an HTML representation""" - doc = etree.Element('ul') - for l in error_log: - if l.message.startswith('=68.2"] + [tool.towncrier] -filename = "CHANGES.rst" directory = "news/" +filename = "CHANGES.rst" title_format = "{version} ({project_date})" underlines = ["-", ""] @@ -18,3 +24,136 @@ showcontent = true directory = "bugfix" name = "Bug fixes:" showcontent = true + +[[tool.towncrier.type]] +directory = "internal" +name = "Internal:" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation:" +showcontent = true + +[[tool.towncrier.type]] +directory = "tests" +name = "Tests" +showcontent = true + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# towncrier_extra_lines = """ +# extra_configuration +# """ +## + +[tool.isort] +profile = "plone" + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# isort_extra_lines = """ +# extra_configuration +# """ +## + +[tool.black] +target-version = ["py38"] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# black_extra_lines = """ +# extra_configuration +# """ +## + +[tool.codespell] +ignore-words-list = "discreet," +skip = "*.po,*.po,*.min.js,*.graffle,src/diazo/tests/conditional-drop-in-append*" +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# codespell_ignores = "foo,bar" +# codespell_skip = "*.po,*.map,package-lock.json" +## + +[tool.dependencychecker] +Zope = [ + # Zope own provided namespaces + 'App', 'OFS', 'Products.Five', 'Products.OFSP', 'Products.PageTemplates', + 'Products.SiteAccess', 'Shared', 'Testing', 'ZPublisher', 'ZTUtils', + 'Zope2', 'webdav', 'zmi', + # ExtensionClass own provided namespaces + 'ExtensionClass', 'ComputedAttribute', 'MethodObject', + # Zope dependencies + 'AccessControl', 'Acquisition', 'AuthEncoding', 'beautifulsoup4', 'BTrees', + 'cffi', 'Chameleon', 'DateTime', 'DocumentTemplate', + 'MultiMapping', 'multipart', 'PasteDeploy', 'Persistence', 'persistent', + 'pycparser', 'python-gettext', 'pytz', 'RestrictedPython', 'roman', + 'soupsieve', 'transaction', 'waitress', 'WebOb', 'WebTest', 'WSGIProxy2', + 'z3c.pt', 'zc.lockfile', 'ZConfig', 'zExceptions', 'ZODB', 'zodbpickle', + 'zope.annotation', 'zope.browser', 'zope.browsermenu', 'zope.browserpage', + 'zope.browserresource', 'zope.cachedescriptors', 'zope.component', + 'zope.configuration', 'zope.container', 'zope.contentprovider', + 'zope.contenttype', 'zope.datetime', 'zope.deferredimport', + 'zope.deprecation', 'zope.dottedname', 'zope.event', 'zope.exceptions', + 'zope.filerepresentation', 'zope.globalrequest', 'zope.hookable', + 'zope.i18n', 'zope.i18nmessageid', 'zope.interface', 'zope.lifecycleevent', + 'zope.location', 'zope.pagetemplate', 'zope.processlifetime', 'zope.proxy', + 'zope.ptresource', 'zope.publisher', 'zope.schema', 'zope.security', + 'zope.sequencesort', 'zope.site', 'zope.size', 'zope.structuredtext', + 'zope.tal', 'zope.tales', 'zope.testbrowser', 'zope.testing', + 'zope.traversing', 'zope.viewlet' +] +'Products.CMFCore' = [ + 'docutils', 'five.localsitemanager', 'Missing', 'Products.BTreeFolder2', + 'Products.GenericSetup', 'Products.MailHost', 'Products.PythonScripts', + 'Products.StandardCacheManagers', 'Products.ZCatalog', 'Record', + 'zope.sendmail', 'Zope' +] +'plone.base' = [ + 'plone.batching', 'plone.registry', 'plone.schema','plone.z3cform', + 'Products.CMFCore', 'Products.CMFDynamicViewFTI', +] +python-dateutil = ['dateutil'] + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# dependencies_ignores = "['zestreleaser.towncrier']" +# dependencies_mappings = [ +# "gitpython = ['git']", +# "pygithub = ['github']", +# ] +## + +[tool.check-manifest] +ignore = [ + ".editorconfig", + ".meta.toml", + ".pre-commit-config.yaml", + "tox.ini", + ".flake8", + "mx.ini", + +] +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# check_manifest_ignores = """ +# "*.map.js", +# "*.pyc", +# """ +## + + +## +# Add extra configuration options in .meta.toml: +# [pyproject] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/setup.cfg b/setup.cfg index fc83f1e5..1adbac30 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,41 +1,15 @@ -[check-manifest] -ignore = - *.cfg - bootstrap.py - tox.ini - -[isort] -# for details see -# http://docs.plone.org/develop/styleguide/python.html#grouping-and-sorting -force_alphabetical_sort = True -force_single_line = True -lines_after_imports = 2 -line_length = 200 - -[flake8] -exclude = - -ignore = - [tool:pytest] addopts = -ra testpaths = # package-tests/ -norecursedirs = fixures - [coverage:run] branch = True -source = lib -omit = - bootstrap.py +source = src [coverage:report] precision = 2 [coverage:html] directory = reports/coverage - -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py index 28c732a6..4e91349d 100644 --- a/setup.py +++ b/setup.py @@ -1,71 +1,64 @@ -# -*- coding: utf-8 -*- - from setuptools import find_packages from setuptools import setup extras_require = { - 'wsgi': [ - 'repoze.xmliter', - 'WebOb', + "wsgi": [ + "repoze.xmliter", + "WebOb", ], - 'test': [ - 'repoze.xmliter', - 'WebOb', - 'py', + "test": [ + "repoze.xmliter", + "WebOb", ], } -readme = open('README.rst').read() -changes = open('CHANGES.rst').read() -long_desc = readme + '\n\n' + changes +readme = open("README.rst").read() +changes = open("CHANGES.rst").read() +long_desc = readme + "\n\n" + changes setup( - name='diazo', - version='1.5.1.dev0', + name="diazo", + version="1.5.1.dev0", description="""Diazo implements a Deliverance like language using a pure XSLT engine. With Diazo, you "compile" your theme and ruleset in one step, then use a superfast/simple transform on each request thereafter. Alternatively, compile your theme during development, check it into version control, and not touch Diazo during deployment.""", - keywords='web theming', + keywords="web theming", long_description=long_desc, - packages=find_packages('lib'), - package_dir={'': 'lib'}, + packages=find_packages("src"), + package_dir={"": "src"}, include_package_data=True, zip_safe=False, - author='Paul Everitt, Laurence Rowe and Martin Aspeli.', - author_email='laurence@lrowe.co.uk', - url='http://diazo.org', - license='New BSD', + author="Paul Everitt, Laurence Rowe and Martin Aspeli.", + author_email="laurence@lrowe.co.uk", + url="http://diazo.org", + license="New BSD", classifiers=[ - 'Development Status :: 6 - Mature', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: WSGI', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware', - 'Topic :: Text Processing :: Markup :: XML', + "Development Status :: 6 - Mature", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", + "Topic :: Text Processing :: Markup :: XML", ], + python_requires=">=3.8", install_requires=[ - # 'setuptools', - 'lxml', - 'cssselect', - 'six', + # 'setuptools', + "lxml", + "cssselect", ], extras_require=extras_require, - test_suite='diazo.tests.alltests', - tests_require=extras_require['test'], + test_suite="diazo.tests.alltests", + tests_require=extras_require["test"], entry_points=""" [console_scripts] diazocompiler = diazo.compiler:main diff --git a/lib/diazo/__init__.py b/src/diazo/__init__.py similarity index 60% rename from lib/diazo/__init__.py rename to src/diazo/__init__.py index f4421686..861028b8 100644 --- a/lib/diazo/__init__.py +++ b/src/diazo/__init__.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import logging diff --git a/lib/diazo/annotate-rules.xsl b/src/diazo/annotate-rules.xsl similarity index 100% rename from lib/diazo/annotate-rules.xsl rename to src/diazo/annotate-rules.xsl diff --git a/lib/diazo/annotate-themes.xsl b/src/diazo/annotate-themes.xsl similarity index 100% rename from lib/diazo/annotate-themes.xsl rename to src/diazo/annotate-themes.xsl diff --git a/lib/diazo/apply-conditions.xsl b/src/diazo/apply-conditions.xsl similarity index 100% rename from lib/diazo/apply-conditions.xsl rename to src/diazo/apply-conditions.xsl diff --git a/lib/diazo/apply-rules.xsl b/src/diazo/apply-rules.xsl similarity index 100% rename from lib/diazo/apply-rules.xsl rename to src/diazo/apply-rules.xsl diff --git a/lib/diazo/compiler.py b/src/diazo/compiler.py similarity index 81% rename from lib/diazo/compiler.py rename to src/diazo/compiler.py index 14e692b6..78e63e9b 100644 --- a/lib/diazo/compiler.py +++ b/src/diazo/compiler.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """\ Usage: %prog [options] [-r] RULES [-t] THEME @@ -18,30 +17,29 @@ from diazo.utils import quote_param from diazo.utils import split_params from lxml import etree -from six import string_types import logging import pkg_resources -logger = logging.getLogger('diazo') +logger = logging.getLogger("diazo") usage = __doc__ def set_parser(stylesheet, parser, compiler_parser=None): - file_obj = pkg_resources.resource_filename('diazo', 'dummy.html') + file_obj = pkg_resources.resource_filename("diazo", "dummy.html") with open(file_obj) as file_handler: dummy_doc = etree.parse( file_handler, parser=parser, ) - name = 'file:///__diazo__' + name = "file:///__diazo__" resolver = CustomResolver({name: stylesheet}) if compiler_parser is None: compiler_parser = etree.XMLParser() compiler_parser.resolvers.add(resolver) - identity = pkg_xsl('identity.xsl', compiler_parser) - output_doc = identity(dummy_doc, docurl="'{name}'".format(name=name)) + identity = pkg_xsl("identity.xsl", compiler_parser) + output_doc = identity(dummy_doc, docurl=f"'{name}'") compiler_parser.resolvers.remove(resolver) return output_doc @@ -49,8 +47,8 @@ def set_parser(stylesheet, parser, compiler_parser=None): def build_xsl_params_document(xsl_params): if xsl_params is None: xsl_params = {} - if 'path' not in xsl_params: - xsl_params['path'] = '' + if "path" not in xsl_params: + xsl_params["path"] = "" known_params = etree.XML( '', @@ -58,14 +56,14 @@ def build_xsl_params_document(xsl_params): for param_name, param_value in xsl_params.items(): param_element = etree.SubElement( known_params, - '{http://www.w3.org/1999/XSL/Transform}param', + "{http://www.w3.org/1999/XSL/Transform}param", ) - param_element.attrib['name'] = param_name - if isinstance(param_value, string_types): + param_element.attrib["name"] = param_name + if isinstance(param_value, str): param_element.text = param_value else: - param_element.attrib['select'] = str(quote_param(param_value)) - param_element.tail = '\n' + param_element.attrib["select"] = str(quote_param(param_value)) + param_element.tail = "\n" return known_params @@ -93,7 +91,7 @@ def compile_theme( * ``rules`` is the rules file * ``theme`` is the theme file - * ``extra`` is an optional XSLT file with Diazo extensions (depracated, use + * ``extra`` is an optional XSLT file with Diazo extensions (deprecated, use inline xsl in the rules instead) * ``css`` can be set to False to disable CSS syntax support (providing a moderate speed gain) @@ -125,7 +123,7 @@ def compile_theme( names. Values are default values. """ if access_control is not None: - read_network = access_control.options['read_network'] + read_network = access_control.options["read_network"] rules_doc = process_rules( rules=rules, theme=theme, @@ -146,23 +144,25 @@ def compile_theme( known_params = build_xsl_params_document(xsl_params) # Create a pseudo resolver for this - known_params_url = 'file:///__diazo_known_params__' - emit_stylesheet_resolver = CustomResolver({ - known_params_url: etree.tostring(known_params), - }) + known_params_url = "file:///__diazo_known_params__" + emit_stylesheet_resolver = CustomResolver( + { + known_params_url: etree.tostring(known_params), + } + ) emit_stylesheet_parser = etree.XMLParser() emit_stylesheet_parser.resolvers.add(emit_stylesheet_resolver) # Set up parameters params = {} if indent is not None: - params['indent'] = indent and "'yes'" or "'no'" - params['known_params_url'] = quote_param(known_params_url) - params['runtrace'] = '1' if runtrace else '0' + params["indent"] = indent and "'yes'" or "'no'" + params["known_params_url"] = quote_param(known_params_url) + params["runtrace"] = "1" if runtrace else "0" # Run the final stage compiler emit_stylesheet = pkg_xsl( - 'emit-stylesheet.xsl', + "emit-stylesheet.xsl", parser=emit_stylesheet_parser, ) compiled_doc = emit_stylesheet(rules_doc, **params) @@ -176,8 +176,7 @@ def compile_theme( def main(): - """Called from console script - """ + """Called from console script""" parser = _createOptionParser(usage=usage) (options, args) = parser.parse_args() @@ -185,11 +184,11 @@ def main(): if len(args) == 2 and options.theme is None: options.rules, options.theme = args elif len(args) == 1: - options.rules, = args + (options.rules,) = args else: - parser.error('Wrong number of arguments.') + parser.error("Wrong number of arguments.") elif args: - parser.error('Wrong number of arguments.') + parser.error("Wrong number of arguments.") if options.trace: logger.setLevel(logging.DEBUG) @@ -210,13 +209,13 @@ def main(): ) root = output_xslt.getroot() if not root.tail: - root.tail = '\n' + root.tail = "\n" output_xslt.write( options.output, - encoding='utf-8', + encoding="utf-8", pretty_print=options.pretty_print, ) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/lib/diazo/cssrules.py b/src/diazo/cssrules.py similarity index 61% rename from lib/diazo/cssrules.py rename to src/diazo/cssrules.py index 34f55ce6..c651c50e 100644 --- a/lib/diazo/cssrules.py +++ b/src/diazo/cssrules.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """\ Usage: %prog RULES @@ -11,7 +10,6 @@ \ """ -from __future__ import absolute_import from cssselect import GenericTranslator from diazo import utils @@ -22,14 +20,14 @@ import sys -logger = logging.getLogger('diazo') +logger = logging.getLogger("diazo") usage = __doc__ class LocationPathTranslator(GenericTranslator): def xpath_descendant_combinator(self, left, right): """right is a child, grand-child or further descendant of left""" - return left.join('//', right) + return left.join("//", right) _generic_translator = GenericTranslator() @@ -37,50 +35,49 @@ def xpath_descendant_combinator(self, left, right): def convert_css_selectors(rules): - """Convert css rules to xpath rules element tree in place - """ + """Convert css rules to xpath rules element tree in place""" # XXX: There is a :root pseudo-class # NOQA: T000 # http://www.w3.org/TR/css3-selectors/#root-pseudo # We may wish to add support to lxml.cssselect for it some day. for element in rules.xpath( - "//@*[namespace-uri()='{nsp}']/..".format(nsp=utils.namespaces['css']), + "//@*[namespace-uri()='{nsp}']/..".format(nsp=utils.namespaces["css"]), ): tag_namespace = utils.namespace(element.tag) css_prefix = element.attrib.get( utils.fullname( - utils.namespaces['css'], - 'prefix', + utils.namespaces["css"], + "prefix", ), None, ) for name, value in element.attrib.items(): if not name.startswith( - '{%s}' % utils.namespaces['css'], # NOQA: S001 + "{%s}" % utils.namespaces["css"], # NOQA: S001 ): continue localname = utils.localname(name) - if localname == 'prefix': + if localname == "prefix": continue if not value: - element.attrib[localname] = '' + element.attrib[localname] = "" continue if ( - tag_namespace == utils.namespaces['diazo'] and - localname in - ( - 'content', - 'content-children', - 'if-content', - 'if-not-content', - ) or ( - tag_namespace == utils.namespaces['xsl'] and - localname in ('match',) + tag_namespace == utils.namespaces["diazo"] + and localname + in ( + "content", + "content-children", + "if-content", + "if-not-content", + ) + or ( + tag_namespace == utils.namespaces["xsl"] and localname in ("match",) ) ): - prefix = css_prefix or '//' + prefix = css_prefix or "//" tr = _location_path_translator else: - prefix = css_prefix or 'descendant-or-self::' + prefix = css_prefix or "descendant-or-self::" tr = _generic_translator element.attrib[localname] = tr.css_to_xpath(value, prefix=prefix) @@ -88,33 +85,32 @@ def convert_css_selectors(rules): def main(): - """Called from console script - """ + """Called from console script""" parser = OptionParser(usage=usage) parser.add_option( - '-o', - '--output', - metavar='output.html', - help='Output filename (instead of stdout)', - dest='output', + "-o", + "--output", + metavar="output.html", + help="Output filename (instead of stdout)", + dest="output", default=sys.stdout, ) parser.add_option( - '-p', - '--pretty-print', - action='store_true', - help='Pretty print output', - dest='pretty_print', + "-p", + "--pretty-print", + action="store_true", + help="Pretty print output", + dest="pretty_print", default=False, ) (options, args) = parser.parse_args() if len(args) != 1: - parser.error('Invalid number of arguments') + parser.error("Invalid number of arguments") rules = etree.parse(args[0]) convert_css_selectors(rules) rules.write(options.output, pretty_print=options.pretty_print) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/lib/diazo/debug_resources/diazo-debug.css b/src/diazo/debug_resources/diazo-debug.css similarity index 100% rename from lib/diazo/debug_resources/diazo-debug.css rename to src/diazo/debug_resources/diazo-debug.css diff --git a/lib/diazo/debug_resources/diazo-debug.js b/src/diazo/debug_resources/diazo-debug.js similarity index 100% rename from lib/diazo/debug_resources/diazo-debug.js rename to src/diazo/debug_resources/diazo-debug.js diff --git a/lib/diazo/debug_resources/iframe.js b/src/diazo/debug_resources/iframe.js similarity index 100% rename from lib/diazo/debug_resources/iframe.js rename to src/diazo/debug_resources/iframe.js diff --git a/lib/diazo/debug_resources/jquery-1.8.3.min.js b/src/diazo/debug_resources/jquery-1.8.3.min.js similarity index 100% rename from lib/diazo/debug_resources/jquery-1.8.3.min.js rename to src/diazo/debug_resources/jquery-1.8.3.min.js diff --git a/lib/diazo/defaults.xsl b/src/diazo/defaults.xsl similarity index 100% rename from lib/diazo/defaults.xsl rename to src/diazo/defaults.xsl diff --git a/lib/diazo/diazo-debug.zcml b/src/diazo/diazo-debug.zcml similarity index 68% rename from lib/diazo/diazo-debug.zcml rename to src/diazo/diazo-debug.zcml index 285694a6..189dfd82 100644 --- a/lib/diazo/diazo-debug.zcml +++ b/src/diazo/diazo-debug.zcml @@ -2,14 +2,16 @@ xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:gs="http://namespaces.zope.org/genericsetup" - xmlns:zcml="http://namespaces.zope.org/zcml" xmlns:i18n="http://namespaces.zope.org/i18n" xmlns:plone="http://namespaces.plone.org/plone" - i18n_domain="plone"> + xmlns:zcml="http://namespaces.zope.org/zcml" + i18n_domain="plone" + > - - + + diff --git a/lib/diazo/dummy.html b/src/diazo/dummy.html similarity index 100% rename from lib/diazo/dummy.html rename to src/diazo/dummy.html diff --git a/lib/diazo/emit-stylesheet.xsl b/src/diazo/emit-stylesheet.xsl similarity index 100% rename from lib/diazo/emit-stylesheet.xsl rename to src/diazo/emit-stylesheet.xsl diff --git a/lib/diazo/filter.xsl b/src/diazo/filter.xsl similarity index 100% rename from lib/diazo/filter.xsl rename to src/diazo/filter.xsl diff --git a/lib/diazo/filter_html.xsl b/src/diazo/filter_html.xsl similarity index 100% rename from lib/diazo/filter_html.xsl rename to src/diazo/filter_html.xsl diff --git a/lib/diazo/filter_xhtml.xsl b/src/diazo/filter_xhtml.xsl similarity index 100% rename from lib/diazo/filter_xhtml.xsl rename to src/diazo/filter_xhtml.xsl diff --git a/lib/diazo/fixup-themes.xsl b/src/diazo/fixup-themes.xsl similarity index 100% rename from lib/diazo/fixup-themes.xsl rename to src/diazo/fixup-themes.xsl diff --git a/lib/diazo/identity.xsl b/src/diazo/identity.xsl similarity index 100% rename from lib/diazo/identity.xsl rename to src/diazo/identity.xsl diff --git a/lib/diazo/include.xsl b/src/diazo/include.xsl similarity index 100% rename from lib/diazo/include.xsl rename to src/diazo/include.xsl diff --git a/lib/diazo/merge-conditions.xsl b/src/diazo/merge-conditions.xsl similarity index 100% rename from lib/diazo/merge-conditions.xsl rename to src/diazo/merge-conditions.xsl diff --git a/lib/diazo/normalize-rules.xsl b/src/diazo/normalize-rules.xsl similarity index 100% rename from lib/diazo/normalize-rules.xsl rename to src/diazo/normalize-rules.xsl diff --git a/lib/diazo/rules.py b/src/diazo/rules.py similarity index 65% rename from lib/diazo/rules.py rename to src/diazo/rules.py index a42cd427..dfab0e33 100644 --- a/lib/diazo/rules.py +++ b/src/diazo/rules.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """\ Usage: %prog [-r] RULES @@ -12,15 +11,14 @@ from diazo.utils import namespaces from diazo.utils import pkg_xsl from lxml import etree -from six import string_types -from six.moves.urllib.parse import urljoin -from six.moves.urllib.request import urlopen +from urllib.parse import urljoin +from urllib.request import urlopen import logging import re -logger = logging.getLogger('diazo') +logger = logging.getLogger("diazo") usage = __doc__ IMPORT_STYLESHEET = re.compile( @@ -33,23 +31,23 @@ r"""(?P[^ \t\n\r\f\v>]+)(?P(?P=quote)[^>]*?>)""", re.IGNORECASE, ) -SRCSET = re.compile(r'(?P^\s*|\s*,\s*)(?P[^\s]*)') +SRCSET = re.compile(r"(?P^\s*|\s*,\s*)(?P[^\s]*)") -update_transform = pkg_xsl('update-namespace.xsl') -normalize_rules = pkg_xsl('normalize-rules.xsl') -include = pkg_xsl('include.xsl') -apply_conditions = pkg_xsl('apply-conditions.xsl') -merge_conditions = pkg_xsl('merge-conditions.xsl') -annotate_themes = pkg_xsl('annotate-themes.xsl') -annotate_rules = pkg_xsl('annotate-rules.xsl') -apply_rules = pkg_xsl('apply-rules.xsl') -fixup_themes = pkg_xsl('fixup-themes.xsl') +update_transform = pkg_xsl("update-namespace.xsl") +normalize_rules = pkg_xsl("normalize-rules.xsl") +include = pkg_xsl("include.xsl") +apply_conditions = pkg_xsl("apply-conditions.xsl") +merge_conditions = pkg_xsl("merge-conditions.xsl") +annotate_themes = pkg_xsl("annotate-themes.xsl") +annotate_rules = pkg_xsl("annotate-rules.xsl") +apply_rules = pkg_xsl("apply-rules.xsl") +fixup_themes = pkg_xsl("fixup-themes.xsl") def anchor_safe_urljoin(base, url): """Join the base with the url only when the url doesn't start with '#'""" - if url.startswith('#'): + if url.startswith("#"): return url else: return urljoin(base, url) @@ -59,40 +57,39 @@ def add_identifiers(rules_doc): """Add identifiers to the rules for debugging""" for index, elem in enumerate( rules_doc.xpath( - '//diazo:rules | //diazo:rules/diazo:*' - ' | //old1:rules | //old1:rules/old1:*' - ' | //old2:rules | //old2:rules/old1:*', + "//diazo:rules | //diazo:rules/diazo:*" + " | //old1:rules | //old1:rules/old1:*" + " | //old2:rules | //old2:rules/old1:*", namespaces=namespaces, ), ): elem.set( fullname( - namespaces['xml'], - 'id', + namespaces["xml"], + "id", ), - 'r{index}'.format(index=index), + f"r{index}", ) return rules_doc def update_namespace(rules_doc): - """Convert old namespace to new namespace in place - """ + """Convert old namespace to new namespace in place""" update = False - for ns in (namespaces['old1'], namespaces['old2']): - if rules_doc.xpath("//*[namespace-uri()='{ns:s}']".format(ns=ns)): + for ns in (namespaces["old1"], namespaces["old2"]): + if rules_doc.xpath(f"//*[namespace-uri()='{ns:s}']"): logger.warning( - 'The %s namespace is deprecated, use %s instead.', + "The %s namespace is deprecated, use %s instead.", ns, - namespaces['diazo'], + namespaces["diazo"], ) update = True - for ns in (namespaces['oldcss1'], namespaces['oldcss2']): - if rules_doc.xpath("//@*[namespace-uri()='{ns:s}']".format(ns=ns)): + for ns in (namespaces["oldcss1"], namespaces["oldcss2"]): + if rules_doc.xpath(f"//@*[namespace-uri()='{ns:s}']"): logger.warning( - 'The %s namespace is deprecated, use %s instead.', + "The %s namespace is deprecated, use %s instead.", ns, - namespaces['css'], + namespaces["css"], ) update = True if update: @@ -113,14 +110,14 @@ def update_namespace(rules_doc): def escape_curly_brackets(theme_doc): for node in theme_doc.iter(): for attr in node.attrib: - if '{' in node.attrib[attr]: - node.attrib[attr] = node.attrib[attr].replace('{', '{{') - if '}' in node.attrib[attr]: - node.attrib[attr] = node.attrib[attr].replace('}', '}}') + if "{" in node.attrib[attr]: + node.attrib[attr] = node.attrib[attr].replace("{", "{{") + if "}" in node.attrib[attr]: + node.attrib[attr] = node.attrib[attr].replace("}", "}}") def expand_theme(element, theme_doc, absolute_prefix): - prefix = urljoin(absolute_prefix, element.get('prefix', '')) + prefix = urljoin(absolute_prefix, element.get("prefix", "")) apply_absolute_prefix(theme_doc, prefix) escape_curly_brackets(theme_doc) theme_root = theme_doc.getroot() @@ -138,27 +135,28 @@ def expand_themes( absolute_prefix=None, read_network=False, ): - """Expand nodes with the theme html. - """ + """Expand nodes with the theme html.""" if absolute_prefix is None: - absolute_prefix = '' + absolute_prefix = "" base = rules_doc.docinfo.URL if parser is None: parser = etree.HTMLParser() for element in rules_doc.xpath( - '//diazo:theme[@href]', + "//diazo:theme[@href]", namespaces=namespaces, ): - url = urljoin(base, element.get('href')) - if not read_network and \ - url.startswith(('ftp://', 'ftps://', 'http://', 'https://')): + url = urljoin(base, element.get("href")) + if not read_network and url.startswith( + ("ftp://", "ftps://", "http://", "https://") + ): raise ValueError( "Supplied theme '{url}', but network access denied.".format( url=url, ), ) - elif read_network and \ - url.startswith(('ftp://', 'ftps://', 'http://', 'https://')): + elif read_network and url.startswith( + ("ftp://", "ftps://", "http://", "https://") + ): theme = urlopen(url) else: theme = url @@ -170,51 +168,58 @@ def expand_themes( def apply_absolute_prefix(theme_doc, absolute_prefix): if not absolute_prefix: return - if not absolute_prefix.endswith('/'): - absolute_prefix = absolute_prefix + '/' - for node in theme_doc.xpath('//*[@src]'): - url = urljoin(absolute_prefix, node.get('src')) - node.set('src', url) + if not absolute_prefix.endswith("/"): + absolute_prefix = absolute_prefix + "/" + for node in theme_doc.xpath("//*[@src]"): + url = urljoin(absolute_prefix, node.get("src")) + node.set("src", url) for xlink_attr in theme_doc.xpath('//@*[local-name()="xlink:href"]'): node = xlink_attr.getparent() - url = anchor_safe_urljoin(absolute_prefix, node.get('xlink:href')) - node.set('xlink:href', url) - for node in theme_doc.xpath('//*[@srcset]'): - srcset = node.get('srcset') + url = anchor_safe_urljoin(absolute_prefix, node.get("xlink:href")) + node.set("xlink:href", url) + for node in theme_doc.xpath("//*[@srcset]"): + srcset = node.get("srcset") srcset = SRCSET.sub( - lambda match: match.group('descriptors') + urljoin( + lambda match: match.group("descriptors") + + urljoin( absolute_prefix, - match.group('url'), + match.group("url"), ), srcset, ) - node.set('srcset', srcset) - for node in theme_doc.xpath('//*[@href]'): - url = anchor_safe_urljoin(absolute_prefix, node.get('href')) - node.set('href', url) - for node in theme_doc.xpath('//style'): + node.set("srcset", srcset) + for node in theme_doc.xpath("//*[@href]"): + url = anchor_safe_urljoin(absolute_prefix, node.get("href")) + node.set("href", url) + for node in theme_doc.xpath("//style"): if node.text is None: continue node.text = IMPORT_STYLESHEET.sub( - lambda match: match.group('before') + urljoin( + lambda match: match.group("before") + + urljoin( absolute_prefix, - match.group('url'), - ) + match.group('after'), + match.group("url"), + ) + + match.group("after"), node.text, ) for node in theme_doc.xpath('//comment()[starts-with(., "[if")]'): node.text = IMPORT_STYLESHEET.sub( - lambda match: match.group('before') + urljoin( + lambda match: match.group("before") + + urljoin( absolute_prefix, - match.group('url'), - ) + match.group('after'), + match.group("url"), + ) + + match.group("after"), node.text, ) node.text = CONDITIONAL_SRC.sub( - lambda match: match.group('before') + urljoin( + lambda match: match.group("before") + + urljoin( absolute_prefix, - match.group('url'), - ) + match.group('after'), + match.group("url"), + ) + + match.group("after"), node.text, ) @@ -222,7 +227,7 @@ def apply_absolute_prefix(theme_doc, absolute_prefix): def add_extra(rules_doc, extra): root = rules_doc.getroot() extra_elements = extra.xpath( - '/xsl:stylesheet/xsl:*', + "/xsl:stylesheet/xsl:*", namespaces=namespaces, ) root.extend(extra_elements) @@ -236,20 +241,22 @@ def add_theme( absolute_prefix=None, read_network=False, ): - if not read_network and \ - isinstance(theme, string_types) and \ - theme[:6] in ('ftp://', 'http:/', 'https:'): + if ( + not read_network + and isinstance(theme, str) + and theme[:6] in ("ftp://", "http:/", "https:") + ): raise ValueError( "Supplied theme '{theme}', but network access denied.".format( theme=theme, ), ) if absolute_prefix is None: - absolute_prefix = '' + absolute_prefix = "" if parser is None: parser = etree.HTMLParser() root = rules_doc.getroot() - element = root.makeelement(fullname(namespaces['diazo'], 'theme')) + element = root.makeelement(fullname(namespaces["diazo"], "theme")) root.append(element) theme_doc = etree.parse(theme, parser=parser) expand_theme(element, theme_doc, absolute_prefix) @@ -262,9 +269,9 @@ def fixup_theme_comment_selectors(rules): selector needs rewriting to replace comment() with xsl:comment """ for element in rules.xpath("//@theme[contains(., 'comment()')]/.."): - element.attrib['theme'] = element.attrib['theme'].replace( - 'comment()', - 'xsl:comment', + element.attrib["theme"] = element.attrib["theme"].replace( + "comment()", + "xsl:comment", ) return rules @@ -285,9 +292,9 @@ def process_rules( stop=None, ): if trace: - trace = '1' + trace = "1" else: - trace = '0' + trace = "0" if rules_parser is None: rules_parser = etree.XMLParser(recover=False) rules_doc = etree.parse(rules, parser=rules_parser) @@ -302,7 +309,7 @@ def process_rules( if stop == 1: return rules_doc rules_doc = add_identifiers(rules_doc) - if stop == 2 or stop == 'add_identifiers': + if stop == 2 or stop == "add_identifiers": return rules_doc if update: rules_doc = update_namespace(rules_doc) @@ -327,8 +334,8 @@ def process_rules( if stop == 6: return rules_doc if includemode is None: - includemode = 'document' - includemode = "'{mode:s}'".format(mode=includemode) + includemode = "document" + includemode = f"'{includemode:s}'" rules_doc = normalize_rules(rules_doc, includemode=includemode) if stop == 7: return rules_doc @@ -355,16 +362,15 @@ def process_rules( def main(): - """Called from console script - """ + """Called from console script""" parser = _createOptionParser(usage=usage) parser.add_option( - '-s', - '--stop', - metavar='n', - type='int', - help='Stop preprocessing at stage n', - dest='stop', + "-s", + "--stop", + metavar="n", + type="int", + help="Stop preprocessing at stage n", + dest="stop", default=None, ) (options, args) = parser.parse_args() @@ -373,11 +379,11 @@ def main(): if len(args) == 2 and options.theme is None: options.rules, options.theme = args elif len(args) == 1: - options.rules, = args + (options.rules,) = args else: - parser.error('Wrong number of arguments.') + parser.error("Wrong number of arguments.") elif args: - parser.error('Wrong number of arguments.') + parser.error("Wrong number of arguments.") if options.trace: logger.setLevel(logging.DEBUG) @@ -394,9 +400,9 @@ def main(): ) root = rules_doc.getroot() if not root.tail: - root.tail = '\n' + root.tail = "\n" rules_doc.write(options.output, pretty_print=options.pretty_print) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/lib/diazo/run.py b/src/diazo/run.py similarity index 70% rename from lib/diazo/run.py rename to src/diazo/run.py index 62264a72..5d1a9f5e 100644 --- a/lib/diazo/run.py +++ b/src/diazo/run.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- """\ Usage: %prog -x TRANSFORM CONTENT @@ -16,7 +15,6 @@ from diazo.utils import quote_param from diazo.utils import split_params from lxml import etree -from six import string_types import diazo.runtrace import logging @@ -24,7 +22,7 @@ import sys -logger = logging.getLogger('diazo') +logger = logging.getLogger("diazo") usage = __doc__ @@ -35,7 +33,7 @@ def __init__(self, directory): def resolve(self, url, id, context): # libxml2 does not do this correctly on it's own with the HTMLParser # but it does work in Apache - if '://' in url or url.startswith('/'): + if "://" in url or url.startswith("/"): # It seems we must explicitly resolve the url here return self.resolve_filename(url, context) url = os.path.join(self.directory, url) @@ -43,63 +41,62 @@ def resolve(self, url, id, context): def main(): - """Called from console script - """ + """Called from console script""" op = _createOptionParser(usage=usage) op.add_option( - '-x', - '--xsl', - metavar='transform.xsl', - help='XSL transform', - dest='xsl', + "-x", + "--xsl", + metavar="transform.xsl", + help="XSL transform", + dest="xsl", default=None, ) op.add_option( - '--path', - metavar='PATH', - help='URI path', - dest='path', + "--path", + metavar="PATH", + help="URI path", + dest="path", default=None, ) op.add_option( - '--parameters', - metavar='param1=val1,param2=val2', - help='Set the values of arbitrary parameters', - dest='parameters', + "--parameters", + metavar="param1=val1,param2=val2", + help="Set the values of arbitrary parameters", + dest="parameters", default=None, ) op.add_option( - '--runtrace-xml', - metavar='runtrace.xml', - help='Write an xml format runtrace to file', - dest='runtrace_xml', + "--runtrace-xml", + metavar="runtrace.xml", + help="Write an xml format runtrace to file", + dest="runtrace_xml", default=None, ) op.add_option( - '--runtrace-html', - metavar='runtrace.html', - help='Write an html format runtrace to file', - dest='runtrace_html', + "--runtrace-html", + metavar="runtrace.html", + help="Write an html format runtrace to file", + dest="runtrace_html", default=None, ) (options, args) = op.parse_args() if len(args) > 2: - op.error('Wrong number of arguments.') + op.error("Wrong number of arguments.") elif len(args) == 2: if options.xsl or options.rules: - op.error('Wrong number of arguments.') + op.error("Wrong number of arguments.") path, content = args - if path.lower().endswith('.xsl'): + if path.lower().endswith(".xsl"): options.xsl = path else: options.rules = path elif len(args) == 1: - content, = args + (content,) = args else: - op.error('Wrong number of arguments.') + op.error("Wrong number of arguments.") if options.rules is None and options.xsl is None: - op.error('Must supply either options or rules') + op.error("Must supply either options or rules") if options.trace: logger.setLevel(logging.DEBUG) @@ -131,7 +128,7 @@ def main(): runtrace=runtrace, ) - if content == '-': + if content == "-": content = sys.stdin if options.read_network: @@ -143,15 +140,15 @@ def main(): content_doc = etree.parse(content, parser=parser) params = {} if options.path is not None: - params['path'] = "'{path}'".format(path=options.path) + params["path"] = f"'{options.path}'" if options.parameters: for key, value in split_params(options.parameters).items(): params[key] = quote_param(value) output_html = transform(content_doc, **params) - if isinstance(options.output, string_types): - out = open(options.output, 'wt') + if isinstance(options.output, str): + out = open(options.output, "w") else: out = options.output out.write(str(output_html)) @@ -162,26 +159,26 @@ def main(): error_log=transform.error_log, ) if options.runtrace_xml: - if options.runtrace_xml == '-': + if options.runtrace_xml == "-": out = sys.stdout else: - out = open(options.runtrace_xml, 'wt') + out = open(options.runtrace_xml, "w") runtrace_doc.write( out, - encoding='utf-8', + encoding="utf-8", pretty_print=options.pretty_print, ) if options.runtrace_html: - if options.runtrace_html == '-': + if options.runtrace_html == "-": out = sys.stdout else: - out = open(options.runtrace_html, 'wt') + out = open(options.runtrace_html, "w") out.write(str(diazo.runtrace.runtrace_to_html(runtrace_doc))) for msg in transform.error_log: - if not msg.message.startswith(' + {message:s} + +""".format( + message="".join(msgs) + ) + + +def generate_runtrace(rules, error_log, rules_parser=None): + """Annotate a rules file with the results of a transformation""" + + def condition_name(trace): + """Generate attribute name for this entry""" + for k in trace.attrib.keys(): + if k == "theme_xmlid": + continue + if k.startswith("{http://namespaces.plone.org/diazo/css}"): + continue + return "runtrace-" + k + + rules_doc = process_rules( + rules, + rules_parser=rules_parser, + stop="add_identifiers", + ) + trace_doc = etree.XML(log_to_xml_string(error_log)) + + for trace in trace_doc.xpath("/runtrace/runtrace"): + for el in rules_doc.xpath("id('" + trace.attrib["theme_xmlid"] + "')"): + el.set(condition_name(trace), trace.text or "") + return rules_doc + + +def runtrace_to_html(runtrace_doc): + """Convert the runtrace document into HTML""" + return _runtrace_to_html(runtrace_doc) + + +def error_log_to_html(error_log): + """Convert an error log into an HTML representation""" + doc = etree.Element("ul") + for log in error_log: + if log.message.startswith("Smaller Title

content

new item from content -
Someting very great from last content's DIV
+
Something very great from last content's DIV
diff --git a/lib/diazo/tests/css-xpath-child-selectors/output.html b/src/diazo/tests/css-xpath-child-selectors/output.html similarity index 89% rename from lib/diazo/tests/css-xpath-child-selectors/output.html rename to src/diazo/tests/css-xpath-child-selectors/output.html index 3352e840..a910a37d 100644 --- a/lib/diazo/tests/css-xpath-child-selectors/output.html +++ b/src/diazo/tests/css-xpath-child-selectors/output.html @@ -6,7 +6,7 @@
-
Someting very great from last content's DIV
+
Something very great from last content's DIV
Third Marker diff --git a/lib/diazo/tests/css-xpath-child-selectors/rules.xml b/src/diazo/tests/css-xpath-child-selectors/rules.xml similarity index 100% rename from lib/diazo/tests/css-xpath-child-selectors/rules.xml rename to src/diazo/tests/css-xpath-child-selectors/rules.xml diff --git a/lib/diazo/tests/css-xpath-child-selectors/theme.html b/src/diazo/tests/css-xpath-child-selectors/theme.html similarity index 100% rename from lib/diazo/tests/css-xpath-child-selectors/theme.html rename to src/diazo/tests/css-xpath-child-selectors/theme.html diff --git a/lib/diazo/tests/css-xsl-template/content.html b/src/diazo/tests/css-xsl-template/content.html similarity index 100% rename from lib/diazo/tests/css-xsl-template/content.html rename to src/diazo/tests/css-xsl-template/content.html diff --git a/lib/diazo/tests/css-xsl-template/output.html b/src/diazo/tests/css-xsl-template/output.html similarity index 100% rename from lib/diazo/tests/css-xsl-template/output.html rename to src/diazo/tests/css-xsl-template/output.html diff --git a/lib/diazo/tests/css-xsl-template/rules.xml b/src/diazo/tests/css-xsl-template/rules.xml similarity index 100% rename from lib/diazo/tests/css-xsl-template/rules.xml rename to src/diazo/tests/css-xsl-template/rules.xml diff --git a/lib/diazo/tests/css-xsl-template/theme.html b/src/diazo/tests/css-xsl-template/theme.html similarity index 100% rename from lib/diazo/tests/css-xsl-template/theme.html rename to src/diazo/tests/css-xsl-template/theme.html diff --git a/lib/diazo/tests/default-options.cfg b/src/diazo/tests/default-options.cfg similarity index 100% rename from lib/diazo/tests/default-options.cfg rename to src/diazo/tests/default-options.cfg diff --git a/lib/diazo/tests/document-includes/content.html b/src/diazo/tests/document-includes/content.html similarity index 100% rename from lib/diazo/tests/document-includes/content.html rename to src/diazo/tests/document-includes/content.html diff --git a/lib/diazo/tests/document-includes/extra.html b/src/diazo/tests/document-includes/extra.html similarity index 100% rename from lib/diazo/tests/document-includes/extra.html rename to src/diazo/tests/document-includes/extra.html diff --git a/lib/diazo/tests/document-includes/output.html b/src/diazo/tests/document-includes/output.html similarity index 100% rename from lib/diazo/tests/document-includes/output.html rename to src/diazo/tests/document-includes/output.html diff --git a/lib/diazo/tests/document-includes/rules.xml b/src/diazo/tests/document-includes/rules.xml similarity index 100% rename from lib/diazo/tests/document-includes/rules.xml rename to src/diazo/tests/document-includes/rules.xml diff --git a/lib/diazo/tests/document-includes/theme.html b/src/diazo/tests/document-includes/theme.html similarity index 100% rename from lib/diazo/tests/document-includes/theme.html rename to src/diazo/tests/document-includes/theme.html diff --git a/lib/diazo/tests/document-includes/xpaths.txt b/src/diazo/tests/document-includes/xpaths.txt similarity index 100% rename from lib/diazo/tests/document-includes/xpaths.txt rename to src/diazo/tests/document-includes/xpaths.txt diff --git a/lib/diazo/tests/drop-content-comment/content.html b/src/diazo/tests/drop-content-comment/content.html similarity index 100% rename from lib/diazo/tests/drop-content-comment/content.html rename to src/diazo/tests/drop-content-comment/content.html diff --git a/lib/diazo/tests/drop-content-comment/output.html b/src/diazo/tests/drop-content-comment/output.html similarity index 100% rename from lib/diazo/tests/drop-content-comment/output.html rename to src/diazo/tests/drop-content-comment/output.html diff --git a/lib/diazo/tests/drop-content-comment/rules.xml b/src/diazo/tests/drop-content-comment/rules.xml similarity index 100% rename from lib/diazo/tests/drop-content-comment/rules.xml rename to src/diazo/tests/drop-content-comment/rules.xml diff --git a/lib/diazo/tests/drop-content-comment/theme.html b/src/diazo/tests/drop-content-comment/theme.html similarity index 100% rename from lib/diazo/tests/drop-content-comment/theme.html rename to src/diazo/tests/drop-content-comment/theme.html diff --git a/lib/diazo/tests/drop-content/content.html b/src/diazo/tests/drop-content/content.html similarity index 100% rename from lib/diazo/tests/drop-content/content.html rename to src/diazo/tests/drop-content/content.html diff --git a/lib/diazo/tests/drop-content/output.html b/src/diazo/tests/drop-content/output.html similarity index 100% rename from lib/diazo/tests/drop-content/output.html rename to src/diazo/tests/drop-content/output.html diff --git a/lib/diazo/tests/drop-content/rules.xml b/src/diazo/tests/drop-content/rules.xml similarity index 100% rename from lib/diazo/tests/drop-content/rules.xml rename to src/diazo/tests/drop-content/rules.xml diff --git a/lib/diazo/tests/drop-content/theme.html b/src/diazo/tests/drop-content/theme.html similarity index 100% rename from lib/diazo/tests/drop-content/theme.html rename to src/diazo/tests/drop-content/theme.html diff --git a/lib/diazo/tests/drop-content/xpaths.txt b/src/diazo/tests/drop-content/xpaths.txt similarity index 100% rename from lib/diazo/tests/drop-content/xpaths.txt rename to src/diazo/tests/drop-content/xpaths.txt diff --git a/lib/diazo/tests/drop-replace/content.html b/src/diazo/tests/drop-replace/content.html similarity index 100% rename from lib/diazo/tests/drop-replace/content.html rename to src/diazo/tests/drop-replace/content.html diff --git a/lib/diazo/tests/drop-replace/output.html b/src/diazo/tests/drop-replace/output.html similarity index 100% rename from lib/diazo/tests/drop-replace/output.html rename to src/diazo/tests/drop-replace/output.html diff --git a/lib/diazo/tests/drop-replace/rules.xml b/src/diazo/tests/drop-replace/rules.xml similarity index 100% rename from lib/diazo/tests/drop-replace/rules.xml rename to src/diazo/tests/drop-replace/rules.xml diff --git a/lib/diazo/tests/drop-replace/theme.html b/src/diazo/tests/drop-replace/theme.html similarity index 100% rename from lib/diazo/tests/drop-replace/theme.html rename to src/diazo/tests/drop-replace/theme.html diff --git a/lib/diazo/tests/drop-theme-children/content.html b/src/diazo/tests/drop-theme-children/content.html similarity index 100% rename from lib/diazo/tests/drop-theme-children/content.html rename to src/diazo/tests/drop-theme-children/content.html diff --git a/lib/diazo/tests/drop-theme-children/output.html b/src/diazo/tests/drop-theme-children/output.html similarity index 100% rename from lib/diazo/tests/drop-theme-children/output.html rename to src/diazo/tests/drop-theme-children/output.html diff --git a/lib/diazo/tests/drop-theme-children/rules.xml b/src/diazo/tests/drop-theme-children/rules.xml similarity index 100% rename from lib/diazo/tests/drop-theme-children/rules.xml rename to src/diazo/tests/drop-theme-children/rules.xml diff --git a/lib/diazo/tests/drop-theme-children/theme.html b/src/diazo/tests/drop-theme-children/theme.html similarity index 100% rename from lib/diazo/tests/drop-theme-children/theme.html rename to src/diazo/tests/drop-theme-children/theme.html diff --git a/lib/diazo/tests/drop-theme-comment/content.html b/src/diazo/tests/drop-theme-comment/content.html similarity index 100% rename from lib/diazo/tests/drop-theme-comment/content.html rename to src/diazo/tests/drop-theme-comment/content.html diff --git a/lib/diazo/tests/drop-theme-comment/output.html b/src/diazo/tests/drop-theme-comment/output.html similarity index 100% rename from lib/diazo/tests/drop-theme-comment/output.html rename to src/diazo/tests/drop-theme-comment/output.html diff --git a/lib/diazo/tests/drop-theme-comment/rules.xml b/src/diazo/tests/drop-theme-comment/rules.xml similarity index 100% rename from lib/diazo/tests/drop-theme-comment/rules.xml rename to src/diazo/tests/drop-theme-comment/rules.xml diff --git a/lib/diazo/tests/drop-theme-comment/theme.html b/src/diazo/tests/drop-theme-comment/theme.html similarity index 100% rename from lib/diazo/tests/drop-theme-comment/theme.html rename to src/diazo/tests/drop-theme-comment/theme.html diff --git a/lib/diazo/tests/empty-xmlns/README.txt b/src/diazo/tests/empty-xmlns/README.txt similarity index 100% rename from lib/diazo/tests/empty-xmlns/README.txt rename to src/diazo/tests/empty-xmlns/README.txt diff --git a/lib/diazo/tests/empty-xmlns/content.html b/src/diazo/tests/empty-xmlns/content.html similarity index 100% rename from lib/diazo/tests/empty-xmlns/content.html rename to src/diazo/tests/empty-xmlns/content.html diff --git a/lib/diazo/tests/empty-xmlns/output.html b/src/diazo/tests/empty-xmlns/output.html similarity index 100% rename from lib/diazo/tests/empty-xmlns/output.html rename to src/diazo/tests/empty-xmlns/output.html diff --git a/lib/diazo/tests/empty-xmlns/rules.xml b/src/diazo/tests/empty-xmlns/rules.xml similarity index 100% rename from lib/diazo/tests/empty-xmlns/rules.xml rename to src/diazo/tests/empty-xmlns/rules.xml diff --git a/lib/diazo/tests/empty-xmlns/theme.html b/src/diazo/tests/empty-xmlns/theme.html similarity index 100% rename from lib/diazo/tests/empty-xmlns/theme.html rename to src/diazo/tests/empty-xmlns/theme.html diff --git a/lib/diazo/tests/entities/content.html b/src/diazo/tests/entities/content.html similarity index 100% rename from lib/diazo/tests/entities/content.html rename to src/diazo/tests/entities/content.html diff --git a/lib/diazo/tests/entities/output.html b/src/diazo/tests/entities/output.html similarity index 100% rename from lib/diazo/tests/entities/output.html rename to src/diazo/tests/entities/output.html diff --git a/lib/diazo/tests/entities/rules.xml b/src/diazo/tests/entities/rules.xml similarity index 100% rename from lib/diazo/tests/entities/rules.xml rename to src/diazo/tests/entities/rules.xml diff --git a/lib/diazo/tests/entities/theme.html b/src/diazo/tests/entities/theme.html similarity index 100% rename from lib/diazo/tests/entities/theme.html rename to src/diazo/tests/entities/theme.html diff --git a/lib/diazo/tests/esi/content.html b/src/diazo/tests/esi/content.html similarity index 100% rename from lib/diazo/tests/esi/content.html rename to src/diazo/tests/esi/content.html diff --git a/lib/diazo/tests/esi/output.html b/src/diazo/tests/esi/output.html similarity index 100% rename from lib/diazo/tests/esi/output.html rename to src/diazo/tests/esi/output.html diff --git a/lib/diazo/tests/esi/rules.xml b/src/diazo/tests/esi/rules.xml similarity index 100% rename from lib/diazo/tests/esi/rules.xml rename to src/diazo/tests/esi/rules.xml diff --git a/lib/diazo/tests/esi/theme.html b/src/diazo/tests/esi/theme.html similarity index 100% rename from lib/diazo/tests/esi/theme.html rename to src/diazo/tests/esi/theme.html diff --git a/lib/diazo/tests/esi/xpaths.txt b/src/diazo/tests/esi/xpaths.txt similarity index 100% rename from lib/diazo/tests/esi/xpaths.txt rename to src/diazo/tests/esi/xpaths.txt diff --git a/lib/diazo/tests/html-attributes/content.html b/src/diazo/tests/html-attributes/content.html similarity index 100% rename from lib/diazo/tests/html-attributes/content.html rename to src/diazo/tests/html-attributes/content.html diff --git a/lib/diazo/tests/html-attributes/output.html b/src/diazo/tests/html-attributes/output.html similarity index 100% rename from lib/diazo/tests/html-attributes/output.html rename to src/diazo/tests/html-attributes/output.html diff --git a/lib/diazo/tests/html-attributes/rules.xml b/src/diazo/tests/html-attributes/rules.xml similarity index 100% rename from lib/diazo/tests/html-attributes/rules.xml rename to src/diazo/tests/html-attributes/rules.xml diff --git a/lib/diazo/tests/html-attributes/theme.html b/src/diazo/tests/html-attributes/theme.html similarity index 100% rename from lib/diazo/tests/html-attributes/theme.html rename to src/diazo/tests/html-attributes/theme.html diff --git a/lib/diazo/tests/html-xml-lang-2/content.html b/src/diazo/tests/html-xml-lang-2/content.html similarity index 100% rename from lib/diazo/tests/html-xml-lang-2/content.html rename to src/diazo/tests/html-xml-lang-2/content.html diff --git a/lib/diazo/tests/html-xml-lang-2/output.html b/src/diazo/tests/html-xml-lang-2/output.html similarity index 100% rename from lib/diazo/tests/html-xml-lang-2/output.html rename to src/diazo/tests/html-xml-lang-2/output.html diff --git a/lib/diazo/tests/html-xml-lang-2/rules.xml b/src/diazo/tests/html-xml-lang-2/rules.xml similarity index 100% rename from lib/diazo/tests/html-xml-lang-2/rules.xml rename to src/diazo/tests/html-xml-lang-2/rules.xml diff --git a/lib/diazo/tests/html-xml-lang-2/theme.html b/src/diazo/tests/html-xml-lang-2/theme.html similarity index 100% rename from lib/diazo/tests/html-xml-lang-2/theme.html rename to src/diazo/tests/html-xml-lang-2/theme.html diff --git a/lib/diazo/tests/html-xml-lang-3/content.html b/src/diazo/tests/html-xml-lang-3/content.html similarity index 100% rename from lib/diazo/tests/html-xml-lang-3/content.html rename to src/diazo/tests/html-xml-lang-3/content.html diff --git a/lib/diazo/tests/html-xml-lang-3/output.html b/src/diazo/tests/html-xml-lang-3/output.html similarity index 100% rename from lib/diazo/tests/html-xml-lang-3/output.html rename to src/diazo/tests/html-xml-lang-3/output.html diff --git a/lib/diazo/tests/html-xml-lang-3/rules.xml b/src/diazo/tests/html-xml-lang-3/rules.xml similarity index 100% rename from lib/diazo/tests/html-xml-lang-3/rules.xml rename to src/diazo/tests/html-xml-lang-3/rules.xml diff --git a/lib/diazo/tests/html-xml-lang-3/theme.html b/src/diazo/tests/html-xml-lang-3/theme.html similarity index 100% rename from lib/diazo/tests/html-xml-lang-3/theme.html rename to src/diazo/tests/html-xml-lang-3/theme.html diff --git a/lib/diazo/tests/html-xml-lang/content.html b/src/diazo/tests/html-xml-lang/content.html similarity index 100% rename from lib/diazo/tests/html-xml-lang/content.html rename to src/diazo/tests/html-xml-lang/content.html diff --git a/lib/diazo/tests/html-xml-lang/output.html b/src/diazo/tests/html-xml-lang/output.html similarity index 100% rename from lib/diazo/tests/html-xml-lang/output.html rename to src/diazo/tests/html-xml-lang/output.html diff --git a/lib/diazo/tests/html-xml-lang/rules.xml b/src/diazo/tests/html-xml-lang/rules.xml similarity index 100% rename from lib/diazo/tests/html-xml-lang/rules.xml rename to src/diazo/tests/html-xml-lang/rules.xml diff --git a/lib/diazo/tests/html-xml-lang/theme.html b/src/diazo/tests/html-xml-lang/theme.html similarity index 100% rename from lib/diazo/tests/html-xml-lang/theme.html rename to src/diazo/tests/html-xml-lang/theme.html diff --git a/lib/diazo/tests/if-path-1/content.html b/src/diazo/tests/if-path-1/content.html similarity index 100% rename from lib/diazo/tests/if-path-1/content.html rename to src/diazo/tests/if-path-1/content.html diff --git a/lib/diazo/tests/if-path-1/options.cfg b/src/diazo/tests/if-path-1/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-1/options.cfg rename to src/diazo/tests/if-path-1/options.cfg diff --git a/lib/diazo/tests/if-path-1/output.html b/src/diazo/tests/if-path-1/output.html similarity index 100% rename from lib/diazo/tests/if-path-1/output.html rename to src/diazo/tests/if-path-1/output.html diff --git a/lib/diazo/tests/if-path-1/rules.xml b/src/diazo/tests/if-path-1/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-1/rules.xml rename to src/diazo/tests/if-path-1/rules.xml diff --git a/lib/diazo/tests/if-path-1/theme.html b/src/diazo/tests/if-path-1/theme.html similarity index 100% rename from lib/diazo/tests/if-path-1/theme.html rename to src/diazo/tests/if-path-1/theme.html diff --git a/lib/diazo/tests/if-path-2/content.html b/src/diazo/tests/if-path-2/content.html similarity index 100% rename from lib/diazo/tests/if-path-2/content.html rename to src/diazo/tests/if-path-2/content.html diff --git a/lib/diazo/tests/if-path-2/options.cfg b/src/diazo/tests/if-path-2/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-2/options.cfg rename to src/diazo/tests/if-path-2/options.cfg diff --git a/lib/diazo/tests/if-path-2/output.html b/src/diazo/tests/if-path-2/output.html similarity index 100% rename from lib/diazo/tests/if-path-2/output.html rename to src/diazo/tests/if-path-2/output.html diff --git a/lib/diazo/tests/if-path-2/rules.xml b/src/diazo/tests/if-path-2/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-2/rules.xml rename to src/diazo/tests/if-path-2/rules.xml diff --git a/lib/diazo/tests/if-path-2/theme.html b/src/diazo/tests/if-path-2/theme.html similarity index 100% rename from lib/diazo/tests/if-path-2/theme.html rename to src/diazo/tests/if-path-2/theme.html diff --git a/lib/diazo/tests/if-path-3/content.html b/src/diazo/tests/if-path-3/content.html similarity index 100% rename from lib/diazo/tests/if-path-3/content.html rename to src/diazo/tests/if-path-3/content.html diff --git a/lib/diazo/tests/if-path-3/options.cfg b/src/diazo/tests/if-path-3/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-3/options.cfg rename to src/diazo/tests/if-path-3/options.cfg diff --git a/lib/diazo/tests/if-path-3/output.html b/src/diazo/tests/if-path-3/output.html similarity index 100% rename from lib/diazo/tests/if-path-3/output.html rename to src/diazo/tests/if-path-3/output.html diff --git a/lib/diazo/tests/if-path-3/rules.xml b/src/diazo/tests/if-path-3/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-3/rules.xml rename to src/diazo/tests/if-path-3/rules.xml diff --git a/lib/diazo/tests/if-path-3/theme.html b/src/diazo/tests/if-path-3/theme.html similarity index 100% rename from lib/diazo/tests/if-path-3/theme.html rename to src/diazo/tests/if-path-3/theme.html diff --git a/lib/diazo/tests/if-path-4/content.html b/src/diazo/tests/if-path-4/content.html similarity index 100% rename from lib/diazo/tests/if-path-4/content.html rename to src/diazo/tests/if-path-4/content.html diff --git a/lib/diazo/tests/if-path-4/options.cfg b/src/diazo/tests/if-path-4/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-4/options.cfg rename to src/diazo/tests/if-path-4/options.cfg diff --git a/lib/diazo/tests/if-path-4/output.html b/src/diazo/tests/if-path-4/output.html similarity index 100% rename from lib/diazo/tests/if-path-4/output.html rename to src/diazo/tests/if-path-4/output.html diff --git a/lib/diazo/tests/if-path-4/rules.xml b/src/diazo/tests/if-path-4/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-4/rules.xml rename to src/diazo/tests/if-path-4/rules.xml diff --git a/lib/diazo/tests/if-path-4/theme.html b/src/diazo/tests/if-path-4/theme.html similarity index 100% rename from lib/diazo/tests/if-path-4/theme.html rename to src/diazo/tests/if-path-4/theme.html diff --git a/lib/diazo/tests/if-path-5/content.html b/src/diazo/tests/if-path-5/content.html similarity index 100% rename from lib/diazo/tests/if-path-5/content.html rename to src/diazo/tests/if-path-5/content.html diff --git a/lib/diazo/tests/if-path-5/options.cfg b/src/diazo/tests/if-path-5/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-5/options.cfg rename to src/diazo/tests/if-path-5/options.cfg diff --git a/lib/diazo/tests/if-path-5/output.html b/src/diazo/tests/if-path-5/output.html similarity index 100% rename from lib/diazo/tests/if-path-5/output.html rename to src/diazo/tests/if-path-5/output.html diff --git a/lib/diazo/tests/if-path-5/rules.xml b/src/diazo/tests/if-path-5/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-5/rules.xml rename to src/diazo/tests/if-path-5/rules.xml diff --git a/lib/diazo/tests/if-path-5/theme.html b/src/diazo/tests/if-path-5/theme.html similarity index 100% rename from lib/diazo/tests/if-path-5/theme.html rename to src/diazo/tests/if-path-5/theme.html diff --git a/lib/diazo/tests/if-path-6/content.html b/src/diazo/tests/if-path-6/content.html similarity index 100% rename from lib/diazo/tests/if-path-6/content.html rename to src/diazo/tests/if-path-6/content.html diff --git a/lib/diazo/tests/if-path-6/options.cfg b/src/diazo/tests/if-path-6/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-6/options.cfg rename to src/diazo/tests/if-path-6/options.cfg diff --git a/lib/diazo/tests/if-path-6/output.html b/src/diazo/tests/if-path-6/output.html similarity index 100% rename from lib/diazo/tests/if-path-6/output.html rename to src/diazo/tests/if-path-6/output.html diff --git a/lib/diazo/tests/if-path-6/rules.xml b/src/diazo/tests/if-path-6/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-6/rules.xml rename to src/diazo/tests/if-path-6/rules.xml diff --git a/lib/diazo/tests/if-path-6/theme.html b/src/diazo/tests/if-path-6/theme.html similarity index 100% rename from lib/diazo/tests/if-path-6/theme.html rename to src/diazo/tests/if-path-6/theme.html diff --git a/lib/diazo/tests/if-path-7/content.html b/src/diazo/tests/if-path-7/content.html similarity index 100% rename from lib/diazo/tests/if-path-7/content.html rename to src/diazo/tests/if-path-7/content.html diff --git a/lib/diazo/tests/if-path-7/options.cfg b/src/diazo/tests/if-path-7/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-7/options.cfg rename to src/diazo/tests/if-path-7/options.cfg diff --git a/lib/diazo/tests/if-path-7/output.html b/src/diazo/tests/if-path-7/output.html similarity index 100% rename from lib/diazo/tests/if-path-7/output.html rename to src/diazo/tests/if-path-7/output.html diff --git a/lib/diazo/tests/if-path-7/rules.xml b/src/diazo/tests/if-path-7/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-7/rules.xml rename to src/diazo/tests/if-path-7/rules.xml diff --git a/lib/diazo/tests/if-path-7/theme.html b/src/diazo/tests/if-path-7/theme.html similarity index 100% rename from lib/diazo/tests/if-path-7/theme.html rename to src/diazo/tests/if-path-7/theme.html diff --git a/lib/diazo/tests/if-path-8/content.html b/src/diazo/tests/if-path-8/content.html similarity index 100% rename from lib/diazo/tests/if-path-8/content.html rename to src/diazo/tests/if-path-8/content.html diff --git a/lib/diazo/tests/if-path-8/options.cfg b/src/diazo/tests/if-path-8/options.cfg similarity index 100% rename from lib/diazo/tests/if-path-8/options.cfg rename to src/diazo/tests/if-path-8/options.cfg diff --git a/lib/diazo/tests/if-path-8/output.html b/src/diazo/tests/if-path-8/output.html similarity index 100% rename from lib/diazo/tests/if-path-8/output.html rename to src/diazo/tests/if-path-8/output.html diff --git a/lib/diazo/tests/if-path-8/rules.xml b/src/diazo/tests/if-path-8/rules.xml similarity index 100% rename from lib/diazo/tests/if-path-8/rules.xml rename to src/diazo/tests/if-path-8/rules.xml diff --git a/lib/diazo/tests/if-path-8/theme.html b/src/diazo/tests/if-path-8/theme.html similarity index 100% rename from lib/diazo/tests/if-path-8/theme.html rename to src/diazo/tests/if-path-8/theme.html diff --git a/lib/diazo/tests/include-content/content.html b/src/diazo/tests/include-content/content.html similarity index 100% rename from lib/diazo/tests/include-content/content.html rename to src/diazo/tests/include-content/content.html diff --git a/lib/diazo/tests/include-content/extra.html b/src/diazo/tests/include-content/extra.html similarity index 100% rename from lib/diazo/tests/include-content/extra.html rename to src/diazo/tests/include-content/extra.html diff --git a/lib/diazo/tests/include-content/output.html b/src/diazo/tests/include-content/output.html similarity index 100% rename from lib/diazo/tests/include-content/output.html rename to src/diazo/tests/include-content/output.html diff --git a/lib/diazo/tests/include-content/rules.xml b/src/diazo/tests/include-content/rules.xml similarity index 100% rename from lib/diazo/tests/include-content/rules.xml rename to src/diazo/tests/include-content/rules.xml diff --git a/lib/diazo/tests/include-content/theme.html b/src/diazo/tests/include-content/theme.html similarity index 100% rename from lib/diazo/tests/include-content/theme.html rename to src/diazo/tests/include-content/theme.html diff --git a/lib/diazo/tests/indent-off/content.html b/src/diazo/tests/indent-off/content.html similarity index 100% rename from lib/diazo/tests/indent-off/content.html rename to src/diazo/tests/indent-off/content.html diff --git a/lib/diazo/tests/indent-off/options.cfg b/src/diazo/tests/indent-off/options.cfg similarity index 100% rename from lib/diazo/tests/indent-off/options.cfg rename to src/diazo/tests/indent-off/options.cfg diff --git a/lib/diazo/tests/indent-off/output.html b/src/diazo/tests/indent-off/output.html similarity index 100% rename from lib/diazo/tests/indent-off/output.html rename to src/diazo/tests/indent-off/output.html diff --git a/lib/diazo/tests/indent-off/rules.xml b/src/diazo/tests/indent-off/rules.xml similarity index 100% rename from lib/diazo/tests/indent-off/rules.xml rename to src/diazo/tests/indent-off/rules.xml diff --git a/lib/diazo/tests/indent-off/theme.html b/src/diazo/tests/indent-off/theme.html similarity index 100% rename from lib/diazo/tests/indent-off/theme.html rename to src/diazo/tests/indent-off/theme.html diff --git a/lib/diazo/tests/inline-xsl-apply-templates/content.html b/src/diazo/tests/inline-xsl-apply-templates/content.html similarity index 100% rename from lib/diazo/tests/inline-xsl-apply-templates/content.html rename to src/diazo/tests/inline-xsl-apply-templates/content.html diff --git a/lib/diazo/tests/inline-xsl-apply-templates/output.html b/src/diazo/tests/inline-xsl-apply-templates/output.html similarity index 100% rename from lib/diazo/tests/inline-xsl-apply-templates/output.html rename to src/diazo/tests/inline-xsl-apply-templates/output.html diff --git a/lib/diazo/tests/inline-xsl-apply-templates/rules.xml b/src/diazo/tests/inline-xsl-apply-templates/rules.xml similarity index 100% rename from lib/diazo/tests/inline-xsl-apply-templates/rules.xml rename to src/diazo/tests/inline-xsl-apply-templates/rules.xml diff --git a/lib/diazo/tests/inline-xsl-apply-templates/theme.html b/src/diazo/tests/inline-xsl-apply-templates/theme.html similarity index 100% rename from lib/diazo/tests/inline-xsl-apply-templates/theme.html rename to src/diazo/tests/inline-xsl-apply-templates/theme.html diff --git a/lib/diazo/tests/inline-xsl-directives/content.html b/src/diazo/tests/inline-xsl-directives/content.html similarity index 100% rename from lib/diazo/tests/inline-xsl-directives/content.html rename to src/diazo/tests/inline-xsl-directives/content.html diff --git a/lib/diazo/tests/inline-xsl-directives/output.html b/src/diazo/tests/inline-xsl-directives/output.html similarity index 100% rename from lib/diazo/tests/inline-xsl-directives/output.html rename to src/diazo/tests/inline-xsl-directives/output.html diff --git a/lib/diazo/tests/inline-xsl-directives/rules.xml b/src/diazo/tests/inline-xsl-directives/rules.xml similarity index 100% rename from lib/diazo/tests/inline-xsl-directives/rules.xml rename to src/diazo/tests/inline-xsl-directives/rules.xml diff --git a/lib/diazo/tests/inline-xsl-directives/theme.html b/src/diazo/tests/inline-xsl-directives/theme.html similarity index 100% rename from lib/diazo/tests/inline-xsl-directives/theme.html rename to src/diazo/tests/inline-xsl-directives/theme.html diff --git a/lib/diazo/tests/modify-theme/content.html b/src/diazo/tests/modify-theme/content.html similarity index 100% rename from lib/diazo/tests/modify-theme/content.html rename to src/diazo/tests/modify-theme/content.html diff --git a/lib/diazo/tests/modify-theme/output.html b/src/diazo/tests/modify-theme/output.html similarity index 100% rename from lib/diazo/tests/modify-theme/output.html rename to src/diazo/tests/modify-theme/output.html diff --git a/lib/diazo/tests/modify-theme/rules.xml b/src/diazo/tests/modify-theme/rules.xml similarity index 100% rename from lib/diazo/tests/modify-theme/rules.xml rename to src/diazo/tests/modify-theme/rules.xml diff --git a/lib/diazo/tests/modify-theme/theme.html b/src/diazo/tests/modify-theme/theme.html similarity index 100% rename from lib/diazo/tests/modify-theme/theme.html rename to src/diazo/tests/modify-theme/theme.html diff --git a/lib/diazo/tests/modify-theme/xpaths.txt b/src/diazo/tests/modify-theme/xpaths.txt similarity index 100% rename from lib/diazo/tests/modify-theme/xpaths.txt rename to src/diazo/tests/modify-theme/xpaths.txt diff --git a/lib/diazo/tests/multi-copy-1/content.html b/src/diazo/tests/multi-copy-1/content.html similarity index 100% rename from lib/diazo/tests/multi-copy-1/content.html rename to src/diazo/tests/multi-copy-1/content.html diff --git a/lib/diazo/tests/multi-copy-1/rules.xml b/src/diazo/tests/multi-copy-1/rules.xml similarity index 100% rename from lib/diazo/tests/multi-copy-1/rules.xml rename to src/diazo/tests/multi-copy-1/rules.xml diff --git a/lib/diazo/tests/multi-copy-1/theme.html b/src/diazo/tests/multi-copy-1/theme.html similarity index 100% rename from lib/diazo/tests/multi-copy-1/theme.html rename to src/diazo/tests/multi-copy-1/theme.html diff --git a/lib/diazo/tests/multi-copy-1/xpaths.txt b/src/diazo/tests/multi-copy-1/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-copy-1/xpaths.txt rename to src/diazo/tests/multi-copy-1/xpaths.txt diff --git a/lib/diazo/tests/multi-copy-2/content.html b/src/diazo/tests/multi-copy-2/content.html similarity index 100% rename from lib/diazo/tests/multi-copy-2/content.html rename to src/diazo/tests/multi-copy-2/content.html diff --git a/lib/diazo/tests/multi-copy-2/rules.xml b/src/diazo/tests/multi-copy-2/rules.xml similarity index 100% rename from lib/diazo/tests/multi-copy-2/rules.xml rename to src/diazo/tests/multi-copy-2/rules.xml diff --git a/lib/diazo/tests/multi-copy-2/theme.html b/src/diazo/tests/multi-copy-2/theme.html similarity index 100% rename from lib/diazo/tests/multi-copy-2/theme.html rename to src/diazo/tests/multi-copy-2/theme.html diff --git a/lib/diazo/tests/multi-copy-2/xpaths.txt b/src/diazo/tests/multi-copy-2/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-copy-2/xpaths.txt rename to src/diazo/tests/multi-copy-2/xpaths.txt diff --git a/lib/diazo/tests/multi-copy-3/content.html b/src/diazo/tests/multi-copy-3/content.html similarity index 100% rename from lib/diazo/tests/multi-copy-3/content.html rename to src/diazo/tests/multi-copy-3/content.html diff --git a/lib/diazo/tests/multi-copy-3/rules.xml b/src/diazo/tests/multi-copy-3/rules.xml similarity index 100% rename from lib/diazo/tests/multi-copy-3/rules.xml rename to src/diazo/tests/multi-copy-3/rules.xml diff --git a/lib/diazo/tests/multi-copy-3/theme.html b/src/diazo/tests/multi-copy-3/theme.html similarity index 100% rename from lib/diazo/tests/multi-copy-3/theme.html rename to src/diazo/tests/multi-copy-3/theme.html diff --git a/lib/diazo/tests/multi-copy-3/xpaths.txt b/src/diazo/tests/multi-copy-3/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-copy-3/xpaths.txt rename to src/diazo/tests/multi-copy-3/xpaths.txt diff --git a/lib/diazo/tests/multi-copy-4/content.html b/src/diazo/tests/multi-copy-4/content.html similarity index 100% rename from lib/diazo/tests/multi-copy-4/content.html rename to src/diazo/tests/multi-copy-4/content.html diff --git a/lib/diazo/tests/multi-copy-4/rules.xml b/src/diazo/tests/multi-copy-4/rules.xml similarity index 100% rename from lib/diazo/tests/multi-copy-4/rules.xml rename to src/diazo/tests/multi-copy-4/rules.xml diff --git a/lib/diazo/tests/multi-copy-4/theme.html b/src/diazo/tests/multi-copy-4/theme.html similarity index 100% rename from lib/diazo/tests/multi-copy-4/theme.html rename to src/diazo/tests/multi-copy-4/theme.html diff --git a/lib/diazo/tests/multi-copy-4/xpaths.txt b/src/diazo/tests/multi-copy-4/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-copy-4/xpaths.txt rename to src/diazo/tests/multi-copy-4/xpaths.txt diff --git a/lib/diazo/tests/multi-replace-1/content.html b/src/diazo/tests/multi-replace-1/content.html similarity index 100% rename from lib/diazo/tests/multi-replace-1/content.html rename to src/diazo/tests/multi-replace-1/content.html diff --git a/lib/diazo/tests/multi-replace-1/rules.xml b/src/diazo/tests/multi-replace-1/rules.xml similarity index 100% rename from lib/diazo/tests/multi-replace-1/rules.xml rename to src/diazo/tests/multi-replace-1/rules.xml diff --git a/lib/diazo/tests/multi-replace-1/theme.html b/src/diazo/tests/multi-replace-1/theme.html similarity index 100% rename from lib/diazo/tests/multi-replace-1/theme.html rename to src/diazo/tests/multi-replace-1/theme.html diff --git a/lib/diazo/tests/multi-replace-1/xpaths.txt b/src/diazo/tests/multi-replace-1/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-replace-1/xpaths.txt rename to src/diazo/tests/multi-replace-1/xpaths.txt diff --git a/lib/diazo/tests/multi-replace-2/content.html b/src/diazo/tests/multi-replace-2/content.html similarity index 100% rename from lib/diazo/tests/multi-replace-2/content.html rename to src/diazo/tests/multi-replace-2/content.html diff --git a/lib/diazo/tests/multi-replace-2/rules.xml b/src/diazo/tests/multi-replace-2/rules.xml similarity index 100% rename from lib/diazo/tests/multi-replace-2/rules.xml rename to src/diazo/tests/multi-replace-2/rules.xml diff --git a/lib/diazo/tests/multi-replace-2/theme.html b/src/diazo/tests/multi-replace-2/theme.html similarity index 100% rename from lib/diazo/tests/multi-replace-2/theme.html rename to src/diazo/tests/multi-replace-2/theme.html diff --git a/lib/diazo/tests/multi-replace-2/xpaths.txt b/src/diazo/tests/multi-replace-2/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-replace-2/xpaths.txt rename to src/diazo/tests/multi-replace-2/xpaths.txt diff --git a/lib/diazo/tests/multi-replace-3/content.html b/src/diazo/tests/multi-replace-3/content.html similarity index 100% rename from lib/diazo/tests/multi-replace-3/content.html rename to src/diazo/tests/multi-replace-3/content.html diff --git a/lib/diazo/tests/multi-replace-3/rules.xml b/src/diazo/tests/multi-replace-3/rules.xml similarity index 100% rename from lib/diazo/tests/multi-replace-3/rules.xml rename to src/diazo/tests/multi-replace-3/rules.xml diff --git a/lib/diazo/tests/multi-replace-3/theme.html b/src/diazo/tests/multi-replace-3/theme.html similarity index 100% rename from lib/diazo/tests/multi-replace-3/theme.html rename to src/diazo/tests/multi-replace-3/theme.html diff --git a/lib/diazo/tests/multi-replace-3/xpaths.txt b/src/diazo/tests/multi-replace-3/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-replace-3/xpaths.txt rename to src/diazo/tests/multi-replace-3/xpaths.txt diff --git a/lib/diazo/tests/multi-replace-4/content.html b/src/diazo/tests/multi-replace-4/content.html similarity index 100% rename from lib/diazo/tests/multi-replace-4/content.html rename to src/diazo/tests/multi-replace-4/content.html diff --git a/lib/diazo/tests/multi-replace-4/rules.xml b/src/diazo/tests/multi-replace-4/rules.xml similarity index 100% rename from lib/diazo/tests/multi-replace-4/rules.xml rename to src/diazo/tests/multi-replace-4/rules.xml diff --git a/lib/diazo/tests/multi-replace-4/theme.html b/src/diazo/tests/multi-replace-4/theme.html similarity index 100% rename from lib/diazo/tests/multi-replace-4/theme.html rename to src/diazo/tests/multi-replace-4/theme.html diff --git a/lib/diazo/tests/multi-replace-4/xpaths.txt b/src/diazo/tests/multi-replace-4/xpaths.txt similarity index 100% rename from lib/diazo/tests/multi-replace-4/xpaths.txt rename to src/diazo/tests/multi-replace-4/xpaths.txt diff --git a/lib/diazo/tests/multi-theme-1/content.html b/src/diazo/tests/multi-theme-1/content.html similarity index 100% rename from lib/diazo/tests/multi-theme-1/content.html rename to src/diazo/tests/multi-theme-1/content.html diff --git a/lib/diazo/tests/multi-theme-1/options.cfg b/src/diazo/tests/multi-theme-1/options.cfg similarity index 100% rename from lib/diazo/tests/multi-theme-1/options.cfg rename to src/diazo/tests/multi-theme-1/options.cfg diff --git a/lib/diazo/tests/multi-theme-1/output.html b/src/diazo/tests/multi-theme-1/output.html similarity index 100% rename from lib/diazo/tests/multi-theme-1/output.html rename to src/diazo/tests/multi-theme-1/output.html diff --git a/lib/diazo/tests/multi-theme-1/rules.xml b/src/diazo/tests/multi-theme-1/rules.xml similarity index 100% rename from lib/diazo/tests/multi-theme-1/rules.xml rename to src/diazo/tests/multi-theme-1/rules.xml diff --git a/lib/diazo/tests/multi-theme-1/theme1.html b/src/diazo/tests/multi-theme-1/theme1.html similarity index 100% rename from lib/diazo/tests/multi-theme-1/theme1.html rename to src/diazo/tests/multi-theme-1/theme1.html diff --git a/lib/diazo/tests/multi-theme-1/theme2.html b/src/diazo/tests/multi-theme-1/theme2.html similarity index 100% rename from lib/diazo/tests/multi-theme-1/theme2.html rename to src/diazo/tests/multi-theme-1/theme2.html diff --git a/lib/diazo/tests/multi-theme-2/content.html b/src/diazo/tests/multi-theme-2/content.html similarity index 100% rename from lib/diazo/tests/multi-theme-2/content.html rename to src/diazo/tests/multi-theme-2/content.html diff --git a/lib/diazo/tests/multi-theme-2/options.cfg b/src/diazo/tests/multi-theme-2/options.cfg similarity index 100% rename from lib/diazo/tests/multi-theme-2/options.cfg rename to src/diazo/tests/multi-theme-2/options.cfg diff --git a/lib/diazo/tests/multi-theme-2/output.html b/src/diazo/tests/multi-theme-2/output.html similarity index 100% rename from lib/diazo/tests/multi-theme-2/output.html rename to src/diazo/tests/multi-theme-2/output.html diff --git a/lib/diazo/tests/multi-theme-2/rules.xml b/src/diazo/tests/multi-theme-2/rules.xml similarity index 100% rename from lib/diazo/tests/multi-theme-2/rules.xml rename to src/diazo/tests/multi-theme-2/rules.xml diff --git a/lib/diazo/tests/multi-theme-2/theme1.html b/src/diazo/tests/multi-theme-2/theme1.html similarity index 100% rename from lib/diazo/tests/multi-theme-2/theme1.html rename to src/diazo/tests/multi-theme-2/theme1.html diff --git a/lib/diazo/tests/multi-theme-2/theme2.html b/src/diazo/tests/multi-theme-2/theme2.html similarity index 100% rename from lib/diazo/tests/multi-theme-2/theme2.html rename to src/diazo/tests/multi-theme-2/theme2.html diff --git a/lib/diazo/tests/multi-theme-3/content.html b/src/diazo/tests/multi-theme-3/content.html similarity index 100% rename from lib/diazo/tests/multi-theme-3/content.html rename to src/diazo/tests/multi-theme-3/content.html diff --git a/lib/diazo/tests/multi-theme-3/options.cfg b/src/diazo/tests/multi-theme-3/options.cfg similarity index 100% rename from lib/diazo/tests/multi-theme-3/options.cfg rename to src/diazo/tests/multi-theme-3/options.cfg diff --git a/lib/diazo/tests/multi-theme-3/output.html b/src/diazo/tests/multi-theme-3/output.html similarity index 100% rename from lib/diazo/tests/multi-theme-3/output.html rename to src/diazo/tests/multi-theme-3/output.html diff --git a/lib/diazo/tests/multi-theme-3/rules.xml b/src/diazo/tests/multi-theme-3/rules.xml similarity index 100% rename from lib/diazo/tests/multi-theme-3/rules.xml rename to src/diazo/tests/multi-theme-3/rules.xml diff --git a/lib/diazo/tests/multi-theme-3/theme1.html b/src/diazo/tests/multi-theme-3/theme1.html similarity index 100% rename from lib/diazo/tests/multi-theme-3/theme1.html rename to src/diazo/tests/multi-theme-3/theme1.html diff --git a/lib/diazo/tests/multi-theme-3/theme2.html b/src/diazo/tests/multi-theme-3/theme2.html similarity index 100% rename from lib/diazo/tests/multi-theme-3/theme2.html rename to src/diazo/tests/multi-theme-3/theme2.html diff --git a/lib/diazo/tests/multi-theme-4/content.html b/src/diazo/tests/multi-theme-4/content.html similarity index 100% rename from lib/diazo/tests/multi-theme-4/content.html rename to src/diazo/tests/multi-theme-4/content.html diff --git a/lib/diazo/tests/multi-theme-4/options.cfg b/src/diazo/tests/multi-theme-4/options.cfg similarity index 100% rename from lib/diazo/tests/multi-theme-4/options.cfg rename to src/diazo/tests/multi-theme-4/options.cfg diff --git a/lib/diazo/tests/multi-theme-4/output.html b/src/diazo/tests/multi-theme-4/output.html similarity index 100% rename from lib/diazo/tests/multi-theme-4/output.html rename to src/diazo/tests/multi-theme-4/output.html diff --git a/lib/diazo/tests/multi-theme-4/rules.xml b/src/diazo/tests/multi-theme-4/rules.xml similarity index 100% rename from lib/diazo/tests/multi-theme-4/rules.xml rename to src/diazo/tests/multi-theme-4/rules.xml diff --git a/lib/diazo/tests/multi-theme-4/theme1.html b/src/diazo/tests/multi-theme-4/theme1.html similarity index 100% rename from lib/diazo/tests/multi-theme-4/theme1.html rename to src/diazo/tests/multi-theme-4/theme1.html diff --git a/lib/diazo/tests/multi-theme-4/theme2.html b/src/diazo/tests/multi-theme-4/theme2.html similarity index 100% rename from lib/diazo/tests/multi-theme-4/theme2.html rename to src/diazo/tests/multi-theme-4/theme2.html diff --git a/lib/diazo/tests/multi-theme-5/content.html b/src/diazo/tests/multi-theme-5/content.html similarity index 100% rename from lib/diazo/tests/multi-theme-5/content.html rename to src/diazo/tests/multi-theme-5/content.html diff --git a/lib/diazo/tests/multi-theme-5/options.cfg b/src/diazo/tests/multi-theme-5/options.cfg similarity index 100% rename from lib/diazo/tests/multi-theme-5/options.cfg rename to src/diazo/tests/multi-theme-5/options.cfg diff --git a/lib/diazo/tests/multi-theme-5/output.html b/src/diazo/tests/multi-theme-5/output.html similarity index 100% rename from lib/diazo/tests/multi-theme-5/output.html rename to src/diazo/tests/multi-theme-5/output.html diff --git a/lib/diazo/tests/multi-theme-5/rules.xml b/src/diazo/tests/multi-theme-5/rules.xml similarity index 100% rename from lib/diazo/tests/multi-theme-5/rules.xml rename to src/diazo/tests/multi-theme-5/rules.xml diff --git a/lib/diazo/tests/multi-theme-5/theme1.html b/src/diazo/tests/multi-theme-5/theme1.html similarity index 100% rename from lib/diazo/tests/multi-theme-5/theme1.html rename to src/diazo/tests/multi-theme-5/theme1.html diff --git a/lib/diazo/tests/multi-theme-5/theme2.html b/src/diazo/tests/multi-theme-5/theme2.html similarity index 100% rename from lib/diazo/tests/multi-theme-5/theme2.html rename to src/diazo/tests/multi-theme-5/theme2.html diff --git a/lib/diazo/tests/multi-theme-variable-1/content.html b/src/diazo/tests/multi-theme-variable-1/content.html similarity index 100% rename from lib/diazo/tests/multi-theme-variable-1/content.html rename to src/diazo/tests/multi-theme-variable-1/content.html diff --git a/lib/diazo/tests/multi-theme-variable-1/options.cfg b/src/diazo/tests/multi-theme-variable-1/options.cfg similarity index 100% rename from lib/diazo/tests/multi-theme-variable-1/options.cfg rename to src/diazo/tests/multi-theme-variable-1/options.cfg diff --git a/lib/diazo/tests/multi-theme-variable-1/output.html b/src/diazo/tests/multi-theme-variable-1/output.html similarity index 100% rename from lib/diazo/tests/multi-theme-variable-1/output.html rename to src/diazo/tests/multi-theme-variable-1/output.html diff --git a/lib/diazo/tests/multi-theme-variable-1/rules.xml b/src/diazo/tests/multi-theme-variable-1/rules.xml similarity index 100% rename from lib/diazo/tests/multi-theme-variable-1/rules.xml rename to src/diazo/tests/multi-theme-variable-1/rules.xml diff --git a/lib/diazo/tests/multi-theme-variable-1/theme1.html b/src/diazo/tests/multi-theme-variable-1/theme1.html similarity index 100% rename from lib/diazo/tests/multi-theme-variable-1/theme1.html rename to src/diazo/tests/multi-theme-variable-1/theme1.html diff --git a/lib/diazo/tests/multi-theme-variable-1/theme2.html b/src/diazo/tests/multi-theme-variable-1/theme2.html similarity index 100% rename from lib/diazo/tests/multi-theme-variable-1/theme2.html rename to src/diazo/tests/multi-theme-variable-1/theme2.html diff --git a/lib/diazo/tests/nested-conditions-1/content.html b/src/diazo/tests/nested-conditions-1/content.html similarity index 100% rename from lib/diazo/tests/nested-conditions-1/content.html rename to src/diazo/tests/nested-conditions-1/content.html diff --git a/lib/diazo/tests/nested-conditions-1/output.html b/src/diazo/tests/nested-conditions-1/output.html similarity index 100% rename from lib/diazo/tests/nested-conditions-1/output.html rename to src/diazo/tests/nested-conditions-1/output.html diff --git a/lib/diazo/tests/nested-conditions-1/rules.xml b/src/diazo/tests/nested-conditions-1/rules.xml similarity index 100% rename from lib/diazo/tests/nested-conditions-1/rules.xml rename to src/diazo/tests/nested-conditions-1/rules.xml diff --git a/lib/diazo/tests/nested-conditions-1/theme.html b/src/diazo/tests/nested-conditions-1/theme.html similarity index 100% rename from lib/diazo/tests/nested-conditions-1/theme.html rename to src/diazo/tests/nested-conditions-1/theme.html diff --git a/lib/diazo/tests/nested-conditions-2/content.html b/src/diazo/tests/nested-conditions-2/content.html similarity index 100% rename from lib/diazo/tests/nested-conditions-2/content.html rename to src/diazo/tests/nested-conditions-2/content.html diff --git a/lib/diazo/tests/nested-conditions-2/output.html b/src/diazo/tests/nested-conditions-2/output.html similarity index 100% rename from lib/diazo/tests/nested-conditions-2/output.html rename to src/diazo/tests/nested-conditions-2/output.html diff --git a/lib/diazo/tests/nested-conditions-2/rules.xml b/src/diazo/tests/nested-conditions-2/rules.xml similarity index 100% rename from lib/diazo/tests/nested-conditions-2/rules.xml rename to src/diazo/tests/nested-conditions-2/rules.xml diff --git a/lib/diazo/tests/nested-conditions-2/theme.html b/src/diazo/tests/nested-conditions-2/theme.html similarity index 100% rename from lib/diazo/tests/nested-conditions-2/theme.html rename to src/diazo/tests/nested-conditions-2/theme.html diff --git a/lib/diazo/tests/nested-conditions-3/content.html b/src/diazo/tests/nested-conditions-3/content.html similarity index 100% rename from lib/diazo/tests/nested-conditions-3/content.html rename to src/diazo/tests/nested-conditions-3/content.html diff --git a/lib/diazo/tests/nested-conditions-3/output.html b/src/diazo/tests/nested-conditions-3/output.html similarity index 100% rename from lib/diazo/tests/nested-conditions-3/output.html rename to src/diazo/tests/nested-conditions-3/output.html diff --git a/lib/diazo/tests/nested-conditions-3/rules.xml b/src/diazo/tests/nested-conditions-3/rules.xml similarity index 100% rename from lib/diazo/tests/nested-conditions-3/rules.xml rename to src/diazo/tests/nested-conditions-3/rules.xml diff --git a/lib/diazo/tests/nested-conditions-3/theme.html b/src/diazo/tests/nested-conditions-3/theme.html similarity index 100% rename from lib/diazo/tests/nested-conditions-3/theme.html rename to src/diazo/tests/nested-conditions-3/theme.html diff --git a/lib/diazo/tests/nested-rules-for-xinclude/content.html b/src/diazo/tests/nested-rules-for-xinclude/content.html similarity index 100% rename from lib/diazo/tests/nested-rules-for-xinclude/content.html rename to src/diazo/tests/nested-rules-for-xinclude/content.html diff --git a/lib/diazo/tests/nested-rules-for-xinclude/output.html b/src/diazo/tests/nested-rules-for-xinclude/output.html similarity index 100% rename from lib/diazo/tests/nested-rules-for-xinclude/output.html rename to src/diazo/tests/nested-rules-for-xinclude/output.html diff --git a/lib/diazo/tests/nested-rules-for-xinclude/rules.xml b/src/diazo/tests/nested-rules-for-xinclude/rules.xml similarity index 100% rename from lib/diazo/tests/nested-rules-for-xinclude/rules.xml rename to src/diazo/tests/nested-rules-for-xinclude/rules.xml diff --git a/lib/diazo/tests/nested-rules-for-xinclude/theme.html b/src/diazo/tests/nested-rules-for-xinclude/theme.html similarity index 100% rename from lib/diazo/tests/nested-rules-for-xinclude/theme.html rename to src/diazo/tests/nested-rules-for-xinclude/theme.html diff --git a/lib/diazo/tests/notheme-xmlns/content.html b/src/diazo/tests/notheme-xmlns/content.html similarity index 100% rename from lib/diazo/tests/notheme-xmlns/content.html rename to src/diazo/tests/notheme-xmlns/content.html diff --git a/lib/diazo/tests/notheme-xmlns/output.html b/src/diazo/tests/notheme-xmlns/output.html similarity index 100% rename from lib/diazo/tests/notheme-xmlns/output.html rename to src/diazo/tests/notheme-xmlns/output.html diff --git a/lib/diazo/tests/notheme-xmlns/rules.xml b/src/diazo/tests/notheme-xmlns/rules.xml similarity index 100% rename from lib/diazo/tests/notheme-xmlns/rules.xml rename to src/diazo/tests/notheme-xmlns/rules.xml diff --git a/lib/diazo/tests/notheme-xmlns/theme.html b/src/diazo/tests/notheme-xmlns/theme.html similarity index 100% rename from lib/diazo/tests/notheme-xmlns/theme.html rename to src/diazo/tests/notheme-xmlns/theme.html diff --git a/lib/diazo/tests/null-if-content/content.html b/src/diazo/tests/null-if-content/content.html similarity index 100% rename from lib/diazo/tests/null-if-content/content.html rename to src/diazo/tests/null-if-content/content.html diff --git a/lib/diazo/tests/null-if-content/rules.xml b/src/diazo/tests/null-if-content/rules.xml similarity index 100% rename from lib/diazo/tests/null-if-content/rules.xml rename to src/diazo/tests/null-if-content/rules.xml diff --git a/lib/diazo/tests/null-if-content/theme.html b/src/diazo/tests/null-if-content/theme.html similarity index 100% rename from lib/diazo/tests/null-if-content/theme.html rename to src/diazo/tests/null-if-content/theme.html diff --git a/lib/diazo/tests/null-if-content/xpaths.txt b/src/diazo/tests/null-if-content/xpaths.txt similarity index 100% rename from lib/diazo/tests/null-if-content/xpaths.txt rename to src/diazo/tests/null-if-content/xpaths.txt diff --git a/lib/diazo/tests/path-param-1/content.html b/src/diazo/tests/path-param-1/content.html similarity index 100% rename from lib/diazo/tests/path-param-1/content.html rename to src/diazo/tests/path-param-1/content.html diff --git a/lib/diazo/tests/path-param-1/options.cfg b/src/diazo/tests/path-param-1/options.cfg similarity index 100% rename from lib/diazo/tests/path-param-1/options.cfg rename to src/diazo/tests/path-param-1/options.cfg diff --git a/lib/diazo/tests/path-param-1/output.html b/src/diazo/tests/path-param-1/output.html similarity index 100% rename from lib/diazo/tests/path-param-1/output.html rename to src/diazo/tests/path-param-1/output.html diff --git a/lib/diazo/tests/path-param-1/rules.xml b/src/diazo/tests/path-param-1/rules.xml similarity index 100% rename from lib/diazo/tests/path-param-1/rules.xml rename to src/diazo/tests/path-param-1/rules.xml diff --git a/lib/diazo/tests/path-param-1/theme.html b/src/diazo/tests/path-param-1/theme.html similarity index 100% rename from lib/diazo/tests/path-param-1/theme.html rename to src/diazo/tests/path-param-1/theme.html diff --git a/lib/diazo/tests/path-param-2/content.html b/src/diazo/tests/path-param-2/content.html similarity index 100% rename from lib/diazo/tests/path-param-2/content.html rename to src/diazo/tests/path-param-2/content.html diff --git a/lib/diazo/tests/path-param-2/options.cfg b/src/diazo/tests/path-param-2/options.cfg similarity index 100% rename from lib/diazo/tests/path-param-2/options.cfg rename to src/diazo/tests/path-param-2/options.cfg diff --git a/lib/diazo/tests/path-param-2/output.html b/src/diazo/tests/path-param-2/output.html similarity index 100% rename from lib/diazo/tests/path-param-2/output.html rename to src/diazo/tests/path-param-2/output.html diff --git a/lib/diazo/tests/path-param-2/rules.xml b/src/diazo/tests/path-param-2/rules.xml similarity index 100% rename from lib/diazo/tests/path-param-2/rules.xml rename to src/diazo/tests/path-param-2/rules.xml diff --git a/lib/diazo/tests/path-param-2/theme.html b/src/diazo/tests/path-param-2/theme.html similarity index 100% rename from lib/diazo/tests/path-param-2/theme.html rename to src/diazo/tests/path-param-2/theme.html diff --git a/lib/diazo/tests/pre-line-endings/content.html b/src/diazo/tests/pre-line-endings/content.html similarity index 100% rename from lib/diazo/tests/pre-line-endings/content.html rename to src/diazo/tests/pre-line-endings/content.html diff --git a/lib/diazo/tests/pre-line-endings/extra.html b/src/diazo/tests/pre-line-endings/extra.html similarity index 100% rename from lib/diazo/tests/pre-line-endings/extra.html rename to src/diazo/tests/pre-line-endings/extra.html diff --git a/lib/diazo/tests/pre-line-endings/output.html b/src/diazo/tests/pre-line-endings/output.html similarity index 100% rename from lib/diazo/tests/pre-line-endings/output.html rename to src/diazo/tests/pre-line-endings/output.html diff --git a/lib/diazo/tests/pre-line-endings/rules.xml b/src/diazo/tests/pre-line-endings/rules.xml similarity index 100% rename from lib/diazo/tests/pre-line-endings/rules.xml rename to src/diazo/tests/pre-line-endings/rules.xml diff --git a/lib/diazo/tests/pre-line-endings/theme.html b/src/diazo/tests/pre-line-endings/theme.html similarity index 100% rename from lib/diazo/tests/pre-line-endings/theme.html rename to src/diazo/tests/pre-line-endings/theme.html diff --git a/lib/diazo/tests/prepend-append/content.html b/src/diazo/tests/prepend-append/content.html similarity index 100% rename from lib/diazo/tests/prepend-append/content.html rename to src/diazo/tests/prepend-append/content.html diff --git a/lib/diazo/tests/prepend-append/output.html b/src/diazo/tests/prepend-append/output.html similarity index 100% rename from lib/diazo/tests/prepend-append/output.html rename to src/diazo/tests/prepend-append/output.html diff --git a/lib/diazo/tests/prepend-append/rules.xml b/src/diazo/tests/prepend-append/rules.xml similarity index 100% rename from lib/diazo/tests/prepend-append/rules.xml rename to src/diazo/tests/prepend-append/rules.xml diff --git a/lib/diazo/tests/prepend-append/theme.html b/src/diazo/tests/prepend-append/theme.html similarity index 100% rename from lib/diazo/tests/prepend-append/theme.html rename to src/diazo/tests/prepend-append/theme.html diff --git a/lib/diazo/tests/prepend-append/xpaths.txt b/src/diazo/tests/prepend-append/xpaths.txt similarity index 100% rename from lib/diazo/tests/prepend-append/xpaths.txt rename to src/diazo/tests/prepend-append/xpaths.txt diff --git a/lib/diazo/tests/prepend/content.html b/src/diazo/tests/prepend/content.html similarity index 100% rename from lib/diazo/tests/prepend/content.html rename to src/diazo/tests/prepend/content.html diff --git a/lib/diazo/tests/prepend/output.html b/src/diazo/tests/prepend/output.html similarity index 100% rename from lib/diazo/tests/prepend/output.html rename to src/diazo/tests/prepend/output.html diff --git a/lib/diazo/tests/prepend/rules.xml b/src/diazo/tests/prepend/rules.xml similarity index 100% rename from lib/diazo/tests/prepend/rules.xml rename to src/diazo/tests/prepend/rules.xml diff --git a/lib/diazo/tests/prepend/theme.html b/src/diazo/tests/prepend/theme.html similarity index 100% rename from lib/diazo/tests/prepend/theme.html rename to src/diazo/tests/prepend/theme.html diff --git a/lib/diazo/tests/prepend/xpaths.txt b/src/diazo/tests/prepend/xpaths.txt similarity index 100% rename from lib/diazo/tests/prepend/xpaths.txt rename to src/diazo/tests/prepend/xpaths.txt diff --git a/lib/diazo/tests/replace-after/content.html b/src/diazo/tests/replace-after/content.html similarity index 100% rename from lib/diazo/tests/replace-after/content.html rename to src/diazo/tests/replace-after/content.html diff --git a/lib/diazo/tests/replace-after/output.html b/src/diazo/tests/replace-after/output.html similarity index 100% rename from lib/diazo/tests/replace-after/output.html rename to src/diazo/tests/replace-after/output.html diff --git a/lib/diazo/tests/replace-after/rules.xml b/src/diazo/tests/replace-after/rules.xml similarity index 100% rename from lib/diazo/tests/replace-after/rules.xml rename to src/diazo/tests/replace-after/rules.xml diff --git a/lib/diazo/tests/replace-after/theme.html b/src/diazo/tests/replace-after/theme.html similarity index 100% rename from lib/diazo/tests/replace-after/theme.html rename to src/diazo/tests/replace-after/theme.html diff --git a/lib/diazo/tests/replace-after/xpaths.txt b/src/diazo/tests/replace-after/xpaths.txt similarity index 100% rename from lib/diazo/tests/replace-after/xpaths.txt rename to src/diazo/tests/replace-after/xpaths.txt diff --git a/lib/diazo/tests/replace/README.rst b/src/diazo/tests/replace/README.rst similarity index 100% rename from lib/diazo/tests/replace/README.rst rename to src/diazo/tests/replace/README.rst diff --git a/lib/diazo/tests/replace/content.html b/src/diazo/tests/replace/content.html similarity index 100% rename from lib/diazo/tests/replace/content.html rename to src/diazo/tests/replace/content.html diff --git a/lib/diazo/tests/replace/output.html b/src/diazo/tests/replace/output.html similarity index 100% rename from lib/diazo/tests/replace/output.html rename to src/diazo/tests/replace/output.html diff --git a/lib/diazo/tests/replace/rules.xml b/src/diazo/tests/replace/rules.xml similarity index 100% rename from lib/diazo/tests/replace/rules.xml rename to src/diazo/tests/replace/rules.xml diff --git a/lib/diazo/tests/replace/theme.html b/src/diazo/tests/replace/theme.html similarity index 100% rename from lib/diazo/tests/replace/theme.html rename to src/diazo/tests/replace/theme.html diff --git a/lib/diazo/tests/replace/xpaths.txt b/src/diazo/tests/replace/xpaths.txt similarity index 100% rename from lib/diazo/tests/replace/xpaths.txt rename to src/diazo/tests/replace/xpaths.txt diff --git a/lib/diazo/tests/ssi/content.html b/src/diazo/tests/ssi/content.html similarity index 100% rename from lib/diazo/tests/ssi/content.html rename to src/diazo/tests/ssi/content.html diff --git a/lib/diazo/tests/ssi/output.html b/src/diazo/tests/ssi/output.html similarity index 100% rename from lib/diazo/tests/ssi/output.html rename to src/diazo/tests/ssi/output.html diff --git a/lib/diazo/tests/ssi/rules.xml b/src/diazo/tests/ssi/rules.xml similarity index 100% rename from lib/diazo/tests/ssi/rules.xml rename to src/diazo/tests/ssi/rules.xml diff --git a/lib/diazo/tests/ssi/theme.html b/src/diazo/tests/ssi/theme.html similarity index 100% rename from lib/diazo/tests/ssi/theme.html rename to src/diazo/tests/ssi/theme.html diff --git a/lib/diazo/tests/ssi/xpaths.txt b/src/diazo/tests/ssi/xpaths.txt similarity index 100% rename from lib/diazo/tests/ssi/xpaths.txt rename to src/diazo/tests/ssi/xpaths.txt diff --git a/lib/diazo/tests/ssiwait/content.html b/src/diazo/tests/ssiwait/content.html similarity index 100% rename from lib/diazo/tests/ssiwait/content.html rename to src/diazo/tests/ssiwait/content.html diff --git a/lib/diazo/tests/ssiwait/output.html b/src/diazo/tests/ssiwait/output.html similarity index 100% rename from lib/diazo/tests/ssiwait/output.html rename to src/diazo/tests/ssiwait/output.html diff --git a/lib/diazo/tests/ssiwait/rules.xml b/src/diazo/tests/ssiwait/rules.xml similarity index 100% rename from lib/diazo/tests/ssiwait/rules.xml rename to src/diazo/tests/ssiwait/rules.xml diff --git a/lib/diazo/tests/ssiwait/theme.html b/src/diazo/tests/ssiwait/theme.html similarity index 100% rename from lib/diazo/tests/ssiwait/theme.html rename to src/diazo/tests/ssiwait/theme.html diff --git a/lib/diazo/tests/ssiwait/xpaths.txt b/src/diazo/tests/ssiwait/xpaths.txt similarity index 100% rename from lib/diazo/tests/ssiwait/xpaths.txt rename to src/diazo/tests/ssiwait/xpaths.txt diff --git a/lib/diazo/tests/style-script-quoting-1/content.html b/src/diazo/tests/style-script-quoting-1/content.html similarity index 100% rename from lib/diazo/tests/style-script-quoting-1/content.html rename to src/diazo/tests/style-script-quoting-1/content.html diff --git a/lib/diazo/tests/style-script-quoting-1/output.html b/src/diazo/tests/style-script-quoting-1/output.html similarity index 100% rename from lib/diazo/tests/style-script-quoting-1/output.html rename to src/diazo/tests/style-script-quoting-1/output.html diff --git a/lib/diazo/tests/style-script-quoting-1/rules.xml b/src/diazo/tests/style-script-quoting-1/rules.xml similarity index 100% rename from lib/diazo/tests/style-script-quoting-1/rules.xml rename to src/diazo/tests/style-script-quoting-1/rules.xml diff --git a/lib/diazo/tests/style-script-quoting-1/theme.html b/src/diazo/tests/style-script-quoting-1/theme.html similarity index 100% rename from lib/diazo/tests/style-script-quoting-1/theme.html rename to src/diazo/tests/style-script-quoting-1/theme.html diff --git a/lib/diazo/tests/style-script-quoting-1/xpaths.txt b/src/diazo/tests/style-script-quoting-1/xpaths.txt similarity index 100% rename from lib/diazo/tests/style-script-quoting-1/xpaths.txt rename to src/diazo/tests/style-script-quoting-1/xpaths.txt diff --git a/lib/diazo/tests/style-script-quoting-2/content.html b/src/diazo/tests/style-script-quoting-2/content.html similarity index 100% rename from lib/diazo/tests/style-script-quoting-2/content.html rename to src/diazo/tests/style-script-quoting-2/content.html diff --git a/lib/diazo/tests/style-script-quoting-2/output.html b/src/diazo/tests/style-script-quoting-2/output.html similarity index 100% rename from lib/diazo/tests/style-script-quoting-2/output.html rename to src/diazo/tests/style-script-quoting-2/output.html diff --git a/lib/diazo/tests/style-script-quoting-2/rules.xml b/src/diazo/tests/style-script-quoting-2/rules.xml similarity index 100% rename from lib/diazo/tests/style-script-quoting-2/rules.xml rename to src/diazo/tests/style-script-quoting-2/rules.xml diff --git a/lib/diazo/tests/style-script-quoting-2/theme.html b/src/diazo/tests/style-script-quoting-2/theme.html similarity index 100% rename from lib/diazo/tests/style-script-quoting-2/theme.html rename to src/diazo/tests/style-script-quoting-2/theme.html diff --git a/lib/diazo/tests/test_diazo.py b/src/diazo/tests/test_diazo.py similarity index 70% rename from lib/diazo/tests/test_diazo.py rename to src/diazo/tests/test_diazo.py index 6c5fd418..08e5ef4b 100644 --- a/lib/diazo/tests/test_diazo.py +++ b/src/diazo/tests/test_diazo.py @@ -1,20 +1,14 @@ -# -*- coding: utf-8 -*- - -from __future__ import print_function - -from builtins import str from diazo.utils import quote_param from io import BytesIO -from io import open from io import StringIO from lxml import etree +import configparser import diazo.compiler import diazo.run import difflib import os import pkg_resources -import six import sys import unittest @@ -23,19 +17,13 @@ # Simple test runner for validating different diazo scenarios # -try: - import configparser -except ImportError: - import ConfigParser as configparser - - -if __name__ == '__main__': +if __name__ == "__main__": __file__ = sys.argv[0] defaultsfn = pkg_resources.resource_filename( - 'diazo.tests', - 'default-options.cfg', + "diazo.tests", + "default-options.cfg", ) @@ -44,9 +32,9 @@ def text_compare(t1, t2): # See note in xml_compare below. if not t1 and not t2: return True - if t1 == '*' or t2 == '*': + if t1 == "*" or t2 == "*": return True - return (t1 or '').strip() == (t2 or '').strip() + return (t1 or "").strip() == (t2 or "").strip() def xml_compare(x1, x2): @@ -79,7 +67,7 @@ def xml_compare(x1, x2): """ if x1.tag != x2.tag: return False - for name, value in six.iteritems(x1.attrib): + for name, value in x1.attrib.items(): if x2.attrib.get(name) != value: return False for name in x2.attrib: @@ -102,66 +90,65 @@ def xml_compare(x1, x2): class DiazoTestCase(unittest.TestCase): - - writefiles = os.environ.get('DiazoTESTS_WRITE_FILES', False) + writefiles = os.environ.get("DiazoTESTS_WRITE_FILES", False) warnings = os.environ.get( - 'DiazoTESTS_WARN', - '1', - ).lower() not in ('0', 'false', 'off') + "DiazoTESTS_WARN", + "1", + ).lower() not in ("0", "false", "off") testdir = os.path.realpath(__file__) @classmethod def suiteForParent(cls, parent, prefix): - """Return a suite of diazo tests, one for each directory in parent. - """ + """Return a suite of diazo tests, one for each directory in parent.""" suite = unittest.TestSuite() for name in os.listdir(parent): - if name.startswith('.'): + if name.startswith("."): continue path = os.path.join(parent, name) if not os.path.isdir(path): continue - contentpath = os.path.join(path, 'content.html') + contentpath = os.path.join(path, "content.html") if not os.path.isfile(contentpath): continue test_cls = type( - '{prefix:s}-{name:s}'.format( + "{prefix:s}-{name:s}".format( prefix=prefix, name=name, ), (DiazoTestCase,), dict(testdir=path), ) - suite.addTest(unittest.makeSuite(test_cls)) + suite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(test_cls)) return suite def testAll(self): self.errors = BytesIO() config = configparser.ConfigParser() - config.read([defaultsfn, os.path.join(self.testdir, 'options.cfg')]) + config.read([defaultsfn, os.path.join(self.testdir, "options.cfg")]) themefn = None - if config.get('diazotest', 'theme'): + if config.get("diazotest", "theme"): themefn = os.path.join( self.testdir, - config.get('diazotest', 'theme'), + config.get("diazotest", "theme"), ) - contentfn = os.path.join(self.testdir, 'content.html') - rulesfn = os.path.join(self.testdir, 'rules.xml') - xpathsfn = os.path.join(self.testdir, 'xpaths.txt') - xslfn = os.path.join(self.testdir, 'compiled.xsl') - outputfn = os.path.join(self.testdir, 'output.html') + contentfn = os.path.join(self.testdir, "content.html") + rulesfn = os.path.join(self.testdir, "rules.xml") + xpathsfn = os.path.join(self.testdir, "xpaths.txt") + xslfn = os.path.join(self.testdir, "compiled.xsl") + outputfn = os.path.join(self.testdir, "output.html") xsl_params = {} - extra_params = config.get('diazotest', 'extra-params') + extra_params = config.get("diazotest", "extra-params") if extra_params: - for token in extra_params.split(' '): - token_split = token.split(':') - xsl_params[token_split[0]] = len(token_split) > 1 and \ - token_split[1] or None + for token in extra_params.split(" "): + token_split = token.split(":") + xsl_params[token_split[0]] = ( + len(token_split) > 1 and token_split[1] or None + ) if not os.path.exists(rulesfn): return @@ -178,13 +165,13 @@ def testAll(self): rules=rulesfn, theme=themefn, parser=theme_parser, - absolute_prefix=config.get('diazotest', 'absolute-prefix'), - indent=config.getboolean('diazotest', 'pretty-print'), + absolute_prefix=config.get("diazotest", "absolute-prefix"), + indent=config.getboolean("diazotest", "pretty-print"), xsl_params=xsl_params, ) # Serialize / parse the theme - this can catch problems with escaping. - cts = etree.tostring(ct, encoding='unicode') + cts = etree.tostring(ct, encoding="unicode") parser = etree.XMLParser() etree.fromstring(cts, parser=parser) @@ -195,34 +182,34 @@ def testAll(self): new = cts if old != new: if self.writefiles: - with open(xslfn + '.old', 'w') as f: + with open(xslfn + ".old", "w") as f: f.write(old) if self.warnings: - print('WARNING:', 'compiled.xsl has CHANGED') + print("WARNING:", "compiled.xsl has CHANGED") for line in difflib.unified_diff( - old.split(u'\n'), - new.split(u'\n'), + old.split("\n"), + new.split("\n"), xslfn, - 'now', + "now", ): print(line) # Write the compiled xsl out to catch unexpected changes if self.writefiles: - with open(xslfn, 'w') as f: + with open(xslfn, "w") as f: f.write(cts) # Apply the compiled version, then test against desired output theme_parser.resolvers.add(diazo.run.RunResolver(self.testdir)) processor = etree.XSLT(ct) params = {} - params['path'] = "'{path:s}'".format( - path=config.get('diazotest', 'path'), + params["path"] = "'{path:s}'".format( + path=config.get("diazotest", "path"), ) for key in xsl_params: try: - params[key] = quote_param(config.get('diazotest', key)) + params[key] = quote_param(config.get("diazotest", key)) except configparser.NoOptionError: pass @@ -238,8 +225,7 @@ def testAll(self): # remove the extra meta content type - metas = self.themed_content.xpath( - "/html/head/meta[@http-equiv='Content-Type']") + metas = self.themed_content.xpath("/html/head/meta[@http-equiv='Content-Type']") if metas: meta = metas[0] meta.getparent().remove(meta) @@ -250,16 +236,18 @@ def testAll(self): # Read the XPaths from the file, skipping blank lines and # comments this_xpath = xpath.strip() - if not this_xpath or this_xpath[0] == '#': + if not this_xpath or this_xpath[0] == "#": continue - assert self.themed_content.xpath(this_xpath), '{key:s}: {value:s}'.format( # NOQA: E501 + assert self.themed_content.xpath( + this_xpath + ), "{key:s}: {value:s}".format( # NOQA: E501 key=xpathsfn, value=this_xpath, ) # Compare to previous version if os.path.exists(outputfn): - with open(outputfn, 'rb') as f: + with open(outputfn, "rb") as f: old = f.read() new = self.themed_string if not xml_compare( @@ -269,30 +257,30 @@ def testAll(self): # if self.writefiles: # open(outputfn + '.old', 'w').write(old) for line in difflib.unified_diff( - old.split(u'\n'), - new.split(u'\n'), + old.split("\n"), + new.split("\n"), outputfn, - 'now', + "now", ): print(line) - assert old == new, 'output.html has CHANGED' + assert old == new, "output.html has CHANGED" # Write out the result to catch unexpected changes if self.writefiles: - with open(outputfn, 'w') as f: + with open(outputfn, "w") as f: f.write(self.themed_string) def test_suite(): suite = unittest.TestSuite() tests_dir = os.path.dirname(__file__) - suite.addTest(DiazoTestCase.suiteForParent(tests_dir, 'Test')) + suite.addTest(DiazoTestCase.suiteForParent(tests_dir, "Test")) recipes_dir = os.path.join( tests_dir, "../../..", "docs/recipes", ) - if os.path.exists(os.path.join(recipes_dir, 'diazo-tests-marker.txt')): + if os.path.exists(os.path.join(recipes_dir, "diazo-tests-marker.txt")): # Could still be a 'System' package. - suite.addTest(DiazoTestCase.suiteForParent(recipes_dir, 'Recipe')) + suite.addTest(DiazoTestCase.suiteForParent(recipes_dir, "Recipe")) return suite diff --git a/lib/diazo/tests/test_trace.py b/src/diazo/tests/test_trace.py similarity index 77% rename from lib/diazo/tests/test_trace.py rename to src/diazo/tests/test_trace.py index 619bf2a7..244ba266 100644 --- a/lib/diazo/tests/test_trace.py +++ b/src/diazo/tests/test_trace.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from io import BytesIO from lxml import etree @@ -11,14 +9,14 @@ import unittest -if __name__ == '__main__': +if __name__ == "__main__": __file__ = sys.argv[0] def _testfile(filename): return os.path.join( os.path.abspath(os.path.dirname(__file__)), - 'test_wsgi_files', + "test_wsgi_files", filename, ) @@ -93,93 +91,93 @@ def test_internal(self): ) self.assertXPath( runtrace_doc, - '/d:rules/d:theme/@runtrace-if-content', - 'false', + "/d:rules/d:theme/@runtrace-if-content", + "false", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/@runtrace-if-content', - 'true', + "/d:rules/d:rules/@runtrace-if-content", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-if-content', - 'false', + "/d:rules/d:rules/d:replace[1]/@runtrace-if-content", + "false", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-content', - '1', + "/d:rules/d:rules/d:replace[1]/@runtrace-content", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-theme', - '1', + "/d:rules/d:rules/d:replace[1]/@runtrace-theme", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-merged-condition', - 'false', + "/d:rules/d:rules/d:replace[1]/@runtrace-merged-condition", + "false", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[2]/@runtrace-if-content', - 'true', + "/d:rules/d:rules/d:replace[2]/@runtrace-if-content", + "true", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[2]/@runtrace-content', - '1', + "/d:rules/d:rules/d:replace[2]/@runtrace-content", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[2]/@runtrace-theme', - '1', + "/d:rules/d:rules/d:replace[2]/@runtrace-theme", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[2]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[2]/@runtrace-merged-condition", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[3]/@runtrace-content', - '1', + "/d:rules/d:rules/d:replace[3]/@runtrace-content", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[3]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[3]/@runtrace-merged-condition", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[4]/@runtrace-content', - '0', + "/d:rules/d:rules/d:replace[4]/@runtrace-content", + "0", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[4]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[4]/@runtrace-merged-condition", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[6]/@runtrace-if-not-content', - 'false', + "/d:rules/d:rules/d:replace[6]/@runtrace-if-not-content", + "false", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[6]/@runtrace-merged-condition', - 'false', + "/d:rules/d:rules/d:replace[6]/@runtrace-merged-condition", + "false", ) def test_external(self): @@ -201,36 +199,36 @@ def test_external(self): ) self.assertXPath( runtrace_doc, - '/d:rules/d:theme/@runtrace-if-content', - 'true', + "/d:rules/d:theme/@runtrace-if-content", + "true", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/@runtrace-if-content', - 'true', + "/d:rules/d:rules/@runtrace-if-content", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-if-content', - 'true', + "/d:rules/d:rules/d:replace[1]/@runtrace-if-content", + "true", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-content', - '1', + "/d:rules/d:rules/d:replace[1]/@runtrace-content", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-theme', - '1', + "/d:rules/d:rules/d:replace[1]/@runtrace-theme", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[1]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[1]/@runtrace-merged-condition", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[3]/@runtrace-content', - '1', + "/d:rules/d:rules/d:replace[3]/@runtrace-content", + "1", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[3]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[3]/@runtrace-merged-condition", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[4]/@runtrace-content', - '0', + "/d:rules/d:rules/d:replace[4]/@runtrace-content", + "0", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[4]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[4]/@runtrace-merged-condition", + "true", ) # self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[6]/@runtrace-if-not-content', - 'true', + "/d:rules/d:rules/d:replace[6]/@runtrace-if-not-content", + "true", ) self.assertXPath( runtrace_doc, - '/d:rules/d:rules/d:replace[6]/@runtrace-merged-condition', - 'true', + "/d:rules/d:rules/d:replace[6]/@runtrace-merged-condition", + "true", ) def test_htmlformat(self): @@ -385,7 +383,7 @@ def assertXPath(self, doc, xpath, expected): self.assertEqual( doc.xpath( xpath, - namespaces=(dict(d='http://namespaces.plone.org/diazo')), + namespaces=(dict(d="http://namespaces.plone.org/diazo")), )[0], expected, ) diff --git a/lib/diazo/tests/test_wsgi.py b/src/diazo/tests/test_wsgi.py similarity index 72% rename from lib/diazo/tests/test_wsgi.py rename to src/diazo/tests/test_wsgi.py index de522dd8..4e910fba 100644 --- a/lib/diazo/tests/test_wsgi.py +++ b/src/diazo/tests/test_wsgi.py @@ -1,21 +1,24 @@ -# -*- coding: utf-8 -*- - import os.path import sys import unittest -if __name__ == '__main__': +if __name__ == "__main__": __file__ = sys.argv[0] def _testfile(filename): - return '/'.join( - ('file://',) + os.path.split( + return "/".join( + ("file://",) + + os.path.split( os.path.abspath( os.path.dirname(__file__), ), - ) + ('test_wsgi_files', filename,), + ) + + ( + "test_wsgi_files", + filename, + ), ) @@ -152,7 +155,6 @@ def _testfile(filename): class TestXSLTMiddleware(unittest.TestCase): - def test_transform_filename(self): from diazo.wsgi import XSLTMiddleware from webob import Request @@ -161,12 +163,12 @@ def test_transform_filename(self): import tempfile _, filename = tempfile.mkstemp() - with open(filename, 'wb') as fp: + with open(filename, "wb") as fp: fp.write(XSLT) def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -177,17 +179,17 @@ def application(environ, start_response): ) os.unlink(filename) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual( - response.headers['Content-Type'], - 'text/html; charset=UTF-8', + response.headers["Content-Type"], + "text/html; charset=UTF-8", ) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_transform_tree(self): from diazo.wsgi import XSLTMiddleware @@ -195,8 +197,8 @@ def test_transform_tree(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -206,17 +208,17 @@ def application(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual( - response.headers['Content-Type'], - 'text/html; charset=UTF-8', + response.headers["Content-Type"], + "text/html; charset=UTF-8", ) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_head_request(self): from diazo.wsgi import XSLTMiddleware @@ -224,13 +226,13 @@ def test_head_request(self): from webob import Request def application(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('Content-Length', str(len(HTML))), + ("Content-Type", "text/html"), + ("Content-Length", str(len(HTML))), ] start_response(status, response_headers) - return [''] # Empty response for HEAD request + return [""] # Empty response for HEAD request app = XSLTMiddleware( application, @@ -238,13 +240,13 @@ def application(environ, start_response): tree=etree.fromstring(XSLT), ) - env = dict(REQUEST_METHOD='HEAD') - request = Request.blank('/', environ=env) + env = dict(REQUEST_METHOD="HEAD") + request = Request.blank("/", environ=env) # The *real* test is whether or not an exception is raised here. response = request.get_response(app) # Response headers for HEAD request must be updated. - self.assertEqual(response.headers.get('Content-Length'), None) + self.assertEqual(response.headers.get("Content-Length"), None) self.assertFalse(response.body) def test_update_content_length(self): @@ -253,10 +255,10 @@ def test_update_content_length(self): from webob import Request def application(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('Content-Length', str(len(HTML))), + ("Content-Type", "text/html"), + ("Content-Length", str(len(HTML))), ] start_response(status, response_headers) return [HTML] @@ -268,10 +270,10 @@ def application(environ, start_response): update_content_length=True, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertEqual(response.headers['Content-Length'], '178') + self.assertEqual(response.headers["Content-Length"], "178") def test_dont_update_content_length(self): from diazo.wsgi import XSLTMiddleware @@ -279,10 +281,10 @@ def test_dont_update_content_length(self): from webob import Request def application(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('Content-Length', '1'), + ("Content-Type", "text/html"), + ("Content-Length", "1"), ] start_response(status, response_headers) return [HTML] @@ -293,10 +295,10 @@ def application(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertEqual(response.headers.get('Content-Length'), None) + self.assertEqual(response.headers.get("Content-Length"), None) def test_content_length_zero(self): from diazo.wsgi import XSLTMiddleware @@ -304,13 +306,13 @@ def test_content_length_zero(self): from webob import Request def application(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('Content-Length', '0'), + ("Content-Type", "text/html"), + ("Content-Length", "0"), ] start_response(status, response_headers) - return [''] + return [""] app = XSLTMiddleware( application, @@ -319,10 +321,10 @@ def application(environ, start_response): update_content_length=True, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertEqual(response.headers['Content-Length'], '0') + self.assertEqual(response.headers["Content-Length"], "0") def test_content_empty(self): from diazo.wsgi import XSLTMiddleware @@ -330,13 +332,13 @@ def test_content_empty(self): from webob import Request def application(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('Content-MD5', 'd41d8cd98f00b204e9800998ecf8427e'), + ("Content-Type", "text/html"), + ("Content-MD5", "d41d8cd98f00b204e9800998ecf8427e"), ] start_response(status, response_headers) - return [b''] + return [b""] app = XSLTMiddleware( application, @@ -345,12 +347,12 @@ def application(environ, start_response): update_content_length=True, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual( - response.headers['Content-MD5'], - 'd41d8cd98f00b204e9800998ecf8427e', + response.headers["Content-MD5"], + "d41d8cd98f00b204e9800998ecf8427e", ) def test_content_range(self): @@ -359,17 +361,17 @@ def test_content_range(self): from webob import Request def application(environ, start_response): - status = '200 OK' + status = "200 OK" content_length = len(HTML) - content_range = 'bytes {start:d}-{end:d}/{length:d}'.format( + content_range = "bytes {start:d}-{end:d}/{length:d}".format( start=0, end=content_length - 1, length=content_length, ) response_headers = [ - ('Content-Type', 'text/html'), - ('Content-Range', content_range), - ('Content-Length', str(content_length)), + ("Content-Type", "text/html"), + ("Content-Range", content_range), + ("Content-Length", str(content_length)), ] start_response(status, response_headers) return [HTML] @@ -380,10 +382,10 @@ def application(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertFalse('Content-Range' in response.headers) + self.assertFalse("Content-Range" in response.headers) def test_no_content_length(self): from diazo.wsgi import XSLTMiddleware @@ -391,8 +393,8 @@ def test_no_content_length(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -403,10 +405,10 @@ def application(environ, start_response): set_content_length=False, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertFalse('Content-Length' in response.headers) + self.assertFalse("Content-Length" in response.headers) def test_doctype_html(self): from diazo.wsgi import XSLTMiddleware @@ -414,8 +416,8 @@ def test_doctype_html(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -425,12 +427,12 @@ def application(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual( - response.headers['Content-Type'], - 'text/html; charset=UTF-8', + response.headers["Content-Type"], + "text/html; charset=UTF-8", ) def test_doctype_xhtml(self): @@ -439,8 +441,8 @@ def test_doctype_xhtml(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -450,12 +452,12 @@ def application(environ, start_response): tree=etree.fromstring(XSLT_XHTML), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual( - response.headers['Content-Type'], - 'application/xhtml+xml; charset=UTF-8', + response.headers["Content-Type"], + "application/xhtml+xml; charset=UTF-8", ) def test_doctype_html5(self): @@ -464,8 +466,8 @@ def test_doctype_html5(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -473,13 +475,13 @@ def application(environ, start_response): application, {}, tree=etree.fromstring(XSLT_XHTML), - doctype='', + doctype="", ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertTrue(response.body.startswith(b'\n\nContent content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_diazo_off_request_header(self): from diazo.wsgi import XSLTMiddleware @@ -518,8 +520,8 @@ def test_diazo_off_request_header(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -529,20 +531,20 @@ def application(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') - request.headers['X-Diazo-Off'] = 'yes' + request = Request.blank("/") + request.headers["X-Diazo-Off"] = "yes" response = request.get_response(app) self.assertEqual(response.body, HTML) - request = Request.blank('/') - request.headers['X-Diazo-Off'] = 'no' + request = Request.blank("/") + request.headers["X-Diazo-Off"] = "no" response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_diazo_off_response_header(self): from diazo.wsgi import XSLTMiddleware @@ -550,26 +552,26 @@ def test_diazo_off_response_header(self): from webob import Request def application1(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('X-Diazo-Off', 'yes'), + ("Content-Type", "text/html"), + ("X-Diazo-Off", "yes"), ] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application1, {}, tree=etree.fromstring(XSLT)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('X-Diazo-Off', 'no'), + ("Content-Type", "text/html"), + ("X-Diazo-Off", "no"), ] start_response(status, response_headers) return [HTML] @@ -580,13 +582,13 @@ def application2(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_non_html_content_type(self): from diazo.wsgi import XSLTMiddleware @@ -594,8 +596,8 @@ def test_non_html_content_type(self): from webob import Request def application1(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/plain')] + status = "200 OK" + response_headers = [("Content-Type", "text/plain")] start_response(status, response_headers) return [HTML] @@ -605,14 +607,14 @@ def application1(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -622,13 +624,13 @@ def application2(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_content_encoding(self): from diazo.wsgi import XSLTMiddleware @@ -636,24 +638,24 @@ def test_content_encoding(self): from webob import Request def application1(environ, start_response): - status = '200 OK' + status = "200 OK" response_headers = [ - ('Content-Type', 'text/html'), - ('Content-Encoding', 'zip'), + ("Content-Type", "text/html"), + ("Content-Encoding", "zip"), ] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application1, {}, tree=etree.fromstring(XSLT)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -663,13 +665,13 @@ def application2(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_301(self): from diazo.wsgi import XSLTMiddleware @@ -677,8 +679,8 @@ def test_301(self): from webob import Request def application1(environ, start_response): - status = '301 MOVED PERMANENTLY' - response_headers = [('Content-Type', 'text/html')] + status = "301 MOVED PERMANENTLY" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -688,14 +690,14 @@ def application1(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -705,13 +707,13 @@ def application2(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_302(self): from diazo.wsgi import XSLTMiddleware @@ -719,8 +721,8 @@ def test_302(self): from webob import Request def application1(environ, start_response): - status = '302 MOVED' - response_headers = [('Content-Type', 'text/html')] + status = "302 MOVED" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -730,14 +732,14 @@ def application1(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -747,13 +749,13 @@ def application2(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_304(self): from diazo.wsgi import XSLTMiddleware @@ -761,33 +763,33 @@ def test_304(self): from webob import Request def application1(environ, start_response): - status = '304 NOT MODIFIED' - response_headers = [('Content-Type', 'text/html')] + status = "304 NOT MODIFIED" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application1, {}, tree=etree.fromstring(XSLT)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application2, {}, tree=etree.fromstring(XSLT)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_204(self): from diazo.wsgi import XSLTMiddleware @@ -795,33 +797,33 @@ def test_204(self): from webob import Request def application1(environ, start_response): - status = '204 NO CONTENT' - response_headers = [('Content-Type', 'text/html')] + status = "204 NO CONTENT" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application1, {}, tree=etree.fromstring(XSLT)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application2, {}, tree=etree.fromstring(XSLT)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_401(self): from diazo.wsgi import XSLTMiddleware @@ -829,8 +831,8 @@ def test_401(self): from webob import Request def application1(environ, start_response): - status = '401 UNAUTHORIZED' - response_headers = [('Content-Type', 'text/html')] + status = "401 UNAUTHORIZED" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -840,14 +842,14 @@ def application1(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertEqual(response.body, HTML) def application2(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -857,13 +859,13 @@ def application2(environ, start_response): tree=etree.fromstring(XSLT), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( b'
Content content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_html_serialization(self): from diazo.wsgi import XSLTMiddleware @@ -871,13 +873,13 @@ def test_html_serialization(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = XSLTMiddleware(application, {}, tree=etree.fromstring(XSLT_HTML)) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) # HTML serialisation @@ -885,14 +887,14 @@ def application(environ, start_response): b'' in response.body, ) - self.assertTrue(b'
' in response.body) + self.assertTrue(b"
" in response.body) app = XSLTMiddleware( application, {}, tree=etree.fromstring(XSLT_XHTML), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) # XHTML serialisation @@ -901,19 +903,19 @@ def application(environ, start_response): b'"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' in response.body, ) - self.assertTrue(b'
' in response.body) + self.assertTrue(b"
" in response.body) app = XSLTMiddleware( application, {}, tree=etree.fromstring(XSLT_HTML5), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) # HTML 5 serialisation - self.assertTrue(b'' in response.body) - self.assertTrue(b'
' in response.body) + self.assertTrue(b"" in response.body) + self.assertTrue(b"
" in response.body) def test_environ_param(self): from diazo.wsgi import XSLTMiddleware @@ -921,8 +923,8 @@ def test_environ_param(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -930,19 +932,19 @@ def application(environ, start_response): application, {}, tree=etree.fromstring(XSLT_PARAM), - environ_param_map={'test.param1': 'someparam'}, + environ_param_map={"test.param1": "someparam"}, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertTrue(b'

defaultvalue

' in response.body) + self.assertTrue(b"

defaultvalue

" in response.body) - request = Request.blank('/') - request.environ['test.param1'] = 'value1' + request = Request.blank("/") + request.environ["test.param1"] = "value1" response = request.get_response(app) - self.assertTrue(b'

value1

' in response.body) + self.assertTrue(b"

value1

" in response.body) def test_params(self): from diazo.wsgi import XSLTMiddleware @@ -950,8 +952,8 @@ def test_params(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] @@ -960,41 +962,40 @@ def application(environ, start_response): {}, tree=etree.fromstring(XSLT_PARAM), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertTrue(b'

defaultvalue

' in response.body) + self.assertTrue(b"

defaultvalue

" in response.body) app = XSLTMiddleware( application, {}, tree=etree.fromstring(XSLT_PARAM), - someparam='value1', + someparam="value1", ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertTrue(b'

value1

' in response.body) + self.assertTrue(b"

value1

" in response.body) class TestDiazoMiddleware(unittest.TestCase): - def test_simple_transform(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = DiazoMiddleware( application, {}, - _testfile('simple_transform.xml'), + _testfile("simple_transform.xml"), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( @@ -1003,46 +1004,46 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_doctype_html5(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = DiazoMiddleware( application, {}, - _testfile('simple_transform.xml'), - doctype='', + _testfile("simple_transform.xml"), + doctype="", ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) - self.assertTrue(response.body.startswith(b'\n\nTheme content' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_absolute_prefix(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = DiazoMiddleware( application, {}, - _testfile('simple_transform.xml'), + _testfile("simple_transform.xml"), ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( @@ -1077,17 +1078,18 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) self.assertTrue( b'' in response.body, ) app = DiazoMiddleware( - application, {}, - _testfile('simple_transform.xml'), - prefix='/static', + application, + {}, + _testfile("simple_transform.xml"), + prefix="/static", ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( @@ -1096,10 +1098,9 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) self.assertTrue( - b'' - in response.body, + b'' in response.body, ) def test_path_param(self): @@ -1107,13 +1108,13 @@ def test_path_param(self): from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] - app = DiazoMiddleware(application, {}, _testfile('path_param.xml')) - request = Request.blank('/') + app = DiazoMiddleware(application, {}, _testfile("path_param.xml")) + request = Request.blank("/") response = request.get_response(app) self.assertFalse( @@ -1122,9 +1123,9 @@ def application(environ, start_response): self.assertTrue( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) - request = Request.blank('/index.html') + request = Request.blank("/index.html") response = request.get_response(app) self.assertTrue( @@ -1133,26 +1134,26 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_custom_environ_param(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = DiazoMiddleware( application, {}, - _testfile('custom_param.xml'), - environ_param_map={'test.param1': 'someparam'}, + _testfile("custom_param.xml"), + environ_param_map={"test.param1": "someparam"}, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertFalse( @@ -1161,10 +1162,10 @@ def application(environ, start_response): self.assertTrue( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) - request = Request.blank('/') - request.environ['test.param1'] = 'value1' + request = Request.blank("/") + request.environ["test.param1"] = "value1" response = request.get_response(app) self.assertTrue( @@ -1173,10 +1174,10 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) - request = Request.blank('/') - request.environ['test.param1'] = 'value2' + request = Request.blank("/") + request.environ["test.param1"] = "value2" response = request.get_response(app) self.assertFalse( @@ -1185,25 +1186,25 @@ def application(environ, start_response): self.assertTrue( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_custom_param(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) return [HTML] app = DiazoMiddleware( application, {}, - _testfile('custom_param.xml'), - someparam='value1', + _testfile("custom_param.xml"), + someparam="value1", ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( @@ -1212,15 +1213,15 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) app = DiazoMiddleware( application, {}, - _testfile('custom_param.xml'), - someparam='value2', + _testfile("custom_param.xml"), + someparam="value2", ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertFalse( @@ -1229,25 +1230,25 @@ def application(environ, start_response): self.assertTrue( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_subrequest(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) request = Request(environ) - if request.path.endswith('/other.html'): + if request.path.endswith("/other.html"): return [HTML_ALTERNATIVE] else: return [HTML] - app = DiazoMiddleware(application, {}, _testfile('subrequest.xml')) - request = Request.blank('/') + app = DiazoMiddleware(application, {}, _testfile("subrequest.xml")) + request = Request.blank("/") response = request.get_response(app) self.assertTrue( @@ -1256,19 +1257,19 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) def test_esi(self): from diazo.wsgi import DiazoMiddleware from webob import Request def application(environ, start_response): - status = '200 OK' - response_headers = [('Content-Type', 'text/html')] + status = "200 OK" + response_headers = [("Content-Type", "text/html")] start_response(status, response_headers) request = Request(environ) - if request.path.endswith('/other.html'): + if request.path.endswith("/other.html"): return [HTML_ALTERNATIVE] else: return [HTML] @@ -1276,10 +1277,10 @@ def application(environ, start_response): app = DiazoMiddleware( application, {}, - _testfile('esi.xml'), + _testfile("esi.xml"), filter_xpath=True, ) - request = Request.blank('/') + request = Request.blank("/") response = request.get_response(app) self.assertTrue( @@ -1290,7 +1291,7 @@ def application(environ, start_response): self.assertFalse( b'
Theme content
' in response.body, ) - self.assertTrue(b'Transformed' in response.body) + self.assertTrue(b"Transformed" in response.body) request = Request.blank( """/other.html?;filter_xpath=//*[@id%20=%20'content']""", diff --git a/lib/diazo/tests/test_wsgi_files/custom_param.xml b/src/diazo/tests/test_wsgi_files/custom_param.xml similarity index 100% rename from lib/diazo/tests/test_wsgi_files/custom_param.xml rename to src/diazo/tests/test_wsgi_files/custom_param.xml diff --git a/lib/diazo/tests/test_wsgi_files/esi.xml b/src/diazo/tests/test_wsgi_files/esi.xml similarity index 100% rename from lib/diazo/tests/test_wsgi_files/esi.xml rename to src/diazo/tests/test_wsgi_files/esi.xml diff --git a/lib/diazo/tests/test_wsgi_files/explicit_theme.xml b/src/diazo/tests/test_wsgi_files/explicit_theme.xml similarity index 100% rename from lib/diazo/tests/test_wsgi_files/explicit_theme.xml rename to src/diazo/tests/test_wsgi_files/explicit_theme.xml diff --git a/lib/diazo/tests/test_wsgi_files/path_param.xml b/src/diazo/tests/test_wsgi_files/path_param.xml similarity index 100% rename from lib/diazo/tests/test_wsgi_files/path_param.xml rename to src/diazo/tests/test_wsgi_files/path_param.xml diff --git a/lib/diazo/tests/test_wsgi_files/simple_transform.xml b/src/diazo/tests/test_wsgi_files/simple_transform.xml similarity index 100% rename from lib/diazo/tests/test_wsgi_files/simple_transform.xml rename to src/diazo/tests/test_wsgi_files/simple_transform.xml diff --git a/lib/diazo/tests/test_wsgi_files/subrequest.xml b/src/diazo/tests/test_wsgi_files/subrequest.xml similarity index 100% rename from lib/diazo/tests/test_wsgi_files/subrequest.xml rename to src/diazo/tests/test_wsgi_files/subrequest.xml diff --git a/lib/diazo/tests/test_wsgi_files/theme.html b/src/diazo/tests/test_wsgi_files/theme.html similarity index 100% rename from lib/diazo/tests/test_wsgi_files/theme.html rename to src/diazo/tests/test_wsgi_files/theme.html diff --git a/lib/diazo/tests/update-namespace-1/content.html b/src/diazo/tests/update-namespace-1/content.html similarity index 100% rename from lib/diazo/tests/update-namespace-1/content.html rename to src/diazo/tests/update-namespace-1/content.html diff --git a/lib/diazo/tests/update-namespace-1/rules.xml b/src/diazo/tests/update-namespace-1/rules.xml similarity index 100% rename from lib/diazo/tests/update-namespace-1/rules.xml rename to src/diazo/tests/update-namespace-1/rules.xml diff --git a/lib/diazo/tests/update-namespace-1/theme.html b/src/diazo/tests/update-namespace-1/theme.html similarity index 100% rename from lib/diazo/tests/update-namespace-1/theme.html rename to src/diazo/tests/update-namespace-1/theme.html diff --git a/lib/diazo/tests/update-namespace-1/xpaths.txt b/src/diazo/tests/update-namespace-1/xpaths.txt similarity index 100% rename from lib/diazo/tests/update-namespace-1/xpaths.txt rename to src/diazo/tests/update-namespace-1/xpaths.txt diff --git a/lib/diazo/tests/update-namespace-2/content.html b/src/diazo/tests/update-namespace-2/content.html similarity index 100% rename from lib/diazo/tests/update-namespace-2/content.html rename to src/diazo/tests/update-namespace-2/content.html diff --git a/lib/diazo/tests/update-namespace-2/output.html b/src/diazo/tests/update-namespace-2/output.html similarity index 100% rename from lib/diazo/tests/update-namespace-2/output.html rename to src/diazo/tests/update-namespace-2/output.html diff --git a/lib/diazo/tests/update-namespace-2/rules.xml b/src/diazo/tests/update-namespace-2/rules.xml similarity index 100% rename from lib/diazo/tests/update-namespace-2/rules.xml rename to src/diazo/tests/update-namespace-2/rules.xml diff --git a/lib/diazo/tests/update-namespace-2/theme.html b/src/diazo/tests/update-namespace-2/theme.html similarity index 100% rename from lib/diazo/tests/update-namespace-2/theme.html rename to src/diazo/tests/update-namespace-2/theme.html diff --git a/lib/diazo/tests/update-namespace-3/content.html b/src/diazo/tests/update-namespace-3/content.html similarity index 100% rename from lib/diazo/tests/update-namespace-3/content.html rename to src/diazo/tests/update-namespace-3/content.html diff --git a/lib/diazo/tests/update-namespace-3/output.html b/src/diazo/tests/update-namespace-3/output.html similarity index 100% rename from lib/diazo/tests/update-namespace-3/output.html rename to src/diazo/tests/update-namespace-3/output.html diff --git a/lib/diazo/tests/update-namespace-3/rules.xml b/src/diazo/tests/update-namespace-3/rules.xml similarity index 100% rename from lib/diazo/tests/update-namespace-3/rules.xml rename to src/diazo/tests/update-namespace-3/rules.xml diff --git a/lib/diazo/tests/update-namespace-3/theme.html b/src/diazo/tests/update-namespace-3/theme.html similarity index 100% rename from lib/diazo/tests/update-namespace-3/theme.html rename to src/diazo/tests/update-namespace-3/theme.html diff --git a/lib/diazo/tests/v1-after-both-children/content.html b/src/diazo/tests/v1-after-both-children/content.html similarity index 100% rename from lib/diazo/tests/v1-after-both-children/content.html rename to src/diazo/tests/v1-after-both-children/content.html diff --git a/lib/diazo/tests/v1-after-both-children/output.html b/src/diazo/tests/v1-after-both-children/output.html similarity index 100% rename from lib/diazo/tests/v1-after-both-children/output.html rename to src/diazo/tests/v1-after-both-children/output.html diff --git a/lib/diazo/tests/v1-after-both-children/rules.xml b/src/diazo/tests/v1-after-both-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-after-both-children/rules.xml rename to src/diazo/tests/v1-after-both-children/rules.xml diff --git a/lib/diazo/tests/v1-after-both-children/theme.html b/src/diazo/tests/v1-after-both-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-after-both-children/theme.html rename to src/diazo/tests/v1-after-both-children/theme.html diff --git a/lib/diazo/tests/v1-after-content-children/content.html b/src/diazo/tests/v1-after-content-children/content.html similarity index 100% rename from lib/diazo/tests/v1-after-content-children/content.html rename to src/diazo/tests/v1-after-content-children/content.html diff --git a/lib/diazo/tests/v1-after-content-children/output.html b/src/diazo/tests/v1-after-content-children/output.html similarity index 100% rename from lib/diazo/tests/v1-after-content-children/output.html rename to src/diazo/tests/v1-after-content-children/output.html diff --git a/lib/diazo/tests/v1-after-content-children/rules.xml b/src/diazo/tests/v1-after-content-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-after-content-children/rules.xml rename to src/diazo/tests/v1-after-content-children/rules.xml diff --git a/lib/diazo/tests/v1-after-content-children/theme.html b/src/diazo/tests/v1-after-content-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-after-content-children/theme.html rename to src/diazo/tests/v1-after-content-children/theme.html diff --git a/lib/diazo/tests/v1-after-theme-children/content.html b/src/diazo/tests/v1-after-theme-children/content.html similarity index 100% rename from lib/diazo/tests/v1-after-theme-children/content.html rename to src/diazo/tests/v1-after-theme-children/content.html diff --git a/lib/diazo/tests/v1-after-theme-children/output.html b/src/diazo/tests/v1-after-theme-children/output.html similarity index 100% rename from lib/diazo/tests/v1-after-theme-children/output.html rename to src/diazo/tests/v1-after-theme-children/output.html diff --git a/lib/diazo/tests/v1-after-theme-children/rules.xml b/src/diazo/tests/v1-after-theme-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-after-theme-children/rules.xml rename to src/diazo/tests/v1-after-theme-children/rules.xml diff --git a/lib/diazo/tests/v1-after-theme-children/theme.html b/src/diazo/tests/v1-after-theme-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-after-theme-children/theme.html rename to src/diazo/tests/v1-after-theme-children/theme.html diff --git a/lib/diazo/tests/v1-after/content.html b/src/diazo/tests/v1-after/content.html similarity index 100% rename from lib/diazo/tests/v1-after/content.html rename to src/diazo/tests/v1-after/content.html diff --git a/lib/diazo/tests/v1-after/output.html b/src/diazo/tests/v1-after/output.html similarity index 100% rename from lib/diazo/tests/v1-after/output.html rename to src/diazo/tests/v1-after/output.html diff --git a/lib/diazo/tests/v1-after/rules.xml b/src/diazo/tests/v1-after/rules.xml similarity index 100% rename from lib/diazo/tests/v1-after/rules.xml rename to src/diazo/tests/v1-after/rules.xml diff --git a/lib/diazo/tests/v1-after/theme.html b/src/diazo/tests/v1-after/theme.html similarity index 100% rename from lib/diazo/tests/v1-after/theme.html rename to src/diazo/tests/v1-after/theme.html diff --git a/lib/diazo/tests/v1-before-both-children/content.html b/src/diazo/tests/v1-before-both-children/content.html similarity index 100% rename from lib/diazo/tests/v1-before-both-children/content.html rename to src/diazo/tests/v1-before-both-children/content.html diff --git a/lib/diazo/tests/v1-before-both-children/output.html b/src/diazo/tests/v1-before-both-children/output.html similarity index 100% rename from lib/diazo/tests/v1-before-both-children/output.html rename to src/diazo/tests/v1-before-both-children/output.html diff --git a/lib/diazo/tests/v1-before-both-children/rules.xml b/src/diazo/tests/v1-before-both-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-before-both-children/rules.xml rename to src/diazo/tests/v1-before-both-children/rules.xml diff --git a/lib/diazo/tests/v1-before-both-children/theme.html b/src/diazo/tests/v1-before-both-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-before-both-children/theme.html rename to src/diazo/tests/v1-before-both-children/theme.html diff --git a/lib/diazo/tests/v1-before-content-children/content.html b/src/diazo/tests/v1-before-content-children/content.html similarity index 100% rename from lib/diazo/tests/v1-before-content-children/content.html rename to src/diazo/tests/v1-before-content-children/content.html diff --git a/lib/diazo/tests/v1-before-content-children/output.html b/src/diazo/tests/v1-before-content-children/output.html similarity index 100% rename from lib/diazo/tests/v1-before-content-children/output.html rename to src/diazo/tests/v1-before-content-children/output.html diff --git a/lib/diazo/tests/v1-before-content-children/rules.xml b/src/diazo/tests/v1-before-content-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-before-content-children/rules.xml rename to src/diazo/tests/v1-before-content-children/rules.xml diff --git a/lib/diazo/tests/v1-before-content-children/theme.html b/src/diazo/tests/v1-before-content-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-before-content-children/theme.html rename to src/diazo/tests/v1-before-content-children/theme.html diff --git a/lib/diazo/tests/v1-before-content-content-children/content.html b/src/diazo/tests/v1-before-content-content-children/content.html similarity index 100% rename from lib/diazo/tests/v1-before-content-content-children/content.html rename to src/diazo/tests/v1-before-content-content-children/content.html diff --git a/lib/diazo/tests/v1-before-content-content-children/output.html b/src/diazo/tests/v1-before-content-content-children/output.html similarity index 100% rename from lib/diazo/tests/v1-before-content-content-children/output.html rename to src/diazo/tests/v1-before-content-content-children/output.html diff --git a/lib/diazo/tests/v1-before-content-content-children/rules.xml b/src/diazo/tests/v1-before-content-content-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-before-content-content-children/rules.xml rename to src/diazo/tests/v1-before-content-content-children/rules.xml diff --git a/lib/diazo/tests/v1-before-content-content-children/theme.html b/src/diazo/tests/v1-before-content-content-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-before-content-content-children/theme.html rename to src/diazo/tests/v1-before-content-content-children/theme.html diff --git a/lib/diazo/tests/v1-before-replace-after-content/content.html b/src/diazo/tests/v1-before-replace-after-content/content.html similarity index 100% rename from lib/diazo/tests/v1-before-replace-after-content/content.html rename to src/diazo/tests/v1-before-replace-after-content/content.html diff --git a/lib/diazo/tests/v1-before-replace-after-content/output.html b/src/diazo/tests/v1-before-replace-after-content/output.html similarity index 100% rename from lib/diazo/tests/v1-before-replace-after-content/output.html rename to src/diazo/tests/v1-before-replace-after-content/output.html diff --git a/lib/diazo/tests/v1-before-replace-after-content/rules.xml b/src/diazo/tests/v1-before-replace-after-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-before-replace-after-content/rules.xml rename to src/diazo/tests/v1-before-replace-after-content/rules.xml diff --git a/lib/diazo/tests/v1-before-replace-after-content/theme.html b/src/diazo/tests/v1-before-replace-after-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-before-replace-after-content/theme.html rename to src/diazo/tests/v1-before-replace-after-content/theme.html diff --git a/lib/diazo/tests/v1-before-theme-children/content.html b/src/diazo/tests/v1-before-theme-children/content.html similarity index 100% rename from lib/diazo/tests/v1-before-theme-children/content.html rename to src/diazo/tests/v1-before-theme-children/content.html diff --git a/lib/diazo/tests/v1-before-theme-children/output.html b/src/diazo/tests/v1-before-theme-children/output.html similarity index 100% rename from lib/diazo/tests/v1-before-theme-children/output.html rename to src/diazo/tests/v1-before-theme-children/output.html diff --git a/lib/diazo/tests/v1-before-theme-children/rules.xml b/src/diazo/tests/v1-before-theme-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-before-theme-children/rules.xml rename to src/diazo/tests/v1-before-theme-children/rules.xml diff --git a/lib/diazo/tests/v1-before-theme-children/theme.html b/src/diazo/tests/v1-before-theme-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-before-theme-children/theme.html rename to src/diazo/tests/v1-before-theme-children/theme.html diff --git a/lib/diazo/tests/v1-before/content.html b/src/diazo/tests/v1-before/content.html similarity index 100% rename from lib/diazo/tests/v1-before/content.html rename to src/diazo/tests/v1-before/content.html diff --git a/lib/diazo/tests/v1-before/output.html b/src/diazo/tests/v1-before/output.html similarity index 100% rename from lib/diazo/tests/v1-before/output.html rename to src/diazo/tests/v1-before/output.html diff --git a/lib/diazo/tests/v1-before/rules.xml b/src/diazo/tests/v1-before/rules.xml similarity index 100% rename from lib/diazo/tests/v1-before/rules.xml rename to src/diazo/tests/v1-before/rules.xml diff --git a/lib/diazo/tests/v1-before/theme.html b/src/diazo/tests/v1-before/theme.html similarity index 100% rename from lib/diazo/tests/v1-before/theme.html rename to src/diazo/tests/v1-before/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-1/content.html b/src/diazo/tests/v1-copy-all-attributes-conditional-1/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-1/content.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-1/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-1/output.html b/src/diazo/tests/v1-copy-all-attributes-conditional-1/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-1/output.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-1/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-1/rules.xml b/src/diazo/tests/v1-copy-all-attributes-conditional-1/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-1/rules.xml rename to src/diazo/tests/v1-copy-all-attributes-conditional-1/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-1/theme.html b/src/diazo/tests/v1-copy-all-attributes-conditional-1/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-1/theme.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-1/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-2/content.html b/src/diazo/tests/v1-copy-all-attributes-conditional-2/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-2/content.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-2/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-2/output.html b/src/diazo/tests/v1-copy-all-attributes-conditional-2/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-2/output.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-2/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-2/rules.xml b/src/diazo/tests/v1-copy-all-attributes-conditional-2/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-2/rules.xml rename to src/diazo/tests/v1-copy-all-attributes-conditional-2/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-2/theme.html b/src/diazo/tests/v1-copy-all-attributes-conditional-2/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-2/theme.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-2/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-3/content.html b/src/diazo/tests/v1-copy-all-attributes-conditional-3/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-3/content.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-3/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-3/output.html b/src/diazo/tests/v1-copy-all-attributes-conditional-3/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-3/output.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-3/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-3/rules.xml b/src/diazo/tests/v1-copy-all-attributes-conditional-3/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-3/rules.xml rename to src/diazo/tests/v1-copy-all-attributes-conditional-3/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes-conditional-3/theme.html b/src/diazo/tests/v1-copy-all-attributes-conditional-3/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-conditional-3/theme.html rename to src/diazo/tests/v1-copy-all-attributes-conditional-3/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-href/content.html b/src/diazo/tests/v1-copy-all-attributes-href/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-href/content.html rename to src/diazo/tests/v1-copy-all-attributes-href/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-href/include.html b/src/diazo/tests/v1-copy-all-attributes-href/include.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-href/include.html rename to src/diazo/tests/v1-copy-all-attributes-href/include.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-href/output.html b/src/diazo/tests/v1-copy-all-attributes-href/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-href/output.html rename to src/diazo/tests/v1-copy-all-attributes-href/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-href/rules.xml b/src/diazo/tests/v1-copy-all-attributes-href/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-href/rules.xml rename to src/diazo/tests/v1-copy-all-attributes-href/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes-href/theme.html b/src/diazo/tests/v1-copy-all-attributes-href/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-href/theme.html rename to src/diazo/tests/v1-copy-all-attributes-href/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/content.html b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/content.html rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/output.html b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/output.html rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/rules.xml b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/rules.xml rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/theme.html b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/theme.html rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-conditional-1/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/content.html b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/content.html rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/output.html b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/output.html rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/rules.xml b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/rules.xml rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/theme.html b/src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/theme.html rename to src/diazo/tests/v1-copy-all-attributes-multiple-rules-unconditional/theme.html diff --git a/lib/diazo/tests/v1-copy-all-attributes/content.html b/src/diazo/tests/v1-copy-all-attributes/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes/content.html rename to src/diazo/tests/v1-copy-all-attributes/content.html diff --git a/lib/diazo/tests/v1-copy-all-attributes/output.html b/src/diazo/tests/v1-copy-all-attributes/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes/output.html rename to src/diazo/tests/v1-copy-all-attributes/output.html diff --git a/lib/diazo/tests/v1-copy-all-attributes/rules.xml b/src/diazo/tests/v1-copy-all-attributes/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes/rules.xml rename to src/diazo/tests/v1-copy-all-attributes/rules.xml diff --git a/lib/diazo/tests/v1-copy-all-attributes/theme.html b/src/diazo/tests/v1-copy-all-attributes/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-all-attributes/theme.html rename to src/diazo/tests/v1-copy-all-attributes/theme.html diff --git a/lib/diazo/tests/v1-copy-attribute-exists/content.html b/src/diazo/tests/v1-copy-attribute-exists/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-exists/content.html rename to src/diazo/tests/v1-copy-attribute-exists/content.html diff --git a/lib/diazo/tests/v1-copy-attribute-exists/output.html b/src/diazo/tests/v1-copy-attribute-exists/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-exists/output.html rename to src/diazo/tests/v1-copy-attribute-exists/output.html diff --git a/lib/diazo/tests/v1-copy-attribute-exists/rules.xml b/src/diazo/tests/v1-copy-attribute-exists/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-exists/rules.xml rename to src/diazo/tests/v1-copy-attribute-exists/rules.xml diff --git a/lib/diazo/tests/v1-copy-attribute-exists/theme.html b/src/diazo/tests/v1-copy-attribute-exists/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-exists/theme.html rename to src/diazo/tests/v1-copy-attribute-exists/theme.html diff --git a/lib/diazo/tests/v1-copy-attribute-not-exists/content.html b/src/diazo/tests/v1-copy-attribute-not-exists/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-not-exists/content.html rename to src/diazo/tests/v1-copy-attribute-not-exists/content.html diff --git a/lib/diazo/tests/v1-copy-attribute-not-exists/output.html b/src/diazo/tests/v1-copy-attribute-not-exists/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-not-exists/output.html rename to src/diazo/tests/v1-copy-attribute-not-exists/output.html diff --git a/lib/diazo/tests/v1-copy-attribute-not-exists/rules.xml b/src/diazo/tests/v1-copy-attribute-not-exists/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-not-exists/rules.xml rename to src/diazo/tests/v1-copy-attribute-not-exists/rules.xml diff --git a/lib/diazo/tests/v1-copy-attribute-not-exists/theme.html b/src/diazo/tests/v1-copy-attribute-not-exists/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-attribute-not-exists/theme.html rename to src/diazo/tests/v1-copy-attribute-not-exists/theme.html diff --git a/lib/diazo/tests/v1-copy-multi-attribute/content.html b/src/diazo/tests/v1-copy-multi-attribute/content.html similarity index 100% rename from lib/diazo/tests/v1-copy-multi-attribute/content.html rename to src/diazo/tests/v1-copy-multi-attribute/content.html diff --git a/lib/diazo/tests/v1-copy-multi-attribute/output.html b/src/diazo/tests/v1-copy-multi-attribute/output.html similarity index 100% rename from lib/diazo/tests/v1-copy-multi-attribute/output.html rename to src/diazo/tests/v1-copy-multi-attribute/output.html diff --git a/lib/diazo/tests/v1-copy-multi-attribute/rules.xml b/src/diazo/tests/v1-copy-multi-attribute/rules.xml similarity index 100% rename from lib/diazo/tests/v1-copy-multi-attribute/rules.xml rename to src/diazo/tests/v1-copy-multi-attribute/rules.xml diff --git a/lib/diazo/tests/v1-copy-multi-attribute/theme.html b/src/diazo/tests/v1-copy-multi-attribute/theme.html similarity index 100% rename from lib/diazo/tests/v1-copy-multi-attribute/theme.html rename to src/diazo/tests/v1-copy-multi-attribute/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-content/content.html b/src/diazo/tests/v1-drop-all-attributes-content/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-content/content.html rename to src/diazo/tests/v1-drop-all-attributes-content/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-content/output.html b/src/diazo/tests/v1-drop-all-attributes-content/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-content/output.html rename to src/diazo/tests/v1-drop-all-attributes-content/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-content/rules.xml b/src/diazo/tests/v1-drop-all-attributes-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-content/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-content/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-content/theme.html b/src/diazo/tests/v1-drop-all-attributes-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-content/theme.html rename to src/diazo/tests/v1-drop-all-attributes-content/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/content.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/content.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/output.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/output.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/rules.xml b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/theme.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-1/theme.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-1/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/content.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/content.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/output.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/output.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/rules.xml b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/theme.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-2/theme.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-2/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/content.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/content.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/output.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/output.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/rules.xml b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/theme.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-3/theme.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-3/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/content.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/content.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/output.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/output.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/rules.xml b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/theme.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-4/theme.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-4/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/content.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/content.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/output.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/output.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/rules.xml b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/theme.html b/src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme-conditional-5/theme.html rename to src/diazo/tests/v1-drop-all-attributes-theme-conditional-5/theme.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme/content.html b/src/diazo/tests/v1-drop-all-attributes-theme/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme/content.html rename to src/diazo/tests/v1-drop-all-attributes-theme/content.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme/output.html b/src/diazo/tests/v1-drop-all-attributes-theme/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme/output.html rename to src/diazo/tests/v1-drop-all-attributes-theme/output.html diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme/rules.xml b/src/diazo/tests/v1-drop-all-attributes-theme/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme/rules.xml rename to src/diazo/tests/v1-drop-all-attributes-theme/rules.xml diff --git a/lib/diazo/tests/v1-drop-all-attributes-theme/theme.html b/src/diazo/tests/v1-drop-all-attributes-theme/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-all-attributes-theme/theme.html rename to src/diazo/tests/v1-drop-all-attributes-theme/theme.html diff --git a/lib/diazo/tests/v1-drop-and-replace-messages/content.html b/src/diazo/tests/v1-drop-and-replace-messages/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-messages/content.html rename to src/diazo/tests/v1-drop-and-replace-messages/content.html diff --git a/lib/diazo/tests/v1-drop-and-replace-messages/output.html b/src/diazo/tests/v1-drop-and-replace-messages/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-messages/output.html rename to src/diazo/tests/v1-drop-and-replace-messages/output.html diff --git a/lib/diazo/tests/v1-drop-and-replace-messages/rules.xml b/src/diazo/tests/v1-drop-and-replace-messages/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-messages/rules.xml rename to src/diazo/tests/v1-drop-and-replace-messages/rules.xml diff --git a/lib/diazo/tests/v1-drop-and-replace-messages/theme.html b/src/diazo/tests/v1-drop-and-replace-messages/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-messages/theme.html rename to src/diazo/tests/v1-drop-and-replace-messages/theme.html diff --git a/lib/diazo/tests/v1-drop-and-replace-portlets/content.html b/src/diazo/tests/v1-drop-and-replace-portlets/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-portlets/content.html rename to src/diazo/tests/v1-drop-and-replace-portlets/content.html diff --git a/lib/diazo/tests/v1-drop-and-replace-portlets/output.html b/src/diazo/tests/v1-drop-and-replace-portlets/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-portlets/output.html rename to src/diazo/tests/v1-drop-and-replace-portlets/output.html diff --git a/lib/diazo/tests/v1-drop-and-replace-portlets/rules.xml b/src/diazo/tests/v1-drop-and-replace-portlets/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-portlets/rules.xml rename to src/diazo/tests/v1-drop-and-replace-portlets/rules.xml diff --git a/lib/diazo/tests/v1-drop-and-replace-portlets/theme.html b/src/diazo/tests/v1-drop-and-replace-portlets/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-and-replace-portlets/theme.html rename to src/diazo/tests/v1-drop-and-replace-portlets/theme.html diff --git a/lib/diazo/tests/v1-drop-attribute-content/content.html b/src/diazo/tests/v1-drop-attribute-content/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-content/content.html rename to src/diazo/tests/v1-drop-attribute-content/content.html diff --git a/lib/diazo/tests/v1-drop-attribute-content/output.html b/src/diazo/tests/v1-drop-attribute-content/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-content/output.html rename to src/diazo/tests/v1-drop-attribute-content/output.html diff --git a/lib/diazo/tests/v1-drop-attribute-content/rules.xml b/src/diazo/tests/v1-drop-attribute-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-content/rules.xml rename to src/diazo/tests/v1-drop-attribute-content/rules.xml diff --git a/lib/diazo/tests/v1-drop-attribute-content/theme.html b/src/diazo/tests/v1-drop-attribute-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-content/theme.html rename to src/diazo/tests/v1-drop-attribute-content/theme.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-1/content.html b/src/diazo/tests/v1-drop-attribute-theme-conditional-1/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-1/content.html rename to src/diazo/tests/v1-drop-attribute-theme-conditional-1/content.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-1/output.html b/src/diazo/tests/v1-drop-attribute-theme-conditional-1/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-1/output.html rename to src/diazo/tests/v1-drop-attribute-theme-conditional-1/output.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-1/rules.xml b/src/diazo/tests/v1-drop-attribute-theme-conditional-1/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-1/rules.xml rename to src/diazo/tests/v1-drop-attribute-theme-conditional-1/rules.xml diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-1/theme.html b/src/diazo/tests/v1-drop-attribute-theme-conditional-1/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-1/theme.html rename to src/diazo/tests/v1-drop-attribute-theme-conditional-1/theme.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-2/content.html b/src/diazo/tests/v1-drop-attribute-theme-conditional-2/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-2/content.html rename to src/diazo/tests/v1-drop-attribute-theme-conditional-2/content.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-2/output.html b/src/diazo/tests/v1-drop-attribute-theme-conditional-2/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-2/output.html rename to src/diazo/tests/v1-drop-attribute-theme-conditional-2/output.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-2/rules.xml b/src/diazo/tests/v1-drop-attribute-theme-conditional-2/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-2/rules.xml rename to src/diazo/tests/v1-drop-attribute-theme-conditional-2/rules.xml diff --git a/lib/diazo/tests/v1-drop-attribute-theme-conditional-2/theme.html b/src/diazo/tests/v1-drop-attribute-theme-conditional-2/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme-conditional-2/theme.html rename to src/diazo/tests/v1-drop-attribute-theme-conditional-2/theme.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme/content.html b/src/diazo/tests/v1-drop-attribute-theme/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme/content.html rename to src/diazo/tests/v1-drop-attribute-theme/content.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme/output.html b/src/diazo/tests/v1-drop-attribute-theme/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme/output.html rename to src/diazo/tests/v1-drop-attribute-theme/output.html diff --git a/lib/diazo/tests/v1-drop-attribute-theme/rules.xml b/src/diazo/tests/v1-drop-attribute-theme/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme/rules.xml rename to src/diazo/tests/v1-drop-attribute-theme/rules.xml diff --git a/lib/diazo/tests/v1-drop-attribute-theme/theme.html b/src/diazo/tests/v1-drop-attribute-theme/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-attribute-theme/theme.html rename to src/diazo/tests/v1-drop-attribute-theme/theme.html diff --git a/lib/diazo/tests/v1-drop-multi-attributes-content/content.html b/src/diazo/tests/v1-drop-multi-attributes-content/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-content/content.html rename to src/diazo/tests/v1-drop-multi-attributes-content/content.html diff --git a/lib/diazo/tests/v1-drop-multi-attributes-content/output.html b/src/diazo/tests/v1-drop-multi-attributes-content/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-content/output.html rename to src/diazo/tests/v1-drop-multi-attributes-content/output.html diff --git a/lib/diazo/tests/v1-drop-multi-attributes-content/rules.xml b/src/diazo/tests/v1-drop-multi-attributes-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-content/rules.xml rename to src/diazo/tests/v1-drop-multi-attributes-content/rules.xml diff --git a/lib/diazo/tests/v1-drop-multi-attributes-content/theme.html b/src/diazo/tests/v1-drop-multi-attributes-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-content/theme.html rename to src/diazo/tests/v1-drop-multi-attributes-content/theme.html diff --git a/lib/diazo/tests/v1-drop-multi-attributes-theme/content.html b/src/diazo/tests/v1-drop-multi-attributes-theme/content.html similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-theme/content.html rename to src/diazo/tests/v1-drop-multi-attributes-theme/content.html diff --git a/lib/diazo/tests/v1-drop-multi-attributes-theme/output.html b/src/diazo/tests/v1-drop-multi-attributes-theme/output.html similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-theme/output.html rename to src/diazo/tests/v1-drop-multi-attributes-theme/output.html diff --git a/lib/diazo/tests/v1-drop-multi-attributes-theme/rules.xml b/src/diazo/tests/v1-drop-multi-attributes-theme/rules.xml similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-theme/rules.xml rename to src/diazo/tests/v1-drop-multi-attributes-theme/rules.xml diff --git a/lib/diazo/tests/v1-drop-multi-attributes-theme/theme.html b/src/diazo/tests/v1-drop-multi-attributes-theme/theme.html similarity index 100% rename from lib/diazo/tests/v1-drop-multi-attributes-theme/theme.html rename to src/diazo/tests/v1-drop-multi-attributes-theme/theme.html diff --git a/lib/diazo/tests/v1-if-content/content.html b/src/diazo/tests/v1-if-content/content.html similarity index 100% rename from lib/diazo/tests/v1-if-content/content.html rename to src/diazo/tests/v1-if-content/content.html diff --git a/lib/diazo/tests/v1-if-content/output.html b/src/diazo/tests/v1-if-content/output.html similarity index 100% rename from lib/diazo/tests/v1-if-content/output.html rename to src/diazo/tests/v1-if-content/output.html diff --git a/lib/diazo/tests/v1-if-content/rules.xml b/src/diazo/tests/v1-if-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-content/rules.xml rename to src/diazo/tests/v1-if-content/rules.xml diff --git a/lib/diazo/tests/v1-if-content/theme.html b/src/diazo/tests/v1-if-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-content/theme.html rename to src/diazo/tests/v1-if-content/theme.html diff --git a/lib/diazo/tests/v1-if-custom-param/content.html b/src/diazo/tests/v1-if-custom-param/content.html similarity index 100% rename from lib/diazo/tests/v1-if-custom-param/content.html rename to src/diazo/tests/v1-if-custom-param/content.html diff --git a/lib/diazo/tests/v1-if-custom-param/options.cfg b/src/diazo/tests/v1-if-custom-param/options.cfg similarity index 100% rename from lib/diazo/tests/v1-if-custom-param/options.cfg rename to src/diazo/tests/v1-if-custom-param/options.cfg diff --git a/lib/diazo/tests/v1-if-custom-param/output.html b/src/diazo/tests/v1-if-custom-param/output.html similarity index 100% rename from lib/diazo/tests/v1-if-custom-param/output.html rename to src/diazo/tests/v1-if-custom-param/output.html diff --git a/lib/diazo/tests/v1-if-custom-param/rules.xml b/src/diazo/tests/v1-if-custom-param/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-custom-param/rules.xml rename to src/diazo/tests/v1-if-custom-param/rules.xml diff --git a/lib/diazo/tests/v1-if-custom-param/theme.html b/src/diazo/tests/v1-if-custom-param/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-custom-param/theme.html rename to src/diazo/tests/v1-if-custom-param/theme.html diff --git a/lib/diazo/tests/v1-if-merge/content.html b/src/diazo/tests/v1-if-merge/content.html similarity index 100% rename from lib/diazo/tests/v1-if-merge/content.html rename to src/diazo/tests/v1-if-merge/content.html diff --git a/lib/diazo/tests/v1-if-merge/output.html b/src/diazo/tests/v1-if-merge/output.html similarity index 100% rename from lib/diazo/tests/v1-if-merge/output.html rename to src/diazo/tests/v1-if-merge/output.html diff --git a/lib/diazo/tests/v1-if-merge/rules.xml b/src/diazo/tests/v1-if-merge/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-merge/rules.xml rename to src/diazo/tests/v1-if-merge/rules.xml diff --git a/lib/diazo/tests/v1-if-merge/theme.html b/src/diazo/tests/v1-if-merge/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-merge/theme.html rename to src/diazo/tests/v1-if-merge/theme.html diff --git a/lib/diazo/tests/v1-if-not-content/content.html b/src/diazo/tests/v1-if-not-content/content.html similarity index 100% rename from lib/diazo/tests/v1-if-not-content/content.html rename to src/diazo/tests/v1-if-not-content/content.html diff --git a/lib/diazo/tests/v1-if-not-content/output.html b/src/diazo/tests/v1-if-not-content/output.html similarity index 100% rename from lib/diazo/tests/v1-if-not-content/output.html rename to src/diazo/tests/v1-if-not-content/output.html diff --git a/lib/diazo/tests/v1-if-not-content/rules.xml b/src/diazo/tests/v1-if-not-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-not-content/rules.xml rename to src/diazo/tests/v1-if-not-content/rules.xml diff --git a/lib/diazo/tests/v1-if-not-content/theme.html b/src/diazo/tests/v1-if-not-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-not-content/theme.html rename to src/diazo/tests/v1-if-not-content/theme.html diff --git a/lib/diazo/tests/v1-if-not-path/content.html b/src/diazo/tests/v1-if-not-path/content.html similarity index 100% rename from lib/diazo/tests/v1-if-not-path/content.html rename to src/diazo/tests/v1-if-not-path/content.html diff --git a/lib/diazo/tests/v1-if-not-path/options.cfg b/src/diazo/tests/v1-if-not-path/options.cfg similarity index 100% rename from lib/diazo/tests/v1-if-not-path/options.cfg rename to src/diazo/tests/v1-if-not-path/options.cfg diff --git a/lib/diazo/tests/v1-if-not-path/output.html b/src/diazo/tests/v1-if-not-path/output.html similarity index 100% rename from lib/diazo/tests/v1-if-not-path/output.html rename to src/diazo/tests/v1-if-not-path/output.html diff --git a/lib/diazo/tests/v1-if-not-path/rules.xml b/src/diazo/tests/v1-if-not-path/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-not-path/rules.xml rename to src/diazo/tests/v1-if-not-path/rules.xml diff --git a/lib/diazo/tests/v1-if-not-path/theme.html b/src/diazo/tests/v1-if-not-path/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-not-path/theme.html rename to src/diazo/tests/v1-if-not-path/theme.html diff --git a/lib/diazo/tests/v1-if-not/content.html b/src/diazo/tests/v1-if-not/content.html similarity index 100% rename from lib/diazo/tests/v1-if-not/content.html rename to src/diazo/tests/v1-if-not/content.html diff --git a/lib/diazo/tests/v1-if-not/output.html b/src/diazo/tests/v1-if-not/output.html similarity index 100% rename from lib/diazo/tests/v1-if-not/output.html rename to src/diazo/tests/v1-if-not/output.html diff --git a/lib/diazo/tests/v1-if-not/rules.xml b/src/diazo/tests/v1-if-not/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-not/rules.xml rename to src/diazo/tests/v1-if-not/rules.xml diff --git a/lib/diazo/tests/v1-if-not/theme.html b/src/diazo/tests/v1-if-not/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-not/theme.html rename to src/diazo/tests/v1-if-not/theme.html diff --git a/lib/diazo/tests/v1-if-path/content.html b/src/diazo/tests/v1-if-path/content.html similarity index 100% rename from lib/diazo/tests/v1-if-path/content.html rename to src/diazo/tests/v1-if-path/content.html diff --git a/lib/diazo/tests/v1-if-path/options.cfg b/src/diazo/tests/v1-if-path/options.cfg similarity index 100% rename from lib/diazo/tests/v1-if-path/options.cfg rename to src/diazo/tests/v1-if-path/options.cfg diff --git a/lib/diazo/tests/v1-if-path/output.html b/src/diazo/tests/v1-if-path/output.html similarity index 100% rename from lib/diazo/tests/v1-if-path/output.html rename to src/diazo/tests/v1-if-path/output.html diff --git a/lib/diazo/tests/v1-if-path/rules.xml b/src/diazo/tests/v1-if-path/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if-path/rules.xml rename to src/diazo/tests/v1-if-path/rules.xml diff --git a/lib/diazo/tests/v1-if-path/theme.html b/src/diazo/tests/v1-if-path/theme.html similarity index 100% rename from lib/diazo/tests/v1-if-path/theme.html rename to src/diazo/tests/v1-if-path/theme.html diff --git a/lib/diazo/tests/v1-if/content.html b/src/diazo/tests/v1-if/content.html similarity index 100% rename from lib/diazo/tests/v1-if/content.html rename to src/diazo/tests/v1-if/content.html diff --git a/lib/diazo/tests/v1-if/output.html b/src/diazo/tests/v1-if/output.html similarity index 100% rename from lib/diazo/tests/v1-if/output.html rename to src/diazo/tests/v1-if/output.html diff --git a/lib/diazo/tests/v1-if/rules.xml b/src/diazo/tests/v1-if/rules.xml similarity index 100% rename from lib/diazo/tests/v1-if/rules.xml rename to src/diazo/tests/v1-if/rules.xml diff --git a/lib/diazo/tests/v1-if/theme.html b/src/diazo/tests/v1-if/theme.html similarity index 100% rename from lib/diazo/tests/v1-if/theme.html rename to src/diazo/tests/v1-if/theme.html diff --git a/lib/diazo/tests/v1-merge-multiple-if-true/content.html b/src/diazo/tests/v1-merge-multiple-if-true/content.html similarity index 100% rename from lib/diazo/tests/v1-merge-multiple-if-true/content.html rename to src/diazo/tests/v1-merge-multiple-if-true/content.html diff --git a/lib/diazo/tests/v1-merge-multiple-if-true/output.html b/src/diazo/tests/v1-merge-multiple-if-true/output.html similarity index 100% rename from lib/diazo/tests/v1-merge-multiple-if-true/output.html rename to src/diazo/tests/v1-merge-multiple-if-true/output.html diff --git a/lib/diazo/tests/v1-merge-multiple-if-true/rules.xml b/src/diazo/tests/v1-merge-multiple-if-true/rules.xml similarity index 100% rename from lib/diazo/tests/v1-merge-multiple-if-true/rules.xml rename to src/diazo/tests/v1-merge-multiple-if-true/rules.xml diff --git a/lib/diazo/tests/v1-merge-multiple-if-true/theme.html b/src/diazo/tests/v1-merge-multiple-if-true/theme.html similarity index 100% rename from lib/diazo/tests/v1-merge-multiple-if-true/theme.html rename to src/diazo/tests/v1-merge-multiple-if-true/theme.html diff --git a/lib/diazo/tests/v1-merge-multiple/content.html b/src/diazo/tests/v1-merge-multiple/content.html similarity index 100% rename from lib/diazo/tests/v1-merge-multiple/content.html rename to src/diazo/tests/v1-merge-multiple/content.html diff --git a/lib/diazo/tests/v1-merge-multiple/output.html b/src/diazo/tests/v1-merge-multiple/output.html similarity index 100% rename from lib/diazo/tests/v1-merge-multiple/output.html rename to src/diazo/tests/v1-merge-multiple/output.html diff --git a/lib/diazo/tests/v1-merge-multiple/rules.xml b/src/diazo/tests/v1-merge-multiple/rules.xml similarity index 100% rename from lib/diazo/tests/v1-merge-multiple/rules.xml rename to src/diazo/tests/v1-merge-multiple/rules.xml diff --git a/lib/diazo/tests/v1-merge-multiple/theme.html b/src/diazo/tests/v1-merge-multiple/theme.html similarity index 100% rename from lib/diazo/tests/v1-merge-multiple/theme.html rename to src/diazo/tests/v1-merge-multiple/theme.html diff --git a/lib/diazo/tests/v1-merge-separator/content.html b/src/diazo/tests/v1-merge-separator/content.html similarity index 100% rename from lib/diazo/tests/v1-merge-separator/content.html rename to src/diazo/tests/v1-merge-separator/content.html diff --git a/lib/diazo/tests/v1-merge-separator/output.html b/src/diazo/tests/v1-merge-separator/output.html similarity index 100% rename from lib/diazo/tests/v1-merge-separator/output.html rename to src/diazo/tests/v1-merge-separator/output.html diff --git a/lib/diazo/tests/v1-merge-separator/rules.xml b/src/diazo/tests/v1-merge-separator/rules.xml similarity index 100% rename from lib/diazo/tests/v1-merge-separator/rules.xml rename to src/diazo/tests/v1-merge-separator/rules.xml diff --git a/lib/diazo/tests/v1-merge-separator/theme.html b/src/diazo/tests/v1-merge-separator/theme.html similarity index 100% rename from lib/diazo/tests/v1-merge-separator/theme.html rename to src/diazo/tests/v1-merge-separator/theme.html diff --git a/lib/diazo/tests/v1-merge/content.html b/src/diazo/tests/v1-merge/content.html similarity index 100% rename from lib/diazo/tests/v1-merge/content.html rename to src/diazo/tests/v1-merge/content.html diff --git a/lib/diazo/tests/v1-merge/output.html b/src/diazo/tests/v1-merge/output.html similarity index 100% rename from lib/diazo/tests/v1-merge/output.html rename to src/diazo/tests/v1-merge/output.html diff --git a/lib/diazo/tests/v1-merge/rules.xml b/src/diazo/tests/v1-merge/rules.xml similarity index 100% rename from lib/diazo/tests/v1-merge/rules.xml rename to src/diazo/tests/v1-merge/rules.xml diff --git a/lib/diazo/tests/v1-merge/theme.html b/src/diazo/tests/v1-merge/theme.html similarity index 100% rename from lib/diazo/tests/v1-merge/theme.html rename to src/diazo/tests/v1-merge/theme.html diff --git a/lib/diazo/tests/v1-notheme-if-content/content.html b/src/diazo/tests/v1-notheme-if-content/content.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-content/content.html rename to src/diazo/tests/v1-notheme-if-content/content.html diff --git a/lib/diazo/tests/v1-notheme-if-content/output.html b/src/diazo/tests/v1-notheme-if-content/output.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-content/output.html rename to src/diazo/tests/v1-notheme-if-content/output.html diff --git a/lib/diazo/tests/v1-notheme-if-content/rules.xml b/src/diazo/tests/v1-notheme-if-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-notheme-if-content/rules.xml rename to src/diazo/tests/v1-notheme-if-content/rules.xml diff --git a/lib/diazo/tests/v1-notheme-if-content/theme.html b/src/diazo/tests/v1-notheme-if-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-content/theme.html rename to src/diazo/tests/v1-notheme-if-content/theme.html diff --git a/lib/diazo/tests/v1-notheme-if-merge/content.html b/src/diazo/tests/v1-notheme-if-merge/content.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-merge/content.html rename to src/diazo/tests/v1-notheme-if-merge/content.html diff --git a/lib/diazo/tests/v1-notheme-if-merge/output.html b/src/diazo/tests/v1-notheme-if-merge/output.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-merge/output.html rename to src/diazo/tests/v1-notheme-if-merge/output.html diff --git a/lib/diazo/tests/v1-notheme-if-merge/rules.xml b/src/diazo/tests/v1-notheme-if-merge/rules.xml similarity index 100% rename from lib/diazo/tests/v1-notheme-if-merge/rules.xml rename to src/diazo/tests/v1-notheme-if-merge/rules.xml diff --git a/lib/diazo/tests/v1-notheme-if-merge/theme.html b/src/diazo/tests/v1-notheme-if-merge/theme.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-merge/theme.html rename to src/diazo/tests/v1-notheme-if-merge/theme.html diff --git a/lib/diazo/tests/v1-notheme-if-path/content.html b/src/diazo/tests/v1-notheme-if-path/content.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-path/content.html rename to src/diazo/tests/v1-notheme-if-path/content.html diff --git a/lib/diazo/tests/v1-notheme-if-path/options.cfg b/src/diazo/tests/v1-notheme-if-path/options.cfg similarity index 100% rename from lib/diazo/tests/v1-notheme-if-path/options.cfg rename to src/diazo/tests/v1-notheme-if-path/options.cfg diff --git a/lib/diazo/tests/v1-notheme-if-path/output.html b/src/diazo/tests/v1-notheme-if-path/output.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-path/output.html rename to src/diazo/tests/v1-notheme-if-path/output.html diff --git a/lib/diazo/tests/v1-notheme-if-path/rules.xml b/src/diazo/tests/v1-notheme-if-path/rules.xml similarity index 100% rename from lib/diazo/tests/v1-notheme-if-path/rules.xml rename to src/diazo/tests/v1-notheme-if-path/rules.xml diff --git a/lib/diazo/tests/v1-notheme-if-path/theme.html b/src/diazo/tests/v1-notheme-if-path/theme.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if-path/theme.html rename to src/diazo/tests/v1-notheme-if-path/theme.html diff --git a/lib/diazo/tests/v1-notheme-if/content.html b/src/diazo/tests/v1-notheme-if/content.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if/content.html rename to src/diazo/tests/v1-notheme-if/content.html diff --git a/lib/diazo/tests/v1-notheme-if/output.html b/src/diazo/tests/v1-notheme-if/output.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if/output.html rename to src/diazo/tests/v1-notheme-if/output.html diff --git a/lib/diazo/tests/v1-notheme-if/rules.xml b/src/diazo/tests/v1-notheme-if/rules.xml similarity index 100% rename from lib/diazo/tests/v1-notheme-if/rules.xml rename to src/diazo/tests/v1-notheme-if/rules.xml diff --git a/lib/diazo/tests/v1-notheme-if/theme.html b/src/diazo/tests/v1-notheme-if/theme.html similarity index 100% rename from lib/diazo/tests/v1-notheme-if/theme.html rename to src/diazo/tests/v1-notheme-if/theme.html diff --git a/lib/diazo/tests/v1-notheme-nomatch/content.html b/src/diazo/tests/v1-notheme-nomatch/content.html similarity index 100% rename from lib/diazo/tests/v1-notheme-nomatch/content.html rename to src/diazo/tests/v1-notheme-nomatch/content.html diff --git a/lib/diazo/tests/v1-notheme-nomatch/output.html b/src/diazo/tests/v1-notheme-nomatch/output.html similarity index 100% rename from lib/diazo/tests/v1-notheme-nomatch/output.html rename to src/diazo/tests/v1-notheme-nomatch/output.html diff --git a/lib/diazo/tests/v1-notheme-nomatch/rules.xml b/src/diazo/tests/v1-notheme-nomatch/rules.xml similarity index 100% rename from lib/diazo/tests/v1-notheme-nomatch/rules.xml rename to src/diazo/tests/v1-notheme-nomatch/rules.xml diff --git a/lib/diazo/tests/v1-notheme-nomatch/theme.html b/src/diazo/tests/v1-notheme-nomatch/theme.html similarity index 100% rename from lib/diazo/tests/v1-notheme-nomatch/theme.html rename to src/diazo/tests/v1-notheme-nomatch/theme.html diff --git a/lib/diazo/tests/v1-notheme-theme-precedence/content.html b/src/diazo/tests/v1-notheme-theme-precedence/content.html similarity index 100% rename from lib/diazo/tests/v1-notheme-theme-precedence/content.html rename to src/diazo/tests/v1-notheme-theme-precedence/content.html diff --git a/lib/diazo/tests/v1-notheme-theme-precedence/options.cfg b/src/diazo/tests/v1-notheme-theme-precedence/options.cfg similarity index 100% rename from lib/diazo/tests/v1-notheme-theme-precedence/options.cfg rename to src/diazo/tests/v1-notheme-theme-precedence/options.cfg diff --git a/lib/diazo/tests/v1-notheme-theme-precedence/output.html b/src/diazo/tests/v1-notheme-theme-precedence/output.html similarity index 100% rename from lib/diazo/tests/v1-notheme-theme-precedence/output.html rename to src/diazo/tests/v1-notheme-theme-precedence/output.html diff --git a/lib/diazo/tests/v1-notheme-theme-precedence/rules.xml b/src/diazo/tests/v1-notheme-theme-precedence/rules.xml similarity index 100% rename from lib/diazo/tests/v1-notheme-theme-precedence/rules.xml rename to src/diazo/tests/v1-notheme-theme-precedence/rules.xml diff --git a/lib/diazo/tests/v1-notheme-theme-precedence/theme.html b/src/diazo/tests/v1-notheme-theme-precedence/theme.html similarity index 100% rename from lib/diazo/tests/v1-notheme-theme-precedence/theme.html rename to src/diazo/tests/v1-notheme-theme-precedence/theme.html diff --git a/lib/diazo/tests/v1-replace-both-children/content.html b/src/diazo/tests/v1-replace-both-children/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-both-children/content.html rename to src/diazo/tests/v1-replace-both-children/content.html diff --git a/lib/diazo/tests/v1-replace-both-children/output.html b/src/diazo/tests/v1-replace-both-children/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-both-children/output.html rename to src/diazo/tests/v1-replace-both-children/output.html diff --git a/lib/diazo/tests/v1-replace-both-children/rules.xml b/src/diazo/tests/v1-replace-both-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-both-children/rules.xml rename to src/diazo/tests/v1-replace-both-children/rules.xml diff --git a/lib/diazo/tests/v1-replace-both-children/theme.html b/src/diazo/tests/v1-replace-both-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-both-children/theme.html rename to src/diazo/tests/v1-replace-both-children/theme.html diff --git a/lib/diazo/tests/v1-replace-content-children/content.html b/src/diazo/tests/v1-replace-content-children/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-children/content.html rename to src/diazo/tests/v1-replace-content-children/content.html diff --git a/lib/diazo/tests/v1-replace-content-children/output.html b/src/diazo/tests/v1-replace-content-children/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-children/output.html rename to src/diazo/tests/v1-replace-content-children/output.html diff --git a/lib/diazo/tests/v1-replace-content-children/rules.xml b/src/diazo/tests/v1-replace-content-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content-children/rules.xml rename to src/diazo/tests/v1-replace-content-children/rules.xml diff --git a/lib/diazo/tests/v1-replace-content-children/theme.html b/src/diazo/tests/v1-replace-content-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-children/theme.html rename to src/diazo/tests/v1-replace-content-children/theme.html diff --git a/lib/diazo/tests/v1-replace-content-conditional-1/content.html b/src/diazo/tests/v1-replace-content-conditional-1/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-1/content.html rename to src/diazo/tests/v1-replace-content-conditional-1/content.html diff --git a/lib/diazo/tests/v1-replace-content-conditional-1/output.html b/src/diazo/tests/v1-replace-content-conditional-1/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-1/output.html rename to src/diazo/tests/v1-replace-content-conditional-1/output.html diff --git a/lib/diazo/tests/v1-replace-content-conditional-1/rules.xml b/src/diazo/tests/v1-replace-content-conditional-1/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-1/rules.xml rename to src/diazo/tests/v1-replace-content-conditional-1/rules.xml diff --git a/lib/diazo/tests/v1-replace-content-conditional-1/theme.html b/src/diazo/tests/v1-replace-content-conditional-1/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-1/theme.html rename to src/diazo/tests/v1-replace-content-conditional-1/theme.html diff --git a/lib/diazo/tests/v1-replace-content-conditional-2/content.html b/src/diazo/tests/v1-replace-content-conditional-2/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-2/content.html rename to src/diazo/tests/v1-replace-content-conditional-2/content.html diff --git a/lib/diazo/tests/v1-replace-content-conditional-2/output.html b/src/diazo/tests/v1-replace-content-conditional-2/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-2/output.html rename to src/diazo/tests/v1-replace-content-conditional-2/output.html diff --git a/lib/diazo/tests/v1-replace-content-conditional-2/rules.xml b/src/diazo/tests/v1-replace-content-conditional-2/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-2/rules.xml rename to src/diazo/tests/v1-replace-content-conditional-2/rules.xml diff --git a/lib/diazo/tests/v1-replace-content-conditional-2/theme.html b/src/diazo/tests/v1-replace-content-conditional-2/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-conditional-2/theme.html rename to src/diazo/tests/v1-replace-content-conditional-2/theme.html diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-1/content.html b/src/diazo/tests/v1-replace-content-content-children-conditional-1/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-1/content.html rename to src/diazo/tests/v1-replace-content-content-children-conditional-1/content.html diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-1/output.html b/src/diazo/tests/v1-replace-content-content-children-conditional-1/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-1/output.html rename to src/diazo/tests/v1-replace-content-content-children-conditional-1/output.html diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-1/rules.xml b/src/diazo/tests/v1-replace-content-content-children-conditional-1/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-1/rules.xml rename to src/diazo/tests/v1-replace-content-content-children-conditional-1/rules.xml diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-1/theme.html b/src/diazo/tests/v1-replace-content-content-children-conditional-1/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-1/theme.html rename to src/diazo/tests/v1-replace-content-content-children-conditional-1/theme.html diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-2/content.html b/src/diazo/tests/v1-replace-content-content-children-conditional-2/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-2/content.html rename to src/diazo/tests/v1-replace-content-content-children-conditional-2/content.html diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-2/output.html b/src/diazo/tests/v1-replace-content-content-children-conditional-2/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-2/output.html rename to src/diazo/tests/v1-replace-content-content-children-conditional-2/output.html diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-2/rules.xml b/src/diazo/tests/v1-replace-content-content-children-conditional-2/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-2/rules.xml rename to src/diazo/tests/v1-replace-content-content-children-conditional-2/rules.xml diff --git a/lib/diazo/tests/v1-replace-content-content-children-conditional-2/theme.html b/src/diazo/tests/v1-replace-content-content-children-conditional-2/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children-conditional-2/theme.html rename to src/diazo/tests/v1-replace-content-content-children-conditional-2/theme.html diff --git a/lib/diazo/tests/v1-replace-content-content-children/content.html b/src/diazo/tests/v1-replace-content-content-children/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children/content.html rename to src/diazo/tests/v1-replace-content-content-children/content.html diff --git a/lib/diazo/tests/v1-replace-content-content-children/output.html b/src/diazo/tests/v1-replace-content-content-children/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children/output.html rename to src/diazo/tests/v1-replace-content-content-children/output.html diff --git a/lib/diazo/tests/v1-replace-content-content-children/rules.xml b/src/diazo/tests/v1-replace-content-content-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children/rules.xml rename to src/diazo/tests/v1-replace-content-content-children/rules.xml diff --git a/lib/diazo/tests/v1-replace-content-content-children/theme.html b/src/diazo/tests/v1-replace-content-content-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content-content-children/theme.html rename to src/diazo/tests/v1-replace-content-content-children/theme.html diff --git a/lib/diazo/tests/v1-replace-content/content.html b/src/diazo/tests/v1-replace-content/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-content/content.html rename to src/diazo/tests/v1-replace-content/content.html diff --git a/lib/diazo/tests/v1-replace-content/output.html b/src/diazo/tests/v1-replace-content/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-content/output.html rename to src/diazo/tests/v1-replace-content/output.html diff --git a/lib/diazo/tests/v1-replace-content/rules.xml b/src/diazo/tests/v1-replace-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-content/rules.xml rename to src/diazo/tests/v1-replace-content/rules.xml diff --git a/lib/diazo/tests/v1-replace-content/theme.html b/src/diazo/tests/v1-replace-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-content/theme.html rename to src/diazo/tests/v1-replace-content/theme.html diff --git a/lib/diazo/tests/v1-replace-theme-children/content.html b/src/diazo/tests/v1-replace-theme-children/content.html similarity index 100% rename from lib/diazo/tests/v1-replace-theme-children/content.html rename to src/diazo/tests/v1-replace-theme-children/content.html diff --git a/lib/diazo/tests/v1-replace-theme-children/output.html b/src/diazo/tests/v1-replace-theme-children/output.html similarity index 100% rename from lib/diazo/tests/v1-replace-theme-children/output.html rename to src/diazo/tests/v1-replace-theme-children/output.html diff --git a/lib/diazo/tests/v1-replace-theme-children/rules.xml b/src/diazo/tests/v1-replace-theme-children/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace-theme-children/rules.xml rename to src/diazo/tests/v1-replace-theme-children/rules.xml diff --git a/lib/diazo/tests/v1-replace-theme-children/theme.html b/src/diazo/tests/v1-replace-theme-children/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace-theme-children/theme.html rename to src/diazo/tests/v1-replace-theme-children/theme.html diff --git a/lib/diazo/tests/v1-replace/content.html b/src/diazo/tests/v1-replace/content.html similarity index 100% rename from lib/diazo/tests/v1-replace/content.html rename to src/diazo/tests/v1-replace/content.html diff --git a/lib/diazo/tests/v1-replace/output.html b/src/diazo/tests/v1-replace/output.html similarity index 100% rename from lib/diazo/tests/v1-replace/output.html rename to src/diazo/tests/v1-replace/output.html diff --git a/lib/diazo/tests/v1-replace/rules.xml b/src/diazo/tests/v1-replace/rules.xml similarity index 100% rename from lib/diazo/tests/v1-replace/rules.xml rename to src/diazo/tests/v1-replace/rules.xml diff --git a/lib/diazo/tests/v1-replace/theme.html b/src/diazo/tests/v1-replace/theme.html similarity index 100% rename from lib/diazo/tests/v1-replace/theme.html rename to src/diazo/tests/v1-replace/theme.html diff --git a/lib/diazo/tests/v1-strip-content/content.html b/src/diazo/tests/v1-strip-content/content.html similarity index 100% rename from lib/diazo/tests/v1-strip-content/content.html rename to src/diazo/tests/v1-strip-content/content.html diff --git a/lib/diazo/tests/v1-strip-content/output.html b/src/diazo/tests/v1-strip-content/output.html similarity index 100% rename from lib/diazo/tests/v1-strip-content/output.html rename to src/diazo/tests/v1-strip-content/output.html diff --git a/lib/diazo/tests/v1-strip-content/rules.xml b/src/diazo/tests/v1-strip-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-strip-content/rules.xml rename to src/diazo/tests/v1-strip-content/rules.xml diff --git a/lib/diazo/tests/v1-strip-content/theme.html b/src/diazo/tests/v1-strip-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-strip-content/theme.html rename to src/diazo/tests/v1-strip-content/theme.html diff --git a/lib/diazo/tests/v1-strip-if-content/content.html b/src/diazo/tests/v1-strip-if-content/content.html similarity index 100% rename from lib/diazo/tests/v1-strip-if-content/content.html rename to src/diazo/tests/v1-strip-if-content/content.html diff --git a/lib/diazo/tests/v1-strip-if-content/output.html b/src/diazo/tests/v1-strip-if-content/output.html similarity index 100% rename from lib/diazo/tests/v1-strip-if-content/output.html rename to src/diazo/tests/v1-strip-if-content/output.html diff --git a/lib/diazo/tests/v1-strip-if-content/rules.xml b/src/diazo/tests/v1-strip-if-content/rules.xml similarity index 100% rename from lib/diazo/tests/v1-strip-if-content/rules.xml rename to src/diazo/tests/v1-strip-if-content/rules.xml diff --git a/lib/diazo/tests/v1-strip-if-content/theme.html b/src/diazo/tests/v1-strip-if-content/theme.html similarity index 100% rename from lib/diazo/tests/v1-strip-if-content/theme.html rename to src/diazo/tests/v1-strip-if-content/theme.html diff --git a/lib/diazo/tests/v1-strip-if-theme/content.html b/src/diazo/tests/v1-strip-if-theme/content.html similarity index 100% rename from lib/diazo/tests/v1-strip-if-theme/content.html rename to src/diazo/tests/v1-strip-if-theme/content.html diff --git a/lib/diazo/tests/v1-strip-if-theme/output.html b/src/diazo/tests/v1-strip-if-theme/output.html similarity index 100% rename from lib/diazo/tests/v1-strip-if-theme/output.html rename to src/diazo/tests/v1-strip-if-theme/output.html diff --git a/lib/diazo/tests/v1-strip-if-theme/rules.xml b/src/diazo/tests/v1-strip-if-theme/rules.xml similarity index 100% rename from lib/diazo/tests/v1-strip-if-theme/rules.xml rename to src/diazo/tests/v1-strip-if-theme/rules.xml diff --git a/lib/diazo/tests/v1-strip-if-theme/theme.html b/src/diazo/tests/v1-strip-if-theme/theme.html similarity index 100% rename from lib/diazo/tests/v1-strip-if-theme/theme.html rename to src/diazo/tests/v1-strip-if-theme/theme.html diff --git a/lib/diazo/tests/v1-strip-theme/content.html b/src/diazo/tests/v1-strip-theme/content.html similarity index 100% rename from lib/diazo/tests/v1-strip-theme/content.html rename to src/diazo/tests/v1-strip-theme/content.html diff --git a/lib/diazo/tests/v1-strip-theme/output.html b/src/diazo/tests/v1-strip-theme/output.html similarity index 100% rename from lib/diazo/tests/v1-strip-theme/output.html rename to src/diazo/tests/v1-strip-theme/output.html diff --git a/lib/diazo/tests/v1-strip-theme/rules.xml b/src/diazo/tests/v1-strip-theme/rules.xml similarity index 100% rename from lib/diazo/tests/v1-strip-theme/rules.xml rename to src/diazo/tests/v1-strip-theme/rules.xml diff --git a/lib/diazo/tests/v1-strip-theme/theme.html b/src/diazo/tests/v1-strip-theme/theme.html similarity index 100% rename from lib/diazo/tests/v1-strip-theme/theme.html rename to src/diazo/tests/v1-strip-theme/theme.html diff --git a/lib/diazo/tests/without-theme/content.html b/src/diazo/tests/without-theme/content.html similarity index 100% rename from lib/diazo/tests/without-theme/content.html rename to src/diazo/tests/without-theme/content.html diff --git a/lib/diazo/tests/without-theme/options.cfg b/src/diazo/tests/without-theme/options.cfg similarity index 100% rename from lib/diazo/tests/without-theme/options.cfg rename to src/diazo/tests/without-theme/options.cfg diff --git a/lib/diazo/tests/without-theme/output.html b/src/diazo/tests/without-theme/output.html similarity index 100% rename from lib/diazo/tests/without-theme/output.html rename to src/diazo/tests/without-theme/output.html diff --git a/lib/diazo/tests/without-theme/rules.xml b/src/diazo/tests/without-theme/rules.xml similarity index 100% rename from lib/diazo/tests/without-theme/rules.xml rename to src/diazo/tests/without-theme/rules.xml diff --git a/lib/diazo/tests/xinclude/content.html b/src/diazo/tests/xinclude/content.html similarity index 100% rename from lib/diazo/tests/xinclude/content.html rename to src/diazo/tests/xinclude/content.html diff --git a/lib/diazo/tests/xinclude/included-rules.xml b/src/diazo/tests/xinclude/included-rules.xml similarity index 100% rename from lib/diazo/tests/xinclude/included-rules.xml rename to src/diazo/tests/xinclude/included-rules.xml diff --git a/lib/diazo/tests/xinclude/output.html b/src/diazo/tests/xinclude/output.html similarity index 100% rename from lib/diazo/tests/xinclude/output.html rename to src/diazo/tests/xinclude/output.html diff --git a/lib/diazo/tests/xinclude/rules.xml b/src/diazo/tests/xinclude/rules.xml similarity index 100% rename from lib/diazo/tests/xinclude/rules.xml rename to src/diazo/tests/xinclude/rules.xml diff --git a/lib/diazo/tests/xinclude/theme.html b/src/diazo/tests/xinclude/theme.html similarity index 100% rename from lib/diazo/tests/xinclude/theme.html rename to src/diazo/tests/xinclude/theme.html diff --git a/lib/diazo/update-namespace.xsl b/src/diazo/update-namespace.xsl similarity index 100% rename from lib/diazo/update-namespace.xsl rename to src/diazo/update-namespace.xsl diff --git a/src/diazo/utils.py b/src/diazo/utils.py new file mode 100644 index 00000000..d7e2e67b --- /dev/null +++ b/src/diazo/utils.py @@ -0,0 +1,206 @@ +from lxml import etree +from optparse import OptionParser + +import logging +import pkg_resources +import sys + + +try: + stdout = sys.stdout.buffer +except AttributeError: + # This can happen in (doc-)tests e. g. in plone.app.testing: + stdout = None + +strparam = etree.XSLT.strparam + +logger = logging.getLogger("diazo") + +namespaces = dict( + diazo="http://namespaces.plone.org/diazo", + css="http://namespaces.plone.org/diazo/css", + old1="http://openplans.org/deliverance", + old2="http://namespaces.plone.org/xdv", + oldcss1="http://namespaces.plone.org/xdv+css", + oldcss2="http://namespaces.plone.org/diazo+css", + xml="http://www.w3.org/XML/1998/namespace", + xsl="http://www.w3.org/1999/XSL/Transform", +) + + +def localname(name): + return name.rsplit("}", 1)[1] + + +def namespace(name): + return name.rsplit("}", 1)[0][1:] + + +def fullname(namespace, name): + return f"{{{namespace}}}{name}" # NOQA: S001 + + +AC_READ_FILE = etree.XSLTAccessControl( + read_file=True, + write_file=False, + create_dir=False, + read_network=False, + write_network=False, +) +AC_READ_NET = etree.XSLTAccessControl( + read_file=True, + write_file=False, + create_dir=False, + read_network=True, + write_network=False, +) + + +class CustomResolver(etree.Resolver): + def __init__(self, data): + self.data = data + + def resolve(self, url, pubid, context): + output = self.data.get(url) + if output is not None: + return self.resolve_string(output, context) + + +class LoggingXSLTWrapper: + def __init__(self, xslt, logger): + self.xslt = xslt + self.logger = logger + + def __call__(self, *args, **kw): + result = self.xslt(*args, **kw) + for msg in self.xslt.error_log: + if msg.type == etree.ErrorTypes.ERR_OK: + self.logger.debug(msg.message) + else: + self.logger.debug(msg) + return result + + +def pkg_parse(name, parser=None): + with open(pkg_resources.resource_filename("diazo", name)) as f: + return etree.parse(f, parser=parser) + + +def pkg_xsl(name, parser=None): + return LoggingXSLTWrapper(etree.XSLT(pkg_parse(name, parser)), logger) + + +def quote_param(value): + """Quote for passing as an XSL parameter. + + Works with strings, booleans, numbers and None. + """ + + if isinstance(value, str): + return strparam(value) + elif isinstance(value, bool): + return value and "true()" or "false()" + elif isinstance(value, (int,) + (float,)): + value = repr(value) + elif value is None: + return "/.." + else: + raise ValueError("Cannot convert %s", value) + + +def split_params(s): + """Turn foo,bar=baz into {'foo': None, 'bar': 'baz'}""" + + xsl_params = {} + for param in s.split(","): + tokens = [t.strip() for t in param.split("=")] + xsl_params[tokens[0]] = len(tokens) > 1 and tokens[1] or None + return xsl_params + + +def _createOptionParser(usage): + parser = OptionParser(usage=usage) + parser.add_option( + "-o", + "--output", + metavar="output.xsl", + help="Output filename (instead of stdout)", + dest="output", + default=stdout, + ) + parser.add_option( + "-p", + "--pretty-print", + action="store_true", + help="Pretty print output (may alter rendering in browser)", + dest="pretty_print", + default=False, + ) + parser.add_option( + "--trace", + action="store_true", + help="Compiler trace logging", + dest="trace", + default=False, + ) + parser.add_option( + "-a", + "--absolute-prefix", + metavar="/", + help="relative urls in the theme file will be made into absolute " + "links with this prefix.", + dest="absolute_prefix", + default=None, + ) + parser.add_option( + "-i", + "--includemode", + metavar="INC", + help="include mode (document, ssi, ssiwait or esi)", + dest="includemode", + default=None, + ) + parser.add_option( + "-n", + "--network", + action="store_true", + help="Allow reads to the network to fetch resources", + dest="read_network", + default=False, + ) + parser.add_option( + "-t", + "--theme", + metavar="theme.html", + help="Theme file", + dest="theme", + default=None, + ) + parser.add_option( + "-r", + "--rules", + metavar="rules.xml", + help="Diazo rules file", + dest="rules", + default=None, + ) + parser.add_option( + "-c", + "--custom-parameters", + metavar="param1,param2=defaultval", + help="Comma-separated list of custom parameter names with optional " + "default values that the compiled theme will be able accept " + "when run", + dest="xsl_params", + default=None, + ) + parser.add_option( + "-e", + "--extra", + metavar="extra.xsl", + help="Extra XSL to be included in the transform " + "(deprecated, use inline xsl in the rules instead)", + dest="extra", + default=None, + ) + return parser diff --git a/lib/diazo/wsgi.py b/src/diazo/wsgi.py similarity index 75% rename from lib/diazo/wsgi.py rename to src/diazo/wsgi.py index 96b184e5..60d9c8e1 100644 --- a/lib/diazo/wsgi.py +++ b/src/diazo/wsgi.py @@ -1,13 +1,10 @@ -# -*- coding: utf-8 -*- - from diazo.compiler import compile_theme from diazo.utils import pkg_parse from diazo.utils import quote_param from lxml import etree from repoze.xmliter.serializer import XMLSerializer from repoze.xmliter.utils import getHTMLSerializer -from six import string_types -from six.moves.urllib.parse import unquote_plus +from urllib.parse import unquote_plus from webob import Request import os.path @@ -15,19 +12,33 @@ import re -DIAZO_OFF_HEADER = 'X-Diazo-Off' +DIAZO_OFF_HEADER = "X-Diazo-Off" def asbool(value): - if isinstance(value, string_types): + if isinstance(value, str): value = value.strip().lower() - if value in ('true', 'yes', 'on', 'y', 't', '1', ): + if value in ( + "true", + "yes", + "on", + "y", + "t", + "1", + ): return True - elif value in ('false', 'no', 'off', 'n', 'f', '0', ): + elif value in ( + "false", + "no", + "off", + "n", + "f", + "0", + ): return False else: raise ValueError( - 'String is not true/false: {value:r}'.format( + "String is not true/false: {value:r}".format( value=value, ), ) @@ -37,8 +48,9 @@ def asbool(value): class FilesystemResolver(etree.Resolver): """Resolver for filesystem paths""" + def resolve(self, system_url, public_id, context): - if '://' not in system_url and os.path.exists(system_url): + if "://" not in system_url and os.path.exists(system_url): return self.resolve_filename(system_url, context) else: return None @@ -46,8 +58,9 @@ def resolve(self, system_url, public_id, context): class NetworkResolver(etree.Resolver): """Resolver for network urls""" + def resolve(self, system_url, public_id, context): - if '://' in system_url and system_url != 'file:///__diazo__': + if "://" in system_url and system_url != "file:///__diazo__": return self.resolve_filename(system_url, context) else: return None @@ -57,11 +70,11 @@ class PythonResolver(etree.Resolver): """Resolver for python:// urls""" def resolve(self, system_url, public_id, context): - if not system_url.lower().startswith('python://'): + if not system_url.lower().startswith("python://"): return None spec = system_url[9:] - package, resource_name = spec.split('/', 1) + package, resource_name = spec.split("/", 1) filename = pkg_resources.resource_filename(package, resource_name) return self.resolve_filename(filename, context) @@ -75,47 +88,50 @@ def __init__(self, app): def resolve(self, system_url, public_id, context): # Ignore URLs with a scheme - if '://' in system_url: + if "://" in system_url: return None # Ignore the special 'diazo:' resolvers - if system_url.startswith('diazo:'): + if system_url.startswith("diazo:"): return None subrequest = Request.blank(system_url) response = subrequest.get_response(self.app) status_code, reason = response.status.split(None, 1) - if not status_code == '200': + if not status_code == "200": return None if response.charset is None: - response.charset = 'UTF-8' # Maybe this should be latin1? + response.charset = "UTF-8" # Maybe this should be latin1? result = response.text if response.content_type in ( - 'text/javascript', - 'application/x-javascript', + "text/javascript", + "application/x-javascript", ): - result = u''.join([ - u'', - ]) - elif response.content_type == 'text/css': - result = u''.join([ - u'', - ]) + result = "".join( + [ + '", + ] + ) + elif response.content_type == "text/css": + result = "".join( + [ + '", + ] + ) return self.resolve_string(result, context) -class XSLTMiddleware(object): - """Apply XSLT in middleware - """ +class XSLTMiddleware: + """Apply XSLT in middleware""" def __init__( self, @@ -127,37 +143,37 @@ def __init__( read_file=True, update_content_length=False, ignored_extensions=( - 'js', - 'css', - 'gif', - 'jpg', - 'jpeg', - 'pdf', - 'ps', - 'doc', - 'png', - 'ico', - 'mov', - 'mpg', - 'mpeg', - 'mp3', - 'm4a', - 'txt', - 'rtf', - 'swf', - 'wav', - 'zip', - 'wmv', - 'ppt', - 'gz', - 'tgz', - 'jar', - 'xls', - 'bmp', - 'tif', - 'tga', - 'hqx', - 'avi', + "js", + "css", + "gif", + "jpg", + "jpeg", + "pdf", + "ps", + "doc", + "png", + "ico", + "mov", + "mpg", + "mpeg", + "mp3", + "m4a", + "txt", + "rtf", + "swf", + "wav", + "zip", + "wmv", + "ppt", + "gz", + "tgz", + "jar", + "xls", + "bmp", + "tif", + "tga", + "hqx", + "avi", ), environ_param_map=None, unquoted_params=None, @@ -165,7 +181,7 @@ def __init__( content_type=None, charset=None, remove_conditional_headers=False, - **params # NOQA: C816 + **params, # NOQA: C816 ): """Initialise, giving a filename or parsed XSLT tree. @@ -215,37 +231,37 @@ def __init__( if content_type is None: mediatype = tree.xpath( - '/xsl:stylesheet/xsl:output/@media-type', - namespaces=dict(xsl='http://www.w3.org/1999/XSL/Transform'), + "/xsl:stylesheet/xsl:output/@media-type", + namespaces=dict(xsl="http://www.w3.org/1999/XSL/Transform"), ) if mediatype: content_type = mediatype[-1] else: method = tree.xpath( - '/xsl:stylesheet/xsl:output/@method', + "/xsl:stylesheet/xsl:output/@method", namespaces=dict( - xsl='http://www.w3.org/1999/XSL/Transform', + xsl="http://www.w3.org/1999/XSL/Transform", ), ) if method: method = method[-1] - if method.lower() == 'html': - content_type = 'text/html' - elif method.lower() == 'text': - content_type = 'text/plain' - elif method.lower() == 'xml': - content_type = 'text/xml' + if method.lower() == "html": + content_type = "text/html" + elif method.lower() == "text": + content_type = "text/plain" + elif method.lower() == "xml": + content_type = "text/xml" self.content_type = content_type if charset is None: encoding = tree.xpath( - '/xsl:stylesheet/xsl:output/@encoding', - namespaces=dict(xsl='http://www.w3.org/1999/XSL/Transform'), + "/xsl:stylesheet/xsl:output/@encoding", + namespaces=dict(xsl="http://www.w3.org/1999/XSL/Transform"), ) if encoding: charset = encoding[-1] else: - charset = 'UTF-8' + charset = "UTF-8" self.charset = charset self.read_network = asbool(read_network) @@ -262,14 +278,13 @@ def __init__( self.ignored_extensions = frozenset(ignored_extensions) self.ignored_pattern = re.compile( - '^.*\.({ext:s})$'.format(ext='|'.join(ignored_extensions)), + r"^.*\.({ext:s})$".format(ext="|".join(ignored_extensions)), ) self.environ_param_map = environ_param_map or {} - if isinstance(unquoted_params, string_types): + if isinstance(unquoted_params, str): unquoted_params = unquoted_params.split() - self.unquoted_params = unquoted_params and \ - frozenset(unquoted_params) or () + self.unquoted_params = unquoted_params and frozenset(unquoted_params) or () self.params = params self.doctype = doctype self.remove_conditional_headers = asbool(remove_conditional_headers) @@ -297,7 +312,7 @@ def __call__(self, environ, start_response): input_encoding = response.charset # Note, the Content-Length header will not be set - if request.method == 'HEAD': + if request.method == "HEAD": self.reset_headers(response) return response(environ, start_response) @@ -312,7 +327,7 @@ def __call__(self, environ, start_response): # Headers should be left intact return response(environ, start_response) finally: - if getattr(response.app_iter, 'close', None): + if getattr(response.app_iter, "close", None): response.app_iter.close() self.reset_headers(response) @@ -338,10 +353,10 @@ def __call__(self, environ, start_response): # Set content type (normally inferred from stylesheet) # Unfortunately lxml does not expose docinfo.mediaType if self.content_type is None: - if tree.getroot().tag == 'html': - response.content_type = 'text/html' + if tree.getroot().tag == "html": + response.content_type = "text/html" else: - response.content_type = 'text/xml' + response.content_type = "text/xml" response.charset = tree.docinfo.encoding or self.charset # Return a repoze.xmliter XMLSerializer, which helps avoid re-parsing @@ -357,10 +372,9 @@ def __call__(self, environ, start_response): return response(environ, start_response) def should_ignore(self, request): - """Determine if we should ignore the request - """ + """Determine if we should ignore the request""" - if asbool(request.headers.get(DIAZO_OFF_HEADER, 'no')): + if asbool(request.headers.get(DIAZO_OFF_HEADER, "no")): return True path = request.path_info @@ -370,29 +384,28 @@ def should_ignore(self, request): return False def should_transform(self, response): - """Determine if we should transform the response - """ + """Determine if we should transform the response""" - if asbool(response.headers.get(DIAZO_OFF_HEADER, 'no')): + if asbool(response.headers.get(DIAZO_OFF_HEADER, "no")): return False - content_type = response.headers.get('Content-Type') + content_type = response.headers.get("Content-Type") if not content_type or not ( - content_type.lower().startswith('text/html') or - content_type.lower().startswith('application/xhtml+xml') + content_type.lower().startswith("text/html") + or content_type.lower().startswith("application/xhtml+xml") ): return False - content_encoding = response.headers.get('Content-Encoding') - if content_encoding in ('zip', 'deflate', 'compress',): + content_encoding = response.headers.get("Content-Encoding") + if content_encoding in ( + "zip", + "deflate", + "compress", + ): return False status_code, reason = response.status.split(None, 1) - if ( - status_code.startswith('3') or - status_code == '204' or - status_code == '401' - ): + if status_code.startswith("3") or status_code == "204" or status_code == "401": return False if response.content_length == 0: @@ -415,9 +428,8 @@ def reset_headers(self, response): response.charset = self.charset -class DiazoMiddleware(object): - """Invoke the Diazo transform as middleware - """ +class DiazoMiddleware: + """Invoke the Diazo transform as middleware""" def __init__( self, @@ -426,50 +438,50 @@ def __init__( rules, theme=None, prefix=None, - includemode='document', + includemode="document", debug=False, read_network=False, read_file=True, update_content_length=False, ignored_extensions=( - 'js', - 'css', - 'gif', - 'jpg', - 'jpeg', - 'pdf', - 'ps', - 'doc', - 'png', - 'ico', - 'mov', - 'mpg', - 'mpeg', - 'mp3', - 'm4a', - 'txt', - 'rtf', - 'swf', - 'wav', - 'zip', - 'wmv', - 'ppt', - 'gz', - 'tgz', - 'jar', - 'xls', - 'bmp', - 'tif', - 'tga', - 'hqx', - 'avi', + "js", + "css", + "gif", + "jpg", + "jpeg", + "pdf", + "ps", + "doc", + "png", + "ico", + "mov", + "mpg", + "mpeg", + "mp3", + "m4a", + "txt", + "rtf", + "swf", + "wav", + "zip", + "wmv", + "ppt", + "gz", + "tgz", + "jar", + "xls", + "bmp", + "tif", + "tga", + "hqx", + "avi", ), environ_param_map=None, unquoted_params=None, doctype=None, content_type=None, filter_xpath=False, - **params # NOQA: C816 + **params, # NOQA: C816 ): """Create the middleware. The parameters are: @@ -546,12 +558,14 @@ def __init__( self.filter_middleware = self.get_filter_middleware() self.environ_param_map = environ_param_map or {} - self.environ_param_map.update({ - 'diazo.path': 'path', - 'diazo.query_string': 'query_string', - 'diazo.host': 'host', - 'diazo.scheme': 'scheme', - }) + self.environ_param_map.update( + { + "diazo.path": "path", + "diazo.query_string": "query_string", + "diazo.host": "host", + "diazo.scheme": "scheme", + } + ) self.params = params.copy() @@ -609,11 +623,11 @@ def get_transform_middleware(self): doctype=self.doctype, content_type=self.content_type, unquoted_params=self.unquoted_params, - **self.params # NOQA: C815,S101 + **self.params, # NOQA: C815,S101 ) def get_filter_middleware(self): - tree = pkg_parse('filter_xhtml.xsl') + tree = pkg_parse("filter_xhtml.xsl") return XSLTMiddleware( self.app, self.global_conf, @@ -622,22 +636,22 @@ def get_filter_middleware(self): read_file=False, update_content_length=self.update_content_length, ignored_extensions=self.ignored_extensions, - environ_param_map={'diazo.filter_xpath': 'xpath'}, - doctype='', + environ_param_map={"diazo.filter_xpath": "xpath"}, + doctype="", content_type=self.content_type, - unquoted_params=['xpath'], + unquoted_params=["xpath"], ) def __call__(self, environ, start_response): if self.filter_xpath: - filter_xpath = ';filter_xpath=' - query_string = environ.get('QUERY_STRING', '') + filter_xpath = ";filter_xpath=" + query_string = environ.get("QUERY_STRING", "") if filter_xpath in query_string: - environ['QUERY_STRING'], xpath = query_string.rsplit( + environ["QUERY_STRING"], xpath = query_string.rsplit( filter_xpath, 1, ) - environ['diazo.filter_xpath'] = unquote_plus(xpath) + environ["diazo.filter_xpath"] = unquote_plus(xpath) return self.filter_middleware(environ, start_response) transform_middleware = self.transform_middleware @@ -649,11 +663,11 @@ def __call__(self, environ, start_response): # Set up variables, some of which are used as transform parameters request = Request(environ) - environ['diazo.rules'] = self.rules - environ['diazo.absolute_prefix'] = self.absolute_prefix - environ['diazo.path'] = request.path - environ['diazo.query_string'] = request.query_string - environ['diazo.host'] = request.host - environ['diazo.scheme'] = request.scheme + environ["diazo.rules"] = self.rules + environ["diazo.absolute_prefix"] = self.absolute_prefix + environ["diazo.path"] = request.path + environ["diazo.query_string"] = request.query_string + environ["diazo.host"] = request.host + environ["diazo.scheme"] = request.scheme return transform_middleware(environ, start_response) diff --git a/templates/nginx.conf.in b/templates/nginx.conf.in deleted file mode 100644 index d0aab531..00000000 --- a/templates/nginx.conf.in +++ /dev/null @@ -1,78 +0,0 @@ -worker_processes 1; -error_log ${buildout:directory}/var/log/nginx-error.log debug; - -events { -# worker_connections 1024; -} - -http { - include ${buildout:directory}/etc/mime.types; -# gzip on; - server { - listen ${port}; - server_name localhost; - root ${root}; - autoindex on; - - # Decide if we need to filter - if ($args ~ "^(.*);filter_xpath=(.*)$") { - set $newargs $1; - set $filter_xpath $2; - # rewrite args to avoid looping - rewrite ^(.*)$ /_include$1?$newargs?; - } - - location @include500 { return 500; } - location @include404 { return 404; } - - location ^~ /_include { - # Restrict to subrequests - internal; - error_page 404 = @include404; - - # Cache in Varnish for 1h - expires 1h; - - # Proxy - rewrite ^/_include(.*)$ $1 break; - proxy_pass http://127.0.0.1:${port}; - - # Our safety belt. - proxy_set_header X-Loop 1$http_X_Loop; # unary count - proxy_set_header Accept-Encoding ""; - error_page 500 = @include500; - if ($http_X_Loop ~ "11111") { - return 500; - } - - # Filter by xpath - xslt_stylesheet ${filter.xsl} - xpath=$filter_xpath - ; - xslt_html_parser on; - xslt_types text/html; - } - - # Our styled location. - location /styled { - alias ${root}; - xslt_stylesheet ${example.xsl} - path='$uri' - ; - xslt_html_parser on; - xslt_types text/html; - # Switch on ssi here to enable external includes. - ssi on; - } - - # Another styled location. - location /styled/ploneorg { - alias ${root}/ploneorg; - xslt_stylesheet ${ploneorg.xsl} - path='$uri' - ; - xslt_html_parser on; - xslt_types text/html; - } - } -} diff --git a/templates/varnish.vcl.in b/templates/varnish.vcl.in deleted file mode 100644 index 8378dae9..00000000 --- a/templates/varnish.vcl.in +++ /dev/null @@ -1,14 +0,0 @@ -backend default { - .host = "127.0.0.1"; - .port = "${nginx.conf:port}"; -} - -sub vcl_recv { - set req.backend = default; -} - -sub vcl_fetch { - if (obj.http.Content-Type == "text/html; charset=utf-8") { - esi; - } -} diff --git a/tox.ini b/tox.ini index 642f24c1..d6e347c4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,144 +1,216 @@ -# Tox (http://tox.testrun.org/) is a tool for running tests in multiple virtualenvs. -# This configuration file will run the test suite on all supported python versions. -# To use it, "pip install -c constrains.txt tox" and then run "tox" from this directory. - +# Generated from: +# https://github.com/plone/meta/tree/main/config/default +# See the inline comments on how to expand/tweak this configuration file [tox] +# We need 4.4.0 for constrain_package_deps. +min_version = 4.4.0 envlist = - py2.7, - py3.5, - py3.6, - py3.7, - py3.8, - py3.9, - py3.10, - docs, - isort, - lint, - coverage-report - -[testenv] -usedevelop = True -extras = + lint test + dependencies -commands = - python -VV - pip list - mkdir -p {toxinidir}/reports/coverage {toxinidir}/reports/pytest - pytest --cov=lib --cov-report=xml --html={toxinidir}/reports/pytest/report-{envname}.html --self-contained-html lib/diazo/tests {posargs} -setenv = - COVERAGE_FILE=.coverage.{envname} +## +# Add extra configuration options in .meta.toml: +# [tox] +# envlist_lines = """ +# my_other_environment +# """ +# config_lines = """ +# my_extra_top_level_tox_configuration_lines +# """ +## -deps = - -cconstraints.txt - pdbpp - pytest - pytest-cov - pytest-remove-stale-bytecode - pytest-mock - pytest-html - -whitelist_externals = - mkdir - -[testenv:coverage-report] +[testenv] +skip_install = true +allowlist_externals = + echo + false +# Make sure typos like `tox -e formaat` are caught instead of silently doing nothing. +# See https://github.com/tox-dev/tox/issues/2858. +commands = + echo "Unrecognized environment name {envname}" + false + +## +# Add extra configuration options in .meta.toml: +# [tox] +# testenv_options = """ +# basepython = /usr/bin/python3.8 +# """ +## + +[testenv:init] +description = Prepare environment skip_install = true +commands = + echo "Initial setup complete" -depends = - py2.7, - py3.5, - py3.6, - py3.7, - py3.8, - py3.9, - py3.10, +[testenv:format] +description = automatically reformat code +skip_install = true deps = - -cconstraints.txt - coverage - -setenv = - COVERAGE_FILE=.coverage - + pre-commit commands = - coverage erase - coverage combine - coverage report - coverage html - coverage xml + pre-commit run -a pyupgrade + pre-commit run -a isort + pre-commit run -a black + pre-commit run -a zpretty -[testenv:isort-apply] +[testenv:lint] +description = run linters that will help improve the code style skip_install = true -deps = isort +deps = + pre-commit commands = - isort {toxinidir}/lib setup.py + pre-commit run -a -[testenv:isort] +[testenv:dependencies] +description = check if the package defines all its dependencies skip_install = true -deps = isort +deps = + build + z3c.dependencychecker==2.14.3 commands = - isort --show-config - isort --check-only --diff {toxinidir}/lib setup.py - -[lint] -skip_install = true - + python -m build --sdist + dependencychecker + +[testenv:dependencies-graph] +description = generate a graph out of the dependencies of the package +skip_install = false +allowlist_externals = + sh deps = - -cconstraints.txt - flake8 - # helper to generate HTML reports: - flake8-html - # Useful flake8 plugins that are Python and Plone specific: - flake8-blind-except - flake8-coding - flake8-commas - flake8-debugger - flake8-deprecated - flake8-isort - flake8-pep3101 - flake8-plone-hasattr - flake8-print - flake8-quotes - flake8-string-format - flake8-todo - flake8_strict - + pipdeptree==2.5.1 + graphviz # optional dependency of pipdeptree commands = - python -VV - pip list - mkdir -p {toxinidir}/_build/reports/flake8 - #- flake8 --format=html --htmldir={toxinidir}/_build/reports/flake8 --doctests src tests setup.py - #flake8 src tests setup.py --doctests - - flake8 --format=html --htmldir={toxinidir}/_build/reports/flake8 --doctests lib setup.py - flake8 lib setup.py --doctests - -whitelist_externals = - mkdir - -[testenv:docs] + sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' + +[testenv:test] +description = run the distribution tests +use_develop = true +skip_install = false +constrain_package_deps = true +set_env = + ROBOT_BROWSER=headlesschrome + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +# +# Set constrain_package_deps .meta.toml: +# [tox] +# constrain_package_deps = "false" +## +deps = + zope.testrunner + -c https://dist.plone.org/release/6.0-dev/constraints.txt + +## +# Specify additional deps in .meta.toml: +# [tox] +# test_deps_additional = "-esources/plonegovbr.portal_base[test]" +# +# Specify a custom constraints file in .meta.toml: +# [tox] +# constraints_file = "https://my-server.com/constraints.txt" +## commands = - python -VV - pip list - mkdir -p {toxinidir}/_build/ - sphinx-build -b html -d {toxinidir}/_build/docs/doctrees docs {toxinidir}/_build/docs/html - # The following line should be enabled if we do have testable code in the docs. - #sphinx-build -b doctest docs build/docs/doctrees + zope-testrunner --all --test-path={toxinidir}/src -s diazo {posargs} +extras = + test + +## +# Add extra configuration options in .meta.toml: +# [tox] +# test_extras = """ +# tests +# widgets +# """ +## + +[testenv:coverage] +description = get a test coverage report +use_develop = true +skip_install = false +constrain_package_deps = true +set_env = + ROBOT_BROWSER=headlesschrome + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +## deps = - -cconstraints.txt - Sphinx + coverage + zope.testrunner + -c https://dist.plone.org/release/6.0-dev/constraints.txt + +commands = + coverage run --branch --source diazo {envbindir}/zope-testrunner --quiet --all --test-path={toxinidir}/src -s diazo {posargs} + coverage report -m --format markdown + coverage xml +extras = + test -whitelist_externals = - mkdir -[testenv:release] +[testenv:release-check] +description = ensure that the distribution is ready to release skip_install = true - deps = - -cconstraints.txt - zest.releaser[recommended] - + twine + build + towncrier + -c https://dist.plone.org/release/6.0-dev/constraints.txt + +commands = + # fake version to not have to install the package + # we build the change log as news entries might break + # the README that is displayed on PyPI + towncrier build --version=100.0.0 --yes + python -m build --sdist + twine check dist/* + +[testenv:circular] +description = ensure there are no cyclic dependencies +use_develop = true +skip_install = false +set_env = + +## +# Specify extra test environment variables in .meta.toml: +# [tox] +# test_environment_variables = """ +# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ +# """ +## +allowlist_externals = + sh +deps = + pipdeptree + pipforester + -c https://dist.plone.org/release/6.0-dev/constraints.txt + commands = - python -VV - pip list - fullrelease --no-input -v + # Generate the full dependency tree + sh -c 'pipdeptree -j > forest.json' + # Generate a DOT graph with the circular dependencies, if any + pipforester -i forest.json -o forest.dot --cycles + # Report if there are any circular dependencies, i.e. error if there are any + pipforester -i forest.json --check-cycles -o /dev/null + + +## +# Add extra configuration options in .meta.toml: +# [tox] +# extra_lines = """ +# _your own configuration lines_ +# """ +## diff --git a/varnish.cfg b/varnish.cfg deleted file mode 100644 index 8a9ae98f..00000000 --- a/varnish.cfg +++ /dev/null @@ -1,25 +0,0 @@ -[buildout] -extends = nginx.cfg -parts += - varnish-build - varnish - varnish.vcl - -[example-theme] -includemode = esi - -[varnish-build] -recipe= zc.recipe.cmmi -url = ${varnish:download-url} - -[varnish] -recipe = plone.recipe.varnish -daemon = ${buildout:parts-directory}/varnish-build/sbin/varnishd -bind = 127.0.0.1:8001 -config = ${buildout:directory}/etc/varnish.vcl -cache-size = 10M - -[varnish.vcl] -recipe = collective.recipe.template -input = ${buildout:directory}/templates/varnish.vcl.in -output = ${buildout:directory}/etc/varnish.vcl \ No newline at end of file diff --git a/versions.cfg b/versions.cfg deleted file mode 100644 index 0c6d2e4f..00000000 --- a/versions.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[buildout] -versions = versions - -[versions] -WebOb = 1.4 -cssselect = 0.9.1 -lxml = 3.3.5 -repoze.xmliter = 0.6 -FormEncode = 1.3.0a1 -py = 1.11.0