forked from Computer_Society/open-goverance
doc: handovers are now in a better folder and scripts have been updated to deal with it
This commit is contained in:
parent
af359864d1
commit
1676c6fc25
4 changed files with 96 additions and 44 deletions
|
@ -21,7 +21,7 @@ stages:
|
|||
rules:
|
||||
- if: '$CI_PROJECT_NAMESPACE == "compsoc1/compsoc" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||
changes:
|
||||
- Committee/_Handovers/**/*
|
||||
- Committee/**/Handovers/*
|
||||
- Minutes/**/*
|
||||
|
||||
handovers:
|
||||
|
@ -33,8 +33,8 @@ handovers:
|
|||
artifacts:
|
||||
name: "Handovers"
|
||||
paths:
|
||||
- Committee/_Handovers_pdf/
|
||||
- Committee/errors.log
|
||||
- Handovers_pdf/
|
||||
- errors.log
|
||||
|
||||
|
||||
minutes:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link href="main.css" rel="stylesheet">
|
||||
<link href="./main.css" rel="stylesheet">
|
||||
|
||||
<title>{title}</title>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
</head>
|
||||
<body class="sticky-wrapper">
|
||||
<main>
|
||||
<img src="" alt="Computer Society Logo" width="200" height="200" id="logo"/>
|
||||
<img src="./Logo_2024.svg" alt="Computer Society Logo" width="200" height="200" id="logo"/>
|
||||
<h1>University of Limerick Computer Society</h1>
|
||||
<!--indentation is managed by the converter-->
|
||||
{body}
|
||||
|
|
|
@ -1,55 +1,107 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd Committee
|
||||
root="$PWD"
|
||||
|
||||
# cleanup the last run (if there was one)
|
||||
rm -rf _Handovers_html
|
||||
folder_html="Handovers_html"
|
||||
folder_pdf="Handovers_pdf"
|
||||
|
||||
# copy in teh config for this folder
|
||||
cp ../_scripts/md_toml/_Handovers.md.toml ./.md.toml
|
||||
function build_html() {
|
||||
# used to match **
|
||||
shopt -s globstar
|
||||
|
||||
cargo-bfom
|
||||
# cleanup the last run (if there was one)
|
||||
rm -rf "$folder_html"
|
||||
mkdir "$folder_html"
|
||||
|
||||
## cleanup
|
||||
rm -f .md.toml
|
||||
cd Committee
|
||||
|
||||
# if the user only wants teh html tehn early return
|
||||
if [[ $1 == "html" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
root_html="$PWD"
|
||||
|
||||
# recursively parse _Handovers_html use wkhtmltopdf to convert to pdf
|
||||
cd _Handovers_html
|
||||
# loop through each year worth of data
|
||||
# the globbing is to only get ones that have a handover folder
|
||||
for year in **/Handovers; do
|
||||
# skip symlinks
|
||||
[ -L "''${year%/}" ] && continue
|
||||
|
||||
out_folder="../_Handovers_pdf"
|
||||
rm -rf "$out_folder"
|
||||
for d in */; do
|
||||
# skip symlinks
|
||||
[ -L "''${d%/}" ] && continue
|
||||
# exclude teh template fodler
|
||||
if [[ $d == *"_Templates"* ]]; then
|
||||
continue
|
||||
fi
|
||||
if ! [[ $year =~ [0-9]{4}-[0-9]{4} ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# create output folder
|
||||
mkdir -p "$out_folder/$d"
|
||||
year_string="${year/\/Handovers/""}"
|
||||
|
||||
# iterate the files
|
||||
for file in $d*.html; do
|
||||
cd "$year_string"
|
||||
|
||||
# copy in teh config for this folder
|
||||
cp ../../_scripts/md_toml/_Handovers.md.toml ./.md.toml
|
||||
|
||||
# convert teh handovers
|
||||
cargo-bfom
|
||||
|
||||
# copy in teh relevent files
|
||||
cp -R ../_Templates/Handovers/* ./Handovers_html
|
||||
# no need to have the template in the output
|
||||
rm -f ./Handovers_html/_template.md
|
||||
rm -f ./Handovers_html/general.html
|
||||
rm -f .md.toml
|
||||
|
||||
# make the final folder
|
||||
mkdir -p "$root/$folder_html/$year_string"
|
||||
|
||||
# copy everything to teh final folder
|
||||
cp -R ./Handovers_html/* "$root/$folder_html/$year_string"
|
||||
|
||||
# remove teh temp folder
|
||||
rm -rf ./Handovers_html
|
||||
|
||||
# return to root
|
||||
cd "$root_html"
|
||||
done
|
||||
|
||||
# undo the globbing
|
||||
shopt -u globstar
|
||||
|
||||
|
||||
# back to root
|
||||
cd $root
|
||||
}
|
||||
|
||||
|
||||
function build_pdf() {
|
||||
# used to match **
|
||||
shopt -s globstar
|
||||
|
||||
# wipe and reset past runs
|
||||
rm -rf "$folder_pdf"
|
||||
mkdir "$folder_pdf"
|
||||
|
||||
cd "$folder_html"
|
||||
|
||||
for file in **/*.html; do
|
||||
# only deal with files
|
||||
if [ -f "$file" ]; then
|
||||
|
||||
# we need teh filename/path
|
||||
stripped=''${file/.html/""}
|
||||
# .html => .pdf
|
||||
output="../$folder_pdf/${file/.html/".pdf"}"
|
||||
|
||||
echo "$out_folder/$stripped.pdf"
|
||||
echo $output
|
||||
|
||||
# convert teh html to pdf
|
||||
wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$stripped.html" "$out_folder/$stripped.pdf" 2>>../errors.log &
|
||||
# have someplace for it to go
|
||||
mkdir -p $(dirname $output)
|
||||
|
||||
wkhtmltopdf -q --enable-local-file-access --no-stop-slow-scripts "$file" "$output" 2>>../errors.log &
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
cd ../
|
||||
shopt -u globstar
|
||||
cd $root
|
||||
|
||||
# wait for background tasks to complete
|
||||
wait $(jobs -p)
|
||||
# wait for background tasks to complete
|
||||
wait $(jobs -p)
|
||||
}
|
||||
|
||||
if [[ $1 == "html" ]]; then
|
||||
build_html
|
||||
else
|
||||
build_html
|
||||
build_pdf
|
||||
fi
|
|
@ -6,10 +6,10 @@
|
|||
indentation = 2
|
||||
|
||||
# Optional
|
||||
src = "./_Handovers"
|
||||
src = "./Handovers"
|
||||
|
||||
# Optional
|
||||
dest= "./_Handovers_html"
|
||||
dest= "./Handovers_html"
|
||||
|
||||
# html blocks you dont want to include in teh finished page
|
||||
# Optional
|
||||
|
@ -24,7 +24,7 @@ html_void = []
|
|||
enable = true
|
||||
# Set a base template
|
||||
# Optional
|
||||
general = "./_Handovers/_Templates/general.html"
|
||||
general = "../_Templates/Handovers/general.html"
|
||||
|
||||
# Priority of the _templates to use, first one to match a markdown file is used.
|
||||
# An Empty array below is also valid
|
||||
|
|
Loading…
Reference in a new issue