703 Commits

Author SHA1 Message Date
5801952388 fix: clean xml comparison messages (#5626)
All checks were successful
continuous-integration/drone/push Build is passing
Some better messages, and more whitelisting.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5626
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2026-01-15 16:06:04 +00:00
ad79262abf feat/config (#5590)
All checks were successful
continuous-integration/drone/push Build is passing
- use nargs instead of splitting strings. Nicer logic, more standard
- Show default values of args in help message
- each site can now have a `config.toml` with deps and required files for deployment.
- cleaner argument handling and custom value generation
- use dataclass to hold args, or cleaner typing
- pass config types to run commands instead of individual args
- clean up the whole build.py file

Overall, this is a nice internal refactor that also offers the feature of per site config.

It does have a breaking change of how multiple args are handled, but the arg help page should explain it just fine.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5590
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2026-01-15 15:49:40 +00:00
7f1263b7d3 feat/versions (#5512)
All checks were successful
continuous-integration/drone/push Build is passing
# Summary
Add a stage to the build process that sparse clones deps and puts them in the required places.

This should make it much easier to keep track of vendored deps, and similar.

Solves #5426 and helps makes progress towards #4825

This pr moves almost all thirdparty deps from being vendored to being added by the build process.

This pr should be deployed on test and some cgi scripts tested before merge, there is some possibility of issues. But it should be minimal.

One thing: we manually mention the versions of things in https://fsfe.org/about/js-licences

I think we could make this automatic perhaps?

This pr atm does make us dependent on our sources being online for full builds. This is common, but perhaps not acceptable for us?

We could instead do one of the following:
- cache downloaded repos outside of the website dir, so they survive a full rebuild
- make this script an updater script, so all deps are still vendored, but we have a nice script to update them. Not a big fan of this.
- Use nix to fetch all the deps. Now reliant on nixos org instead of github, significant barrier for new contributors.
- have a mirror of all the repos we use for builds on this git server. I kinda like this option, it leaves the most sensible and "normal" build process. Does not seem hard: https://docs.gitea.com/usage/repo-mirror

# State of deps
## Moved
- PHPmailer
- Bootstrap ( we were using different versions for the less and js. this is almost certainly A mistake, but I have kept it the same in this issue to minimize disruption, and will try and fix it later). Also we had some bootstrap js we do not use anywhere, we just have a small bit of custom bootstrap js, not the whole package.
- Lunr (could not get a minimized version from upstream repo, so we have lost minimization. Not very important as it is only used on search page)
- Jquery ( this can be dropped once we upgrade bootstrap, only used as a bootstrap dep)

## Could not move
- moderniser (I hope to drop this down the line, but we use a custom build of an old version that I could find no way to recreate/pull from their git repo. So I could not fetch it as a dep)
- the various xml files. These are incredibly static compared to everything else, so I did not bother.
- Fonts: they are often only available as release artifacts from some site, and so downloading them would massively complicate the dep script. I do not want to maintain a package manager, and so if we think that necessary I would advocate for nix. Also, some fonts are only available from google fonts which does not seem to expose versions. This would again be a problem to be solved with nix.

# Checklist
- [x] site looks correct locally
- [x] search works locally
- [x] no missing scripts using inspector locally
- [x] Deployed on test

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5512
Reviewed-by: tobiasd <tobiasd@fsfe.org>
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-24 13:00:42 +00:00
e107e11a09 feat/file-extensions (#5528)
All checks were successful
continuous-integration/drone/push Build is passing
Renames some files to ignored file extensions, and ignores a few filetypes/names that should be ignored.

Also adds file extensions to pretty much every file in the repo, makes sure they get caught by pre-commit and such properly. And makes it easier to check what types we have around.

Removes some old files that should have been deleted, but were instead renamed to `.disabled` or similar.

adds a way to manually specify files to copy from each site, regardless of if they would have been ignored by default filters.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5528
Reviewed-by: tobiasd <tobiasd@fsfe.org>
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-24 07:28:53 +00:00
9b81a699ad refactor: localmenus (#5564)
All checks were successful
continuous-integration/drone/push Build is passing
add function to get localised files
add tests for localised file func

Code is quite a lot cleaner, and easier to understand, should be less errors in future.

Fixes localization of links in menus, which is apparently broken atm

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5564
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-16 18:30:32 +00:00
0d0576bcea refactor: element pruning (#5567)
All checks were successful
continuous-integration/drone/push Build is passing
Very small tweak, in tested code.

Should be a little more performant and handle edge cases better.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5567
2025-12-12 17:55:50 +00:00
8159a0bb0e feat/more-ruff (#5559)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5559
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-11 06:05:35 +00:00
01643b297a fix: copy files with shutil rather than reading and writing contents (#5560)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5560
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-11 05:58:24 +00:00
7e92ec8c95 fix: localmenus (#5558)
All checks were successful
continuous-integration/drone/push Build is passing
fix for #5557

I have checked that the news, thankgnus, events and activities localmenus are working correctly.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5558
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-10 05:52:29 +00:00
8c13d218f0 feat: minify files on copy, rather than on creation (#5527)
All checks were successful
continuous-integration/drone/push Build is passing
minify more filetypes, like svg and so forth

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5527
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-04 06:55:03 +00:00
034ed3ecd5 feat: use compiled regex (#5537)
All checks were successful
continuous-integration/drone/push Build is passing
Should be a little bit faster

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5537
Reviewed-by: tobiasd <tobiasd@fsfe.org>
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-04 05:52:02 +00:00
5fe13284f2 feat: better error handling in process_files (#5526)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5526
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-02 07:42:48 +00:00
d558468c6b chore: simplify the xmllists generation (#5535)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5535
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-12-02 07:28:49 +00:00
0c8a3b7aca fix: do not write a newline to an empty xmllist (#5514)
All checks were successful
continuous-integration/drone/push Build is passing
prevents issues with processing files when there are empty xmllists

issue only shows when building with very few languages

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5514
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-11-24 08:40:10 +00:00
4cd97fa78c ci/whitelisting (#5500)
All checks were successful
continuous-integration/drone/push Build is passing
Whitelist some common attributes/elements that should be localized.

This was done by making the whitelist a list of xpaths.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5500
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-11-18 08:22:42 +00:00
b207ea38f7 fix/faster-tests (#5501)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5501
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-11-17 05:48:37 +00:00
fdbc88a850 fix/caching (#5494)
All checks were successful
continuous-integration/drone/push Build is passing
fix some stuff not being cached, and add test to catch caching regressions.

Test takes quite a while to run, not sure it is a good idea?

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5494
2025-11-13 18:13:59 +00:00
b5256f8812 feat/strict-pyright (#5451)
All checks were successful
continuous-integration/drone/push Build is passing
- enable pyright strict mode
- fix the issues raised

This should make the build process cleaner and more resilient.
It should make it much easier to catch design flaws.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5451
Reviewed-by: tobiasd <tobiasd@fsfe.org>
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-11-03 08:53:49 +00:00
55038b216a feat: typehint dicts better (#5450)
All checks were successful
continuous-integration/drone/push Build is passing
use defaultdict for dicts

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5450
2025-10-31 13:00:37 +00:00
0799d62411 feat: units tests for checks lib (#5443)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5443
2025-10-30 17:36:24 +00:00
ab3da54d6a feat: ruff python docsting lints (#5444)
All checks were successful
continuous-integration/drone/push Build is passing
And add docstrings so all files are passing.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5444
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-10-30 09:39:39 +00:00
2f7bd236fc feat: reuse compliance for python files (#5440)
All checks were successful
continuous-integration/drone/push Build is passing
Adds reuse compliance checks for python files only, using `reuse lint-file`.

It is managed as a pre-commit hook, and hence ran in ci.

Over time we may add more files to be covered, but I suspect we would use something like `reuse.toml` for setting the licensing for `xml/xhtml/xsl` files, as there are just too many for adding the same text snippet to each to be justifiable.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5440
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-10-28 19:43:39 +00:00
81d0b63a6e feat/overview (#5435)
All checks were successful
continuous-integration/drone/push Build is passing
- fixes issues with xml structure pre commit hook
- Moves comprea-files to lib
- adds a n overview page on status.fsfe.org to see what files have different structures

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5435
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-10-28 05:27:09 +00:00
cba4a25036 feat: add source flag to use different folder as source for building sites (#5334)
All checks were successful
continuous-integration/drone/push Build is passing
I do not expect the flag to be used much, but it enforces better code design, and prevents implicitly relying on cwd.

Just a general code style improvement really.

Co-authored-by: Darragh Elliott <me@delliott.net>
Co-authored-by: tobiasd <tobiasd@fsfe.org>
Reviewed-on: #5334
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-10-13 12:56:30 +00:00
5551375ac8 refactor: transform processor xsls only once (#5397)
All checks were successful
continuous-integration/drone/push Build is passing
# About
## Summary
Before we iterated over xhtml files by directory, and rss/ics ones by processor (xsl stylesheet).

This worked, but meant we had to pass the processor filepath to the processing functions, which meant we were reprocessing the xsl several times, probably hundred for some xsl's, like the default one for a site.

We now instead iterate by processor, pre parsing it before passing it to the processing code.

This gets us a significant speed increase (~30%), and makes the code a little cleaner.

# Benchmarks
## Before
```
Benchmark 1: uv run build --full
  Time (mean ± σ):     269.798 s ± 12.501 s    [User: 1566.724 s, System: 75.804 s]
  Range (min … max):   262.183 s … 284.226 s    3 runs
```
## After
```
Benchmark 1: uv run build --full
  Time (mean ± σ):     206.330 s ±  5.088 s    [User: 498.556 s, System: 47.233 s]
  Range (min … max):   202.760 s … 212.155 s    3 runs
```

Co-authored-by: Darragh Elliott <me@delliott.net>
Co-authored-by: tobiasd <tobiasd@fsfe.org>
Reviewed-on: #5397
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-10-13 11:24:25 +00:00
1315a7d481 build/xslt (#5299)
All checks were successful
continuous-integration/drone/push Build is passing
This properly separtes out the python build process (theoretically portable and useable for different sites) and the xslt (custom to the fsfe sites, not really portable as a whole)

It also moves some thirdparty tooling around to make it clearer its thirdparty and unify xslt sources.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5299
Reviewed-by: tobiasd <tobiasd@fsfe.org>
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-09-15 06:23:57 +00:00
47ee5f7ca4 build: move search logic to subdir (#5298)
All checks were successful
continuous-integration/drone/push Build is passing
if has some stuff pretty specific to fsfe.org in there, and hence should not be in global build

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5298
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-09-08 05:49:17 +00:00
235d86bed9 build/email-subjects (#5281)
All checks were successful
continuous-integration/drone/push Build is passing
Allow specifying a subject in our email element.

Eg the xhtml content
```xml
<email mailto="yes" subject="Ada and Zangemann">contact@fsfe.org</email>
```

Will now generate
```xml
<a href="mailto:contact@fsfe.org?subject=Ada and Zangemann">contact@fsfe.org</a>
```
Which when clicked will open an email client, and correctly populate the subject.

I also added the subject to all ada zangemann pages, and have documented it on the web features page.

Resolves #2742

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5281
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-09-08 05:46:53 +00:00
b523e45db4 build: use some list comps for sites stuff (#5282)
All checks were successful
continuous-integration/drone/push Build is passing
only serve websites specified on cli

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5282
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-09-06 06:04:17 +00:00
ce30bed1b6 build: move tags to a subdir instead of a build step (#5273)
All checks were successful
continuous-integration/drone/push Build is passing
it is highly specific to fsfe.org, and so should probably be a subdir instead of a build step

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5273
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-09-02 08:52:38 +00:00
b6407993f2 build: thirdparty separation (#5271)
All checks were successful
continuous-integration/drone/push Build is passing
- Move thirdparty css and js into `thirdparty` folders, to make delination clearer
- Remove some unused js files
- remove bootstrap tests
- some css file naming cleanup

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5271
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-09-02 08:44:15 +00:00
77d7b83078 fix: comment (#5270)
All checks were successful
continuous-integration/drone/push Build is passing
Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5270
2025-08-30 17:24:12 +00:00
c8f54f19cb build: typecheck the python code (#5269)
All checks were successful
continuous-integration/drone/push Build is passing
add pyright to project,
add it to pre-commit
fix all errors it detects

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5269
2025-08-30 17:11:44 +00:00
f03b3c2c4c build: tests and more checks (#5268)
All checks were successful
continuous-integration/drone/push Build is passing
- add pytest
- add tests for all exposed lib functions
- Add a whole bunch more ruff checks and apply them

Benchmarking:

Before:
```
❯ hyperfine --runs 3 "uv run build --full"
Benchmark 1: uv run build --full
  Time (mean ± σ):     287.463 s ± 15.161 s    [User: 1573.732 s, System: 72.548 s]
  Range (min … max):   272.953 s … 303.201 s    3 runs
```

After
```
❯ hyperfine --runs 3 "uv run build --full"
Benchmark 1: uv run build --full
  Time (mean ± σ):     280.184 s ±  9.605 s    [User: 1557.788 s, System: 72.693 s]
  Range (min … max):   269.878 s … 288.886 s    3 runs
```

So we gain a few seconds, but that is all.

The main benefit is that we have better testing and more linting.

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5268
2025-08-29 16:46:13 +00:00
1a05dee2f6 build: use lefthook for pre-commit (#5248)
All checks were successful
continuous-integration/drone/push Build is passing
update docs
update nix-shell to auto install
rework custom pre-commit hooks to integrate better
add dockerfile for lefthook and integrate into drone
add some more hooks for formatting and linting some files

Co-authored-by: Darragh Elliott <me@delliott.net>
Reviewed-on: #5248
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-08-27 15:22:06 +00:00
Darragh Elliott
5a6a3f27b0 build: set xsl output types more consistently
All checks were successful
continuous-integration/drone/pr Build is passing
disbale indenting for smaller output
2025-08-26 16:30:44 +01:00
Darragh Elliott
2b70db152a fix: better loggin on subprcess failures
All checks were successful
continuous-integration/drone/pr Build is passing
2025-08-26 10:15:18 +00:00
Darragh Elliott
7081d2715d build: run xdg-opne on served sites if possible
All checks were successful
continuous-integration/drone/pr Build is passing
2025-08-25 17:49:51 +00:00
Darragh Elliott
47465aabb2 build: do not alter the mtime of all files
cleaner logic for generating files suitable for for translating
move to python 313 for pathlib fullmatch support
bump deps and unpin patch versions
2025-08-25 17:49:30 +00:00
Darragh Elliott
cec7ce8210 build: prevent unnecessary subdir work
All checks were successful
continuous-integration/drone/pr Build is passing
improve caching
sort languages for interrun stability
2025-08-21 19:38:06 +00:00
Darragh Elliott
6be2a62421 build: move python source into subfolder to more properly deliniate
All checks were successful
continuous-integration/drone/pr Build is passing
rename from just build, to be more informative
2025-08-20 16:12:52 +00:00
9cffb8af6a remove check from build process as it is part of the CI
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-31 17:02:04 +02:00
f08d5ef925 feat/lxml (#5181)
All checks were successful
continuous-integration/drone/push Build is passing
#5146 attempt 2, texts and topbanner issue resolved.

After the issues I have deployed this to https://test.fsfe.org, so we can see if there are further issues there.

It seems not though.

Co-authored-by: Darragh Elliott <me@delliott.xyz>
Reviewed-on: #5181
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-07-29 08:17:53 +00:00
63e70f1eb1 Revert "refactor: use lxml instead of string templating in process_file. (#5146)"
All checks were successful
continuous-integration/drone/pr Build is passing
This reverts commit c4b7f0f33c.
2025-07-28 18:00:47 +02:00
c4b7f0f33c refactor: use lxml instead of string templating in process_file. (#5146)
All checks were successful
continuous-integration/drone/push Build is passing
Code looks much cleaner and easier to read, as well as being more performant.

Also prevents the construction of invalid xml.

Some benchmarks:
```
❯ hyperfine --runs 3 "uv run build --full "; git checkout master; hyperfine --runs 3 "uv run build --full "
Benchmark 1: uv run build --full
  Time (mean ± σ):     287.612 s ±  4.557 s    [User: 1613.681 s, System: 151.556 s]
  Range (min … max):   283.550 s … 292.539 s    3 runs
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
Benchmark 1: uv run build --full
Time (mean ± σ):     357.248 s ±  5.578 s    [User: 2052.506 s, System: 163.057 s]
  Range (min … max):   350.810 s … 360.609 s    3 runs
```
So this reduces build times by about a minute, getting us down to just under 5 minutes for a full build on my machine.

Co-authored-by: Darragh Elliott <me@delliott.xyz>
Reviewed-on: #5146
Co-authored-by: delliott <delliott@fsfe.org>
Co-committed-by: delliott <delliott@fsfe.org>
2025-07-28 13:06:30 +00:00
Darragh Elliott
998a6fd989 refactor: enable more ruff warnings, and then fix raised issues
All checks were successful
continuous-integration/drone/pr Build is passing
2025-07-27 16:26:39 +00:00
46e4827bcb Update build/xslt/fsfe_body.xsl
All checks were successful
continuous-integration/drone/pr Build is passing
Hiding top banner
2025-07-25 10:53:27 +00:00
Darragh Elliott
869d384079 fix: use same for loop for both subdir stuff
All checks were successful
continuous-integration/drone/pr Build is passing
2025-06-28 09:46:52 +01:00
Darragh Elliott
c79f5ef415 feat: use uv
All checks were successful
continuous-integration/drone/pr Build is passing
its faster, and has some nicer features
2025-06-25 18:58:17 +01:00
Darragh Elliott
ee778119f0 feat: do not prepare unnecessary subdirectories
All checks were successful
continuous-integration/drone/pr Build is passing
2025-06-15 22:36:04 +01:00