sites/flux.vision/plugins/tileweight.py
randogoth 8505b7e9e0 Three sites, one directory each
flux.vision, tobias.raayoni-last.com and randogoth.com. They were one site until
October 2026, serving four audiences from a single dated list, which is the only
format that can hold unrelated things at once.

flux.vision is recovered from the Wayback Machine, where it had sat since being
deleted in 2021: 90 articles, closed and maintained rather than updated.
tobias.raayoni-last.com is the professional record, 97 articles back to 1999.
randogoth.com is the technical work, 41 articles across six areas, served as an
ANSI bulletin board.

History starts here deliberately. The development history, the 266-row inventory
that records why each article went where it did, the Wayback pipelines, the
pruned articles, the source archives and the full-size images are kept beside
the repo rather than in it, so a clone is the web presence and not the argument
that produced it. REFACTOR.md is gitignored for the same reason. See README.md
for where that material lives, and keep it: the sort is not reproducible from
these three directories alone.

Each site documents itself in its own README, including the traps that cost time
and look like nothing when you get them wrong.
2026-10-05 20:54:45 +03:00

40 lines
1.3 KiB
Python

"""Give each work a tile size derived from what it actually contains.
A uniform grid gives a ten-hour festival set and a two-line workshop note the
same visual weight, which is both untrue and the most dated thing about the
original layout. Weight is taken from evidence already in the entry: how much
imagery survived, whether there is video, and how much was written about it.
"""
import re
from pelican import signals
IMG = re.compile(r'<img\b', re.I)
VID = re.compile(r'<(?:iframe|embed|video)\b', re.I)
def _weigh(content):
if content.__class__.__name__ != 'Article':
return
body = getattr(content, '_content', '') or ''
imgs = len(IMG.findall(body))
vids = len(VID.findall(body))
words = len(re.sub(r'<[^>]+>', ' ', body).split())
score = imgs + vids * 4 + words / 90.0
# a work with no surviving image cannot carry a large tile: it would be a
# big rectangle of static, which reads as a fault rather than a choice
if content.metadata.get('thumb_missing') or not content.metadata.get('thumb'):
size = 'sm'
elif score >= 9:
size = 'lg'
elif score >= 4.5:
size = 'md'
else:
size = 'sm'
content.metadata['tilesize'] = size
content.metadata['tilescore'] = round(score, 1)
def register():
signals.content_object_init.connect(_weigh)