Skip to content

Optional url-highlight 4.x for links in text; announcement date checks

Choose a tag to compare

@dlangille dlangille released this 02 Nov 12:20
· 136 commits to main since this release

Links in text: url-highlight 4.x, optional

htmlify(), which turns URLs and email addresses in commit messages and port descriptions into links, can now use url-highlight 4.x from the new www/php-url-highlight package. It is off by default. To turn it on, set this in constants.local.php:

define('HTMLIFY_USE_URL_HIGHLIGHT_PORT', true);

It takes precedence over HTMLIFY_USE_URL_HIGHLIGHT and HTMLIFY_USE_LIB_AUTOLINK. (00ebd04)

Compared with the existing code:

  • Email addresses are linked, e.g. Reported by: … <user@example.org>.
  • A URL which contains an email address is one link. The old regex code nested broken mailto: links inside the href.
  • & in a link's href is escaped as &amp;.
  • Links keep REL="NOFOLLOW" (not on email links) and the URL2LINK_CUTOFF_LEVEL shortening of the visible text.
  • Only URLs with a scheme, and email addresses, are linked. 4.x also matches bare names by top-level domain, which turned file names such as setup.py, svn_load_dirs.pl and patch-Makefile.in into links. (996cac8)

Callers already escape text with _forDisplay(), so it is passed to 4.x as HTML-encoded and not escaped again.

htmlify() takes an optional third argument which forces the 4.x path on or off.

Test pages

  • /htmlify-test.php always uses the existing code.
  • /htmlify-test-port.php is new, and always uses 4.x.

Each links to the other.

Announcements

The announcement editor checks the start and end dates before saving. (c9af79a)

  • The date fields are datetime-local inputs.
  • An invalid date, or an end date before the start date, redisplays the announcement with an error, instead of the raw SQL error from PostgreSQL. A bare time such as 20:51 used to cause that error.

Upgrading

  • New dependency: php85-url-highlight (www/php-url-highlight), installed in /usr/local/share/pear/VStelmakh/UrlHighlight/. It is needed only if HTMLIFY_USE_URL_HIGHLIGHT_PORT is on. With the switch on and the package missing, pages which link text fail with a fatal error.
  • Configuration: constants.local.php.sample documents HTMLIFY_USE_URL_HIGHLIGHT_PORT and URL_HIGHLIGHT_PORT_DIR. The second is needed only if the package is installed somewhere else.
  • Database: no changes.
  • nginx: no changes.
  • Translations: no new strings.
  • Files added:
    • www/htmlify-test-port.php
  • Files deleted or renamed: none.

The 3.0.1 copy in vendor/ stays for now, because the HTMLIFY_USE_URL_HIGHLIGHT path still uses it.

Full Changelog: 2.16.21...2.16.22