Cycling, traffic safety and legal topics; energy, transit and transportion economics
RSS icon Home icon
  • Bicycle Laws

    Each statute referenced is a link and its full text will open in a pop up window. Here is a version better for printing. Here is a .pdf of the entire Title 28 snapped from the azleg.gov website in April 2012.

    #! /bin/sh
    set -e
    
    p='http://www.azleg.state.az.us/ArizonaRevisedStatutes.asp?Title=28'
    
    # mkdir ars ars/proc
    # cd ars
    # ( cd proc && wget "$p" )
    # wget -i 'proc/ArizonaRevisedStatutes.asp?Title=28'
    
    for a in *.htm
    do
        c=`grep -Fwc "$a" proc/${p##*/}` &&
            [ $c = 1 ] ||
            echo "$a fail"
    
        sed "/\<$a\>/q" "proc/${p##*/}" >./tmp
    
        art=`tac tmp |grep -Ewm1 -B1 '<b>Article [0-9]+</b>'`
        chap=`tac tmp |grep -Ewm1 -B1 '<b>Chapter [0-9]+</b>'`
    
        art=`echo "$art" |sed 's/<[^>]*>//g; s///; 2s/ *$/ - /' |tac |xargs`
        chap=`echo "$chap" |sed 's/<[^>]*>//g; s///; 2s/ *$/ - /' |tac |xargs`
    #sed "s/<TITLE>/&$chap, $art, /" "$a" >proc/$a
    #title=`sed '/^ *<TITLE>/!d; s///; s/<.*//' "$a"`
    
        out=
        [ "$chap" != "$ochap" ] && 
            out="$out<h1>$chap<\/h1><h2>$art<\/h2>\n" &&
            ochap=$chap && oart=$art &&
                  echo "chap: $chap" && echo "art: $art"
    
        [ "$art" != "$oart" ] && out="$out<h2>$art<\/h2>\n" && oart=$art && 
            echo "art: $art"
    
        sed "s/<BODY>/&$out/" "$a" >proc/$a
        [ -z "$debug" ] || {
            echo "$a:"
            echo "$chap"
            echo "$art"
    #echo "$title"
            echo
        }
    done
    
    # --toclevels
    # --no-toc
    # --web
    exec htmldoc --header 'h c' -f ars.pdf proc/*.htm