1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-22 15:47:11 +02:00
ben-scans/web/style.sh
Werner Almesberger 42f6a9966e Index page update for recent completions.
- web/Makefile: make test.html and index.html phony so that they're rebuilt
  each time we run make (make doesn't know all the dependencies)
- web/index.sh: added ben-bottom-nobat-100um
- web/index.sh: added ben-kbd-top-1mm and ben-kbd-top-500um
- web/index.sh: added complete ben-bottom-inside2 series
- web/index.sh: added pointer to ben-bottom-inside2 to ben-bottom-inside
- web/style.sh (scan_set): add name anchor for each series
2010-08-26 02:11:42 -03:00

298 lines
4.1 KiB
Bash

#!/bin/sh
if [ -z "$BASE" ]; then
BASE=http://projects.qi-hardware.com/index.php/p/ben-scans/source/tree/master/
fi
# ----- section ---------------------------------------------------------------
section()
{
echo "$__before_set"
__before_set=
cat <<EOF
<P>
<HR>
<P>
<A name="$1">
<H2>$2</H2>
EOF
}
# ----- scan_set / images / texts ---------------------------------------------
scan_set()
{
echo "$__before_set"
__id=$1
__before_set="</TABLE></TABLE>"
__before_image="<TR><TD><TABLE bgcolor="#e4e4e4" border=0 cellspacing=3 cellpadding=2><TR>"
__before_text="<TR>"
cat <<EOF
<P>
<A name="$1">
<TABLE border=0 cellspacing=0 cellpadding=0>
<TR>
<TD>
<TABLE border=1 cellspacing=0 width="100%">
<TR>
</TABLE>
<TR>
<TD>
<TABLE bgcolor="#fff0a0" border=0 cellspacing=3 cellpadding=2
width="100%">
<TR>
<TD><B>$2</B>
</TABLE>
EOF
}
__do_explain()
{
cat <<EOF
<TABLE bgcolor="#e4e4e4" border=0 cellspacing=3 cellpadding=2 width="100%">
<TR>
<TD>
<TABLE bgcolor="#90ff90" border=0 cellspacing=3 cellpadding=2>
<TR>
<TD><I>
EOF
cat
cat <<EOF
</I>
</TABLE>
</TABLE>
EOF
}
explain_set()
{
cat <<EOF
<TR>
<TD>
EOF
__do_explain
}
__do_before_image()
{
echo "$__before_image"
__before_image=
}
image()
{
__do_before_image
cat <<EOF
<TD><IMG src="${BASE}data/jpg/$1.jpg">
EOF
}
images1()
{
image "$__id-1mm"
}
images2()
{
images1
image "$__id-500um"
}
images3()
{
images2
image "$__id-100um"
}
under_consideration()
{
__do_before_image
cat <<EOF
<TD><H1>Under consideration</H1>
EOF
}
planned()
{
__do_before_image
cat <<EOF
<TD><H1>Planned</H1>
EOF
}
in_progress()
{
__do_before_image
cat <<EOF
<TD><H1>In progress</H1>
EOF
}
link()
{
[ -r "../$1" ] || return
size=`ls -l ../$1 | awk '{printf $5}'`
if [ $size -lt 950000 ]; then
size="`echo $size | awk '{printf("%.0f kB", $1/1000)}'`"
size=
else
size="`echo $size | awk '{printf("%.1f MB", $1/1000000)}'`"
fi
echo "<A href=\"${BASE}$1\">$2</A> $size"
}
__text()
{
echo "$__before_text"
__before_text=
echo "<TD>"
cat
link "data/pij/$1.pij.bz2" PIJ
link "data/dxf/$1.dxf.bz2" DXF
link "data/stl/$1.stl.bz2" STL
link "data/csv/$1.txt.bz2" "TXT(CSV)"
}
text()
{
__text "$__id-$1"
}
texts2()
{
text 1mm <<EOF
X/Y step size: 1 mm.<BR>
Z resolution: <B>DRAFT</B><BR>
Approximate scan time: $1<BR>
EOF
text 500um <<EOF
X/Y step size: 500 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
Approximate scan time: $2<BR>
EOF
}
texts3()
{
texts2 "$1" "$2"
text 100um <<EOF
X/Y step size: 100 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
Approximate scan time: $3<BR>
EOF
}
# ----- scan_group / scan -----------------------------------------------------
scan_group()
{
echo "$__before_set"
__before_set="</TABLE>"
__before_hdr="<TR>"
__before_img="<TR>"
__before_text="<TR>"
cat <<EOF
<P>
<TABLE bgcolor="#e4e4e4" border=0 cellspacing=0 cellpadding=0>
<TR>
EOF
}
scan_bar()
{
cat <<EOF
<TD>
<TABLE border=1 cellspacing=0 width="100%">
<TR>
</TABLE>
EOF
}
scan_hdr()
{
echo "$__before_hdr"
__before_hdr=
cat <<EOF
<TD>
<TABLE bgcolor="#fff0a0" border=0 cellspacing=3 cellpadding=0 width="100%">
<TR>
<TD><B>$1</B>
</TABLE>
EOF
}
scan_img()
{
echo "$__before_img"
__before_img=
cat <<EOF
<TD>
<TABLE border=0 cellspacing=3 cellpadding=0>
<TR>
<TD><IMG src="${BASE}data/jpg/$1.jpg">
</TABLE>
EOF
}
scan_text()
{
echo "$__before_text"
__before_text=
echo "<TD>"
if [ ! -z "$3" ]; then
echo "$3" | __do_explain
fi
cat <<EOF
<TABLE border=0 cellspacing=3 cellpadding=2>
<TR>
EOF
__text $1 <<EOF
Approximate scan time: $2<BR>
X/Y step size: 100 &mu;m.<BR>
Z resolution: 25 &mu;m.<BR>
EOF
echo "</TABLE>"
}
# ----- end -------------------------------------------------------------------
end()
{
echo "$__before_set"
cat <<EOF
<P>
<HR>
<P>
`date -u '+%F %X'` UTC
</BODY>
</HTML>
EOF
}