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