site-catium

Un site pour la promotion de catium - retour accueil

git clone git://bebou.netlib.re/site-catium
Log | Files | Refs | README |

page (1227B)


      1 #! /usr/bin/env dash
      2 
      3 STYLE=/style.css
      4 
      5 tmpd=$(mktemp -d)
      6 trap "rm -rf $tmpd" EXIT
      7 
      8 save() cat >> "$tmpd/$1"
      9 
     10 gallerie() {
     11 	echo "<section id='photos'>"
     12 	cat |
     13 		sed -E 's/[^ ]+/& &/' |
     14 		xargs printf "<a href='%s' target=blank><img src='%s' alt='%s'></a>\n"
     15 	echo "</section>\n"
     16 }
     17 
     18 alias section:='<<\endsection save'
     19 alias sectionhtml:='<<\endsection save'
     20 alias gallerie:='<<\endgallerie gallerie | save'
     21 
     22 alias title:="title"
     23 title() title="$*"
     24 
     25 alias author:="author"
     26 author() author="$*"
     27 
     28 alias description:="description"
     29 description() description="$*"
     30 
     31 alias publication:=":"
     32 
     33 file="$1"
     34 
     35 show() lowdown $tmpd/$1
     36 
     37 tsv2anything() {
     38 	tee $tmpd/all | head -n1 |
     39 		tr '	' '\n' > $tmpd/vars
     40 	tail -n+2 $tmpd/all |
     41 	while read line;do
     42 		eval $(echo "$line" | tr '	' '\n' |
     43 			   	   paste -d '=' $tmpd/vars - |
     44 				   sed -E 's/"/\\\"/g' |
     45 				   sed -E 's/=/&"/;s/$/"/')
     46 		. "$1"
     47 	done
     48 }
     49 
     50 grep -E "^##+" "$file" > $tmpd/titles
     51 < $tmpd/titles lowdown |
     52 	grep -v '^$' |
     53 	cut -d'"' -f2 |
     54 	sed -E 's/^/(#/;s/$/)/' > $tmpd/slugs
     55 sed -E 's/^##/  /g;' $tmpd/titles |
     56 	sed -E 's/#/  /g' |
     57 	sed -E 's/ (\w)/[\1/;s/$/]/' |
     58 	sed -E 's/([^* ])/* \1/' |
     59 	paste - $tmpd/slugs |
     60 	sed '$ a - - -' |
     61 	save tdm
     62 
     63 . layouts/html
     64 
     65 . "$1"
     66 
     67 layout