This commit is contained in:
Loic Guegan 2021-10-04 12:09:34 +02:00
parent 18d860cff5
commit 91cb075a19
9 changed files with 23 additions and 60 deletions

4
.gitignore vendored
View file

@ -1,2 +1,2 @@
www/projects
www/*.html
public/projects
public/*.html

View file

@ -1,20 +1,19 @@
#!/usr/bin/env bash
wai=$(dirname $(readlink -f "$0")) # Current script directory
projects_dir=${wai}/projects
www_dir=${wai}/public/
projects_out_dir=${www_dir}/projects/
template_file=${wai}/template.html
public=${wai}/public
projects=${wai}/projects
template=${wai}/template.html
# Clean before
rm -f $www_dir/*.html
rm -fr $projects_out_dir/*
mkdir -p public/projects
rm -rf $public/projects
rm -rf $public/*.html
mkdir -p $public/projects
# Build links
build_links() {
links=""
for p in $(find ${projects_dir}/ -maxdepth 1 -mindepth 1 -type d)
for p in $(find ${projects}/ -maxdepth 1 -mindepth 1 -type d)
do
name=$(basename $p)
[ $name == $1 ] && active="active" || active=""
@ -26,24 +25,22 @@ build_links() {
echo $tmp
}
# Build html
for p in $(find ${projects_dir}/ -maxdepth 1 -mindepth 1 -type d)
for p in $(find ${projects}/ -maxdepth 1 -mindepth 1 -type d)
do
name=$(basename $p)
html=$projects_out_dir/$name/index.html
js=$projects_out_dir/$name/index.js
js2=projects/$name/index.js
page=${www_dir}/${name}.html
echo $p
# Create html
echo $projects_out_dir
cp -r $p $projects_out_dir/
cat $template_file |sed "/\${CONTENT}/r $html"|sed '/\${CONTENT}/d' > $page
sed -i "s#\${JS}#${js2}#g" $page
sed -i "s#\${project_name}#${name}#g" $page
html=${public}/${name}.html
js=./projects/$name/index.js
content=$p/index.html
# Add links
# Create HTML page
cp -r $p $public/projects/
cat $template |sed "/\${CONTENT}/r $content"|sed '/\${CONTENT}/d' > $html
sed -i "s#\${JS}#${js}#g" $html
sed -i "s#\${project_name}#${name}#g" $html
echo $html
# Create links
links_file=$(build_links $name)
sed -i "/\${LINKS}/r $links_file" $page
sed -i '/\${LINKS}/d' $page
sed -i "/\${LINKS}/r $links_file" $html
sed -i '/\${LINKS}/d' $html
done

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
www/js/p5.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,15 +0,0 @@
draw_arrow=function(p,x1,y1,x2,y2){
p.push()
p.strokeWeight(5)
p.line(x1,y1,x2,y2)
offset=5
var angle = p.atan2(y1 - y2, x1 - x2); //gets the angle of the line
p.translate(x2, y2); //translates to the destination vertex
p.rotate(angle-p.HALF_PI); //rotates the arrow point
p.triangle(-offset*0.8, offset, offset*0.8, offset, 0, -offset/2); //draws the arrow point as a triangle
p.pop();
// Return the center of the arrow
return(p.createVector(x1+(x2-x1)/2,y1+(y2-y1)/2))
}