Browse Source

Revert "Build HTML Tidy, validate homepage HTML in tests"

This reverts commit cb7be83877.

HTML Tidy seems to have various gaps in its validation that we've found
already, including one that's pretty much a deal-breaker for Tildes's
HTML: it doesn't think that <menu> is a valid parent for <li>.

We're looking at alternative validators still.
merge-requests/126/merge
Deimos 4 years ago
parent
commit
6f272fcd54
  1. 25
      salt/salt/tidy/init.sls
  2. 1
      salt/salt/top.sls
  3. 1
      tildes/requirements-dev.in
  4. 1
      tildes/requirements-dev.txt
  5. 20
      tildes/tests/webtests/test_valid_html5.py
  6. 2
      tildes/tildes/templates/base.jinja2

25
salt/salt/tidy/init.sls

@ -1,25 +0,0 @@
{% set tidy_version = '5.7.28' %}
unpack-tidy:
archive.extracted:
- name: /tmp/tidy-{{ tidy_version }}
- source:
- https://github.com/htacg/tidy-html5/archive/{{ tidy_version }}.tar.gz
- source_hash: sha256=5caa2c769204f506e24ea4986a45abe23f71d14f0fe968314f20065f342ffdba
- unless: /usr/local/bin/tidy --version | grep 'version {{ tidy_version }}'
- options: --strip-components=1
- enforce_toplevel: False
install-tidy:
pkg.installed:
- pkgs:
- build-essential
cmd.run:
- cwd: /tmp/tidy-{{ tidy_version }}/build/cmake
- names:
- cmake ../.. -DCMAKE_BUILD_TYPE=Release
- make
- make install
- ldconfig
- onchanges:
- archive: unpack-tidy

1
salt/salt/top.sls

@ -30,7 +30,6 @@ base:
- development
- prometheus
- nodejs
- tidy
'prod':
- nginx.shortener-config
- nginx.static-sites-config

1
tildes/requirements-dev.in

@ -6,6 +6,5 @@ prospector
pyramid-debugtoolbar
pytest
pytest-mock
pytidylib
testing.redis
webtest

1
tildes/requirements-dev.txt

@ -81,7 +81,6 @@ pytest-mock==3.2.0
pytest==6.0.0
python-dateutil==2.8.1
python-editor==1.0.4 # via alembic
pytidylib==0.3.2
pyyaml==5.3.1
qrcode==6.1
redis==3.5.3

20
tildes/tests/webtests/test_valid_html5.py

@ -1,20 +0,0 @@
# Copyright (c) 2020 Tildes contributors <code@tildes.net>
# SPDX-License-Identifier: AGPL-3.0-or-later
from tidylib import tidy_document
def test_homepage_tidy_loggedout(webtest_loggedout):
"""Validate HTML5 using Tidy on the Tildes homepage, logged out."""
homepage = webtest_loggedout.get("/")
_document, errors = tidy_document(homepage.body)
assert not errors
def test_homepage_tidy_loggedin(webtest):
"""Validate HTML5 using Tidy on the Tildes homepage, logged in."""
homepage = webtest.get("/")
_document, errors = tidy_document(homepage.body)
assert not errors

2
tildes/tildes/templates/base.jinja2

@ -130,7 +130,7 @@
<li class="site-footer-link"><a href="https://blog.tildes.net">Blog</a></li>
<li class="site-footer-link"><a href="https://docs.tildes.net/contact">Contact</a></li>
<li class="site-footer-link"><a href="https://gitlab.com/tildes/tildes">Source code</a></li>
<li class="site-footer-link"><a href="https://gitlab.com/tildes/tildes/issues?label_name%5B%5D=Feature+Request&amp;label_name%5B%5D=Stage%3A%3AAccepted&amp;scope=all&amp;sort=priority&amp;state=opened">Planned features</a> / <a href="https://gitlab.com/tildes/tildes/issues">All issues</a></li>
<li class="site-footer-link"><a href="https://gitlab.com/tildes/tildes/issues?label_name[]=Feature+Request&label_name[]=Stage%3A%3AAccepted&scope=all&sort=priority&state=opened">Planned features</a> / <a href="https://gitlab.com/tildes/tildes/issues">All issues</a></li>
<li class="site-footer-link"><a href="https://docs.tildes.net/policies/privacy-policy">Privacy policy</a></li>
<li class="site-footer-link"><a href="https://docs.tildes.net/policies/terms-of-use">Terms of use</a></li>
</ul>

Loading…
Cancel
Save