From bd242e59cd0bcf29af7f0ae46ea1287c65963f0c Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sun, 12 May 2024 15:53:06 +0100 Subject: [PATCH] feat: got a pipeline to convert the Minutes as well --- .gitignore | 10 +- .gitlab-ci.yml | 35 ++- Minutes/_Templates/Logo_2024.svg | 230 ++++++++++++++++++++ Minutes/_Templates/_template_committee.md | 32 +++ Minutes/_Templates/committee.html | 39 ++++ Minutes/_Templates/main.css | 120 ++++++++++ README.md | 14 +- _scripts/format_minutes.sh | 52 +++++ _scripts/md_toml/_Minutes-Committee.md.toml | 46 ++++ _scripts/md_toml/_Minutes-Council.md.toml | 46 ++++ flake.nix | 17 +- 11 files changed, 622 insertions(+), 19 deletions(-) create mode 100644 Minutes/_Templates/Logo_2024.svg create mode 100644 Minutes/_Templates/_template_committee.md create mode 100644 Minutes/_Templates/committee.html create mode 100644 Minutes/_Templates/main.css create mode 100755 _scripts/format_minutes.sh create mode 100644 _scripts/md_toml/_Minutes-Committee.md.toml create mode 100644 _scripts/md_toml/_Minutes-Council.md.toml diff --git a/.gitignore b/.gitignore index 391d59e..75eed7f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,6 @@ test.* # Output of compiling /out /build -/*/*_html -/*/*_pdf /target /cmake-build-debug # for QT, both as single directory and as subfolders @@ -34,4 +32,10 @@ test.* .DS_Store # VSCode settings -.vscode/ \ No newline at end of file +.vscode/ + + +# the md to pdf process +/**/*_html +/**/*_pdf +/**/errors.log \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f4f37c..7486421 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,10 +18,10 @@ handovers: stage: build # when it runs -# rules: -# - if: '$CI_PROJECT_NAMESPACE == "compsoc1/compsoc" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' -# changes: -# - Committee/_Handovers/**/* + # rules: + # - if: '$CI_PROJECT_NAMESPACE == "compsoc1/compsoc" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + # changes: + # - Committee/_Handovers/**/* # what it runs script: @@ -34,3 +34,30 @@ handovers: name: "Handovers" paths: - Committee/_Handovers_pdf/ + + +minutes: + tags: + - nix + before_script: + - *scripts_base + - *scripts_cache + stage: build + + # when it runs + # rules: + # - if: '$CI_PROJECT_NAMESPACE == "compsoc1/compsoc" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + # changes: + # - Minutes/**/* + + # what it runs + script: + # cache any dependencies + - attic watch-store skynet-cache & + - nix --extra-experimental-features 'nix-command flakes' run .#minutes + + # what it does afterwards + artifacts: + name: "Minutes" + paths: + - Minutes_pdf/ diff --git a/Minutes/_Templates/Logo_2024.svg b/Minutes/_Templates/Logo_2024.svg new file mode 100644 index 0000000..0cf5682 --- /dev/null +++ b/Minutes/_Templates/Logo_2024.svg @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + COMP SOC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Minutes/_Templates/_template_committee.md b/Minutes/_Templates/_template_committee.md new file mode 100644 index 0000000..9e0a594 --- /dev/null +++ b/Minutes/_Templates/_template_committee.md @@ -0,0 +1,32 @@ +## Attendance +### Present +* Person 1 +* Person 2 + +### Absent +* Person 3 + +## Minutes +### Events + +#### Last Event + + +#### Next Event + + +#### Next Next Event + + +### Next Item + + +### Another Item + + +### AOB +#### AOB - 1 + +#### AOB - 2 + +#### AOB - 3 \ No newline at end of file diff --git a/Minutes/_Templates/committee.html b/Minutes/_Templates/committee.html new file mode 100644 index 0000000..ea837a2 --- /dev/null +++ b/Minutes/_Templates/committee.html @@ -0,0 +1,39 @@ + + + + + + + {title} Committee Minutes + + + + + + + + + + +
+ +

University of Limerick Computer Society

+

{title} Committee Minutes

+ +{body} +
+ + + + + \ No newline at end of file diff --git a/Minutes/_Templates/main.css b/Minutes/_Templates/main.css new file mode 100644 index 0000000..e039c8e --- /dev/null +++ b/Minutes/_Templates/main.css @@ -0,0 +1,120 @@ + +/* Basic stuff */ +body { + max-width: 100ch; + margin: 0 auto; + padding: 8px; + line-height: 1.2; +} +/* To make sure the header text is always bigger than a normal h1*/ +header h1 { + font-size: 300%; +} + + +/* get these to play nicely with teh max width */ +header, main, footer, img{ + max-width: 100ch; +} + +a:link{ + color:#5bf +} +a:visited{ + color:#5bf +} + +table { + border-collapse: collapse; +} + +td, th { + border: 1px solid #999; + padding: 0.5rem; + text-align: left; +} + +li p { + margin-block-start: 0; + margin-block-end: 0; +} + +p code { + background-color: rgba(173, 173, 173, 0.26); + border-radius: 0.3em; + padding: 4px 5px 6px; +} + +pre { + max-width: 95vw; + display: block; + overflow: auto; +} + +/* navbar */ +.links ul, .breadcrumb ul { + list-style-type: none; + display: flex; + padding-left: 0; +} + +/* sticky footer */ +main { + min-height: calc(95vh - 150px); +} +footer { + min-height: 50px; +} + +/* spoilers + using https://starbeamrainbowlabs.com/blog/article.php?article=posts%2F415-pure-css-spoiler.html + as a base then using it for on hover instead of target. + Seems to work well enough for mobile as well +*/ + +.md-spoiler { + background: #333333; + border-radius: 0.2em; + color: transparent; +} +/* hover is for desktop, active for mobile*/ +.md-spoiler:hover, .md-spoiler:active { + background: transparent; + color: inherit; +} + +/* every page gets a scrollbar to stop it shifting around */ +html { + overflow-y: scroll; +} + +label, input, select { + display: table-cell; + margin-bottom: 10px; +} +/* Make hidden great again */ +[hidden] { + display: none !important; +} + + +/* Specific to handovers */ + +h1 { + color: #087581; +} + +h2 { + color: white; + background: #087581; +} + +/*h3 {*/ +/* background: #B8F4FA;*/ +/*}*/ + +#logo { + background: white; + float: right; + margin: 0 0 0 1px; +} \ No newline at end of file diff --git a/README.md b/README.md index 9cb4b25..4336ecc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,15 @@ Taking inspiration from https://git.dbyte.xyz/distro/redbrick-open-governance we To view in Obsidian you can either download and install from https://obsidian.md/. Or if you have nix installed you can do ``nix develop``. -## Handovers -latest handovers are available [here][0] -[0]: https://gitlab.skynet.ie/api/v4/projects/57/jobs/artifacts/main/download?job=handovers \ No newline at end of file +## Documents +Pipelines run and generate these files every time they are modified. + +### Handovers +Latest handovers are available [here][0] + +### Minutes +Latest Minutes are available [here][1] + +[0]: https://gitlab.skynet.ie/api/v4/projects/57/jobs/artifacts/main/download?job=handovers +[1]: https://gitlab.skynet.ie/api/v4/projects/57/jobs/artifacts/main/download?job=minutes \ No newline at end of file diff --git a/_scripts/format_minutes.sh b/_scripts/format_minutes.sh new file mode 100755 index 0000000..c9d334b --- /dev/null +++ b/_scripts/format_minutes.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + + +# delete to allow for a full rebuild without any ghost artifacts +rm -rf "Minutes_pdf" + +cd Minutes + +for year in */ ; do + # skip symlinks + [ -L "''${year%/}" ] && continue + # exclude teh template fodler + if [[ $year == *"_Templates"* ]]; then + continue + fi + + # go into the year folder + cd $year + + # convert the Committee ones first + + cp ../../_scripts/md_toml/_Minutes-Committee.md.toml ./.md.toml + cargo-bfom + + cp ../../_scripts/md_toml/_Minutes-Council.md.toml ./.md.toml + cargo-bfom + + mkdir -p "../../Minutes_pdf/$year/Committee" + mkdir -p "../../Minutes_pdf/$year/Council" + + # iterate the files + for file in {Committee,Council}_html/*.html; do + if [ -f "$file" ]; then + + # we need teh filename/path + stripped=''${file/.html/""} + + output="../../Minutes_pdf/$year${stripped/_html/""}.pdf" + + echo $output + + wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$stripped.html" "$output" 2> ../errors.log + fi + done + + # cleanup + rm -f .md.toml + # the temp folders where teh html was created, leaving these could cause ghost artifacts + rm -rf ./*_html +done + +cd ../ \ No newline at end of file diff --git a/_scripts/md_toml/_Minutes-Committee.md.toml b/_scripts/md_toml/_Minutes-Committee.md.toml new file mode 100644 index 0000000..09f3977 --- /dev/null +++ b/_scripts/md_toml/_Minutes-Committee.md.toml @@ -0,0 +1,46 @@ + + +# How many spaces of indentation do you want? +# Defaults to 2 +# Optional +indentation = 2 + +# Optional +src = "./Committee" + +# Optional +dest= "./Committee_html" + +# html blocks you dont want to include in teh finished page +# Optional +html_void = [] + +[template] +# Templates are hjtml files that teh generated markdown is insereted into. +# There are several options on how this is carried out. + +# enable templating +# Optional +enable = true +# Set a base template +# Optional +general = "../_Templates/committee.html" + +# Priority of the _templates to use, first one to match a markdown file is used. +# An Empty array below is also valid + +# general: use the general file specified above, if it exists. + +# ajacent: check if there is a template file with the same name as the markdown file ajacent to the markdown file. +# ./src/exasmple.md +# ./src/example.html + +# folder: a html file with the same name of the folder that the md resides in. +# ./src/blog/blog.html +# ./src/blog/post1.md + +# default: use an inbuilt html5 template + + +# Optional +order = ["ajacent", "general", "folder", "default"] diff --git a/_scripts/md_toml/_Minutes-Council.md.toml b/_scripts/md_toml/_Minutes-Council.md.toml new file mode 100644 index 0000000..13d8934 --- /dev/null +++ b/_scripts/md_toml/_Minutes-Council.md.toml @@ -0,0 +1,46 @@ + + +# How many spaces of indentation do you want? +# Defaults to 2 +# Optional +indentation = 2 + +# Optional +src = "./Council" + +# Optional +dest= "./Council_html" + +# html blocks you dont want to include in teh finished page +# Optional +html_void = [] + +[template] +# Templates are hjtml files that teh generated markdown is insereted into. +# There are several options on how this is carried out. + +# enable templating +# Optional +enable = true +# Set a base template +# Optional +general = "../_Templates/committee.html" + +# Priority of the _templates to use, first one to match a markdown file is used. +# An Empty array below is also valid + +# general: use the general file specified above, if it exists. + +# ajacent: check if there is a template file with the same name as the markdown file ajacent to the markdown file. +# ./src/exasmple.md +# ./src/example.html + +# folder: a html file with the same name of the folder that the md resides in. +# ./src/blog/blog.html +# ./src/blog/post1.md + +# default: use an inbuilt html5 template + + +# Optional +order = ["ajacent", "general", "folder", "default"] diff --git a/flake.nix b/flake.nix index d6e3238..7ccb8b0 100644 --- a/flake.nix +++ b/flake.nix @@ -19,10 +19,10 @@ outputs = { self, nixpkgs, utils, bfom }: utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - system = "${system}"; + pkgs = import nixpkgs { + system = "${system}"; config = { - allowUnfree = true; + allowUnfree = true; permittedInsecurePackages = [ # for obsidian "electron-25.9.0" @@ -42,17 +42,16 @@ ''; }; - - apps.bfom = { - type = "app"; - program = "${bfom.defaultPackage.x86_64-linux}/bin/cargo-bfom"; - }; - packages = { handovers = pkgs.writeShellScriptBin "format_handovers" '' export PATH=${pkgs.lib.makeBinPath [ pkgs.wkhtmltopdf bfom.defaultPackage.x86_64-linux ]}:$PATH ${./_scripts/format_handovers.sh} ''; + + minutes = pkgs.writeShellScriptBin "format_minutes" '' + export PATH=${pkgs.lib.makeBinPath [ pkgs.wkhtmltopdf bfom.defaultPackage.x86_64-linux ]}:$PATH + ${./_scripts/format_minutes.sh} + ''; }; });