Commit 8f7833c2 authored by Marius DAVID's avatar Marius DAVID
Browse files

Add a way to build the site either for 2024 or 2025

parent 8ef64340
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ node_modules/
/web/atlas.json
/web/atlas2024.json
/web/atlas2025.json
/web/index.html

# Cache folders
*.pyc
+3 −1
Original line number Diff line number Diff line
@@ -90,7 +90,9 @@ Other than contributing to the Atlas data, code contributions are also accepted.

This website is built using classic HTML 5 (no JS frameworks such as Vue, React, etc are used). Bootstrap 5 is used as a CSS framework.

You first need to merge the atlas data. That can be done, by being in the root folder, by running ``python3 tools/merge_data.py ./entries ./web/atlas.json``. If you can’t run python and don’t need to test entry edition, you may instead download the `atlas.json` file from [https://atlas.mariusdavid.fr/atlas.json](https://atlas.mariusdavid.fr/atlas.json) and place it at `web/atlas.json`.
You first need to merge the atlas data. That can be done, by being in the root folder, by running `sh build_atlas.sh`. This will generate the atlas for all the editions.

You will also need to build the `index.html` from `index_template.html`. This can be done (depending on whether you want to edit the 2024 or 2025 version) with `python3 tools/pre_process.py 2024 ./web` or `python3 tools/pre_process.py 2025 ./web`

Opening the HTML file on your browser is adequate enough to edit. If it doesn't work, you can try running a local HTTP server.

+1 −1
Original line number Diff line number Diff line
# 2024 Fediverse Canvas Atlas
# Fediverse Canvas Atlas

The 2024 Fediverse Canvas Atlas is an interactive map aiming to chart the artworks created during that event, hosted by grant in 2024. It is made with information to each artwork of the canvas provided by the community.

+26 −19
Original line number Diff line number Diff line
@@ -7,26 +7,33 @@
		result = utils.lib.eachDefaultSystem (system:
			let
				pkgs = nixpkgs.legacyPackages.${system};
			in
			{
				packages = rec {
					website = pkgs.stdenvNoCC.mkDerivation {
						pname = "fediverse-canvas-atlas-website";

				site_by_edition = edition: pkgs.stdenvNoCC.mkDerivation {
					pname = "fediverse-canvas-atlas-website-${edition}";
					version = "git-" + (self.shortRev or "dirty");

						dontUnpack = true;
					nativeBuildInputs = [ pkgs.python3 ];

					src = ./.;

					installPhase = ''
						mkdir -p $out
							cp -r ${./.}/web/* $out/
							${pkgs.python3}/bin/python ${./.}/tools/merge_data.py ${./.}/entries $out/atlas.json

						bash build_atlas.sh
						python3 tools/pre_process.py ${edition} ./web
						mv web $out

						mkdir $out/nix-support
							echo ${self.shortRev} > $out/revision
						echo ${self.shortRev or "dirty"} > $out/revision
            echo "doc manual $out" >> $out/nix-support/hydra-build-products
					'';
				};
					default = website;
			in
			{
				packages = rec {
					website2024 = site_by_edition "2024";
					website2025 = site_by_edition "2025";
					default = website2024;
				};
			}
  	);

tools/pre_process.py

0 → 100644
+23 −0
Original line number Diff line number Diff line
import sys
import os

if len(sys.argv) < 3:
	print("Usage: pre_process.py [edition, 2024 or 2025] [web folder path]")
	exit(-1)

def process_edition(year):
	with open(os.path.join(sys.argv[2], "index_template.html")) as f:
		index_template = f.read()

	index = index_template.replace("{YEAR}", year)

	with open(os.path.join(sys.argv[2], "index.html"), "w") as f:
		f.write(index)

if sys.argv[1] == "2024":
	process_edition("2024")
elif sys.argv[1] == "2025":
	process_edition("2025")
else:
	print("Unrecognizeable edition: " + sys.argv[1])
	exit(-1)
Loading