# HG changeset patch # User Mahlon E. Smith # Date 1248446946 25200 # Node ID 1ae1a79094fab9b278a9775e172f7141c4493adf # Parent 868dae1581ff74e44b997c1805d258c83a4156ba ModPerl2 update. This code was actually released (before it was in a repo) in February of 2005. diff -r 868dae1581ff -r 1ae1a79094fa Apache/OTL.pm --- a/Apache/OTL.pm Fri Jul 24 07:39:57 2009 -0700 +++ b/Apache/OTL.pm Fri Jul 24 07:49:06 2009 -0700 @@ -1,50 +1,89 @@ -#!/usr/bin/perl +# +# VimOutliner (OTL) XHTML pretty printer for mod_perl2/apache2. +# +# Copyright (c) 2006, Mahlon E. Smith +# All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of Mahlon E. Smith nor the names of his +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# package Apache::OTL; use strict; +use warnings; use Apache2::Const qw/ DECLINED OK /; -use Time::HiRes qw/ gettimeofday /; +use Apache2::Request; +use Apache2::RequestRec; +use Apache2::RequestUtil; +use Apache2::RequestIO; +use Apache2::Log; +use Time::HiRes 'gettimeofday'; sub handler { - my $r = shift; - my $VERSION = '0.4'; - my $t0 = Time::HiRes::gettimeofday; + my $VERSION = '0.5'; + my $ID = '$Id$'; + my $r = shift; + my $t0 = Time::HiRes::gettimeofday; my ( $file, # the absolute file path $title, # the file's title $uri, # the file uri - %re, # a hash of pre compiled regular expressions $data, # file contents - %opt, # options from the otl file @blocks, # todo groupings $mtime, # last modification time of otl file - %get, # get arguments (sorting, etc) + $get, # get arguments (sorting, etc) + %opt, # options from otl file ); - return DECLINED unless $r->method() eq 'GET'; - ($file, $uri) = ($r->filename, $r->uri); + # sanity checks + return DECLINED unless $r->method eq 'GET'; + + ( $file, $uri ) = ( $r->filename, $r->uri ); return DECLINED unless -e $file; $mtime = localtime( (stat(_))[9] ); - %get = $r->args; + my $req = Apache2::Request->new($r); + $get = $req->param || {}; - %re = - ( - title => qr/(?:.+)?\/(.+).otl$/i, - percent => qr/(\[.\]) (\d+)%/, - todo => qr/(\[_\]) /, - done => qr/(\[X\]) /, - comment => qr/^(?:\t+)?:(.+)/, - time => qr/(\d{2}:\d{2}:\d{2})/, - date => qr/(\d{2,4}-\d{2}-\d{2})/, - subitem => qr/^\t(?!\t)/, - line_wo_tabs => qr/^(?:\t+)?(.+)/, - linetext => qr/^(?:\[.\] (?:\d+%)?)? (.+)/, + my %re = ( + title => qr/(?:.+)?\/(.+).otl$/i, + percent => qr/(\[.\]) (\d+)%/, + todo => qr/(\[_\]) /, + done => qr/(\[X\]) /, + comment => qr/^(?:\t+)?:(.+)/, + time => qr/(\d{2}:\d{2}:\d{2})/, + date => qr/(\d{2,4}-\d{2}-\d{2})/, + subitem => qr/^\t(?!\t)/, + remove_tabs => qr/^(?:\t+)?(.+)/, + linetext => qr/^(?:\[.\] (?:\d+%)?)? (.+)/, + + comma_sep => qr/(?:\s+)?\,(?:\s+)?/, + hideline => qr/(?:\t+)?\#/, ); - open OTL, "$file" - || ( $r->log_error("Unable to read $file: $!") && return DECLINED ); + # snag file + open OTL, $file + or ( $r->log_error("Unable to read $file: $!") && return DECLINED ); do { local $/ = undef; $data = ; # shlorp @@ -52,7 +91,7 @@ close OTL; # just spit out the plain otl if requested. - if ($get{show} eq 'source') { + if ( $get->{'show'} && $get->{show} eq 'source' ) { $r->content_type('text/plain'); $r->print( $data ); return OK; @@ -78,7 +117,7 @@ } # GET args override settings - $opt{$_} = $get{$_} foreach keys %get; + $opt{$_} = $get->{$_} foreach keys %$get; # set title (fallback to file uri) $title = @@ -86,29 +125,36 @@ ? $opt{title} : $1 if $uri =~ $re{title}; - $opt{style} ||= '/otl_style.css'; - + # start html output $r->content_type('text/html'); $r->print(< $title - EHTML - if ($opt{js}) { - $r->print( - ' ' x 8, - "\n", - ' ' x 4, "\n", - "\n", - ); + # optional styles + if ( $opt{style} ) { + foreach ( split /$re{'comma_sep'}/, $opt{style} ) { + my $media = $_ =~ /print/ ? 'print' : 'screen'; + print qq{\t\n}; + } + } + + # optional javascript + if ( $opt{js} ) { + $r->print( "\t\n" ) + foreach split /$re{'comma_sep'}/, $opt{js}; + $r->print( ' ' x 4, "\n" ); + $r->print( ' ' x 4, "\n" ); } else { $r->print(< @@ -116,16 +162,19 @@ EHTML } + # title, last modification times $r->print("
$opt{title}
\n") if $opt{title}; $r->print("
Last modified: $mtime
\n") if $opt{last_mod}; if ($opt{legend}) { $r->print(< -  Item completed
-  Item is incomplete
+Item completed
+Item is incomplete
EHTML } + + # sorter if ($opt{sort}) { my %sorts = ( alpha => 'alphabetical', @@ -144,66 +193,95 @@ $r->print("\n"); } - my $bc = 0; foreach my $block ( sort { sorter(\%opt, \%re) } @blocks ) { # separate outline items - my @items = split /\n/, $block; - $r->print("
\n") if $opt{divs}; - my $lc = 0; - - # get item counts - my ($subs, $comments, $subsubs); - if ($opt{counts}) { - foreach (@items) { - if (/$re{comment}/) { - $comments++; - } elsif (/$re{subitem}/) { - $subs++; - } + my @lines = grep { $_ !~ /$re{'hideline'}/ } split /\n/, $block; + my $data = []; + + # build structure and get item counts + my ( $subs, $comments, $subsubs ) = ( 0, 0, 0 ); + foreach ( @lines ) { + if (/$re{comment}/) { + $comments++; + } + elsif (/$re{subitem}/) { + $subs++; } - $subsubs = (scalar @items - 1) - $subs - $comments;; + + my $level = 0; + $level = $1 =~ tr/\t/\t/ if /^(\t+)/; + $level++; + + s#$re{remove_tabs}#$1# unless $opt{'debug'}; + push @$data, [ $level, $_ ]; } + $subsubs = ( scalar @lines - 1 ) - $subs - $comments; - # parse - foreach (@items) { - next if /^\#/; - my $level = tr/\t/\t/ || 0; - next unless /\w/; + # begin parsing structure + $r->print("
\n"); + $r->print("
    \n") unless $opt{'debug'}; + my $i = 0; + foreach ( @$data ) { + my ( $level, $line ) = @$_; + + if ( $opt{'debug'} ) { + my $in = " " x $level x 4; + $r->print( "$level:$in $line
    \n" ); + next; + } + + my $next_level = $data->[ $i+1 ] ? $data->[ $i+1 ]->[0] : 0; + my $in = "\t" x $level; + + $line =~ s#$re{'time'}#$1#g; + $line =~ s#$re{date}#$1#g; + $line =~ s#$re{percent}#$1 $2%#; # append counts - if ($lc == 0 && $opt{counts} && $_ !~ $re{comment}) { + if ( $i == 0 && $opt{counts} && $line !~ $re{comment} ) { my $itmstr = $subs == 1 ? 'item' : 'items'; my $sitmstr = $subsubs == 1 ? 'subitem' : 'subitems'; - $_ .= " $subs $itmstr, $subsubs $sitmstr"; + $line .= " $subs $itmstr, $subsubs $sitmstr"; } - s/^:// if ! $level; - if ($opt{js}) { - s#(.+)#$1# if $lc == 0; - $r->print("\n") if $lc == 1; + my $li_class = '>'; + $li_class = ' class="todo">' if $line =~ s#$re{todo}##; + $li_class = ' class="done">' if $line =~ s#$re{done}##; + $li_class = ' class="comment">' if $line =~ s#$re{comment}#$1#; + + if ( $next_level == $level || $next_level == 0 ) { + $r->print( "$in\n" ); } - s#$re{'time'}#$1#g if /$re{'time'}/; - s#$re{date}#$1#g if /$re{date}/; - s#$re{percent}#$1 $2%# if /$re{percent}/; - s#$re{todo}# # if /$re{todo}/; - s#$re{done}# # if /$re{done}/; - s#$re{comment}#$1# if /$re{comment}/; - s#$re{line_wo_tabs}#$1#; + elsif ( $next_level < $level ) { + $r->print( "$in\n" ); + for (my $x = $level - 1; $x >= $next_level; $x--) { + my $in = "\t" x $x; + $r->print( "$in
\n$in\n" ); + } + } - $r->print("$_\n"); - $lc++; + else { + # implicit: $next_level > $level AND $next_level != 0 + $r->print("$in\n"); + } + + $i++; } - $r->print("\n") if $opt{js}; - $r->print("
\n") if $opt{divs}; - $r->print("


\n") if $opt{dividers}; - $r->print("

\n") unless $opt{divs} || $opt{dividers}; - $bc++; + + unless ( $opt{'debug'} ) { + for (my $x = $data->[ scalar @$data - 1]->[0] - 1; $x > 0; $x--) { + my $in = "\t" x $x; + $r->print( "$in\n$in\n" ); + } + $r->print( "\n" ); + } + $r->print( "
\n\n" ); } my $t1 = Time::HiRes::gettimeofday; my $td = sprintf("%0.3f", $t1 - $t0); - $r->print("
OTL parsed in $td secs
") if $opt{timer}; + $r->print("
OTL parsed in $td secs
\n") if $opt{timer}; $r->print(< @@ -230,3 +308,4 @@ } 1; + diff -r 868dae1581ff -r 1ae1a79094fa README --- a/README Fri Jul 24 07:39:57 2009 -0700 +++ b/README Fri Jul 24 07:49:06 2009 -0700 @@ -1,4 +1,4 @@ ---------------------------------------------------------------------- + WHAT IS THIS? --------------------------------------------------------------------- @@ -13,14 +13,18 @@ Now, I can just edit the otl files directly - skip the conversion step altogether, and let Apache make some delicious looking outlines. ---------------------------------------------------------------------- + INSTALLATION --------------------------------------------------------------------- -First off all, make sure you have a mod_perl enabled Apache2. +First of all, prerequisites! -1) Add the following lines in your httpd.conf, or in a - separate otl.conf in the apache Includes directory: + - apache2 + - mod_perl2 + - libapreq2 (Apache2::Request) + +Add the following lines in your httpd.conf, or in a +separate otl.conf in the apache Includes directory: ------------------------- PerlSwitches -I/path/to/perl/libraries @@ -32,12 +36,11 @@ ------------------------- -2) Put the included css at /otl_style.css in your document root. +Doublecheck that your apreq2 module is setup to load, as well. + +That's it. Apache will now pretty-print all your otl files. -That's it! Apache will now pretty-print all your otl files. - ---------------------------------------------------------------------- SETTINGS --------------------------------------------------------------------- @@ -55,34 +58,30 @@ style Type: string - Default: /otl_style.css + Default: none - A path to the css style. + A path to css style(s). + Comma separated values load different files in order. + Media type defaults to 'screen', if the css name contains the + string 'print' anywhere, the media type is changed to print. + :style=/css/otl_style.css,/css/print_style.css js Type: string Default: none - Use javascript? If set, loads an external javascript library, - and calls init_page() on body load. - See the example 'folding' javascript included. + Use javascript? If set, loads an external javascript library. + Comma separated values load diff files in order. -divs +last_mod Type: boolean Default: 0 - Wrap each outline group in a div class called "group" - + Show modification time of the otl file? -dividers - Type: boolean - Default: 0 - - Separate each outline group with a horizontal rule? - - + legend Type: boolean Default: 0 @@ -127,23 +126,29 @@ Display how long the parser took to generate the html? ---------------------------------------------------------------------- + INCLUDED FILES --------------------------------------------------------------------- -otl_handler.pl - The mod_perl code itself. - Feel free to modify to taste. - -themes/* - Example css. Again, modify to taste! +/Apache/OTL.pm + The mod_perl content handler. -otl.js - Example (but functional!) javascript. If you use this - file, your top level items will be 'clickable' - expanding - the sub items underneath, but not initially showing them. +/javascript/* + Example (but functional!) javascript. Create line numbers, + various eye candies, and clickable folds. -sample.otl + This requires the 'jquery.js' library, also included. + +/sample.otl An example vimoutliner file, with optional settings. +/styles/* + "Theme" examples for customizing OTL display. + + ACKNOWLEDGEMENTS +--------------------------------------------------------------------- + +Thanks to Nathan Dabney and +Michael Granger for their help and advice! + diff -r 868dae1581ff -r 1ae1a79094fa devel-mode --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devel-mode Fri Jul 24 07:49:06 2009 -0700 @@ -0,0 +1,5 @@ +PerlModule Apache2::Reload +PerlInitHandler Apache2::Reload +PerlSetVar ReloadAll Off +PerlSetVar ReloadModules "Apache::OTL" +PerlSetVar ReloadConstantRedefineWarnings Off diff -r 868dae1581ff -r 1ae1a79094fa javascript/jquery.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javascript/jquery.js Fri Jul 24 07:49:06 2009 -0700 @@ -0,0 +1,12 @@ +/* + * jQuery 1.0.2 - New Wave Javascript + * + * Copyright (c) 2006 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2006-10-09 20:23:18 -0400 (Mon, 09 Oct 2006) $ + * $Rev: 413 $ + */ + +eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('l(1Y 1O.6=="P"){1O.P=1O.P;6=q(a,c){l(a&&1Y a=="q"&&6.C.1T)v 6(15).1T(a);a=a||6.1k||15;l(a.2J)v 6(6.1X(a,[]));l(c&&c.2J)v 6(c).2j(a);l(1O==7)v 1f 6(a,c);u m=/^[^<]*(<.+>)[^>]*$/.36(a);l(m)a=6.31([m[1]]);7.1o(a.N==2y||a.D&&!a.1S&&a[0]!=P&&a[0].1S?6.1X(a,[]):6.2j(a,c));u C=1d[1d.D-1];l(C&&1Y C=="q")7.U(C)};l(1Y $!="P")6.3W$=$;u $=6;6.C=6.89={2J:"1.0.2",4u:q(){v 7.D},1o:q(26){l(26&&26.N==2y){7.D=0;[].1l.17(7,26);v 7}F v 26==P?6.1X(7,[]):7[26]},U:q(C,1h){v 6.U(7,C,1h)},8b:q(16){u 2c=-1;7.U(q(i){l(7==16)2c=i});v 2c},1r:q(1P,W,B){v 1P.N!=1N||W!=P?7.U(q(){l(W==P)H(u I 1q 1P)6.1r(B?7.1a:7,I,1P[I]);F 6.1r(B?7.1a:7,1P,W)}):6[B||"1r"](7[0],1P)},1g:q(1P,W){v 7.1r(1P,W,"20")},2V:q(e){e=e||7;u t="";H(u j=0;j0:14},2K:q(1h,1p,2N,C){u 3G=7.4u()>1;u a=6.31(1h);v 7.U(q(){u 16=7;l(1p&&7.2x.2h()=="60"&&a[0].2x.2h()!="61"){u 25=7.4R("25");l(!25.D){16=15.4E("25");7.44(16)}F 16=25[0]}H(u i=(2N<0?a.D-1:0);i!=(2N<0?2N:a.D);i+=2N){C.17(16,[3G?a[i].3D(V):a[i]])}})},28:q(a,1h){u C=1h&&1h[1h.D-1];u 2i=1h&&1h[1h.D-2];l(C&&C.N!=1v)C=Q;l(2i&&2i.N!=1v)2i=Q;l(!C){l(!7.3d)7.3d=[];7.3d.1l(7.1o());7.1o(a)}F{u 1U=7.1o();7.1o(a);l(2i&&a.D||!2i)7.U(2i||C).1o(1U);F 7.1o(1U).U(C)}v 7}};6.1L=6.C.1L=q(16,I){l(!I){I=16;16=7}H(u i 1q I)16[i]=I[i];v 16};6.1L({5C:q(){6.63=V;6.U(6.2l.5u,q(i,n){6.C[i]=q(a){u K=6.2t(7,n);l(a&&a.N==1N)K=6.19(a,K).r;v 7.28(K,1d)}});6.U(6.2l.2q,q(i,n){6.C[i]=q(){u a=1d;v 7.U(q(){H(u j=0;j"}F l(!a[i].1c("<3v")){1p="3v";a[i]="<1p>"+a[i]+""}F l(!a[i].1c("<3M")||!a[i].1c("<6r")){1p="3M";a[i]="<1p><25><3v>"+a[i]+""}u 1F=15.4E("1F");1F.2u=a[i];l(1p){1F=1F.1M;l(1p!="4j")1F=1F.1M;l(1p=="3M")1F=1F.1M}H(u j=0;j<1F.2e.D;j++)r.1l(1F.2e[j])}F l(a[i].2J||a[i].D&&!a[i].1S)H(u k=0;km[3]-0",4J:"m[3]-0==i",5o:"m[3]-0==i",2f:"i==0",1R:"i==r.D-1",52:"i%2==0",53:"i%2","4J-32":"6.1x(a,m[3]).1m","2f-32":"6.1x(a,0).1m","1R-32":"6.1x(a,0).1R","6v-32":"6.1x(a).D==1",5v:"a.2e.D",5A:"!a.2e.D",5r:"(a.7L||a.2u).1c(m[3])>=0",6w:"a.B!=\'1V\'&&6.1g(a,\'1t\')!=\'21\'&&6.1g(a,\'4e\')!=\'1V\'",1V:"a.B==\'1V\'||6.1g(a,\'1t\')==\'21\'||6.1g(a,\'4e\')==\'1V\'",7I:"!a.2R",2R:"a.2R",34:"a.34",4f:"a.4f || 6.1r(a, \'4f\')",2V:"a.B==\'2V\'",5G:"a.B==\'5G\'",5H:"a.B==\'5H\'",4l:"a.B==\'4l\'",4L:"a.B==\'4L\'",4n:"a.B==\'4n\'",5I:"a.B==\'5I\'",4m:"a.B==\'4m\'",48:"a.B==\'48\'",5B:"a.2x.41().4U(/5B|5O|6C|48/)"},".":"6.1e.3l(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z && !z.1c(m[4])","$=":"z && z.2U(z.D - m[4].D,m[4].D)==m[4]","*=":"z && z.1c(m[4])>=0","":"z"},"[":"6.2j(m[2],a).D"},3j:["\\\\.\\\\.|/\\\\.\\\\.","a.1n",">|/","6.1x(a.1M)","\\\\+","6.1x(a).3p","~",q(a){u r=[];u s=6.1x(a);l(s.n>0)H(u i=s.n;i=1)t=t.2U(t.1c("/"),t.D)}u K=[1k];u 1J=[];u 1R=Q;2d(t.D>0&&1R!=t){u r=[];1R=t;t=6.2I(t).1A(/^\\/\\//i,"");u 3k=14;H(u i=0;i<6.3j.D;i+=2){l(3k)51;u 2o=1f 3T("^("+6.3j[i]+")");u m=2o.36(t);l(m){r=K=6.2t(K,6.3j[i+1]);t=6.2I(t.1A(2o,""));3k=V}}l(!3k){l(!t.1c(",")||!t.1c("|")){l(K[0]==1k)K.3O();1J=6.1X(1J,K);r=K=[1k];t=" "+t.2U(1,t.D)}F{u 3P=/^([#.]?)([a-4X-9\\\\*3W-]*)/i;u m=3P.36(t);l(m[1]=="#"){u 4q=15.5z(m[2]);r=K=4q?[4q]:[];t=t.1A(3P,"")}F{l(!m[2]||m[1]==".")m[2]="*";H(u i=0;i<\\/2b>");u 2b=15.5z("5V");2b.2A=q(){l(7.2Y!="1I")v;7.1n.3g(7);6.1T()};2b=Q}F l(6.18.3e){6.4r=3R(q(){l(15.2Y=="62"||15.2Y=="1I"){56(6.4r);6.4r=Q;6.1T()}},10)}6.L.1Z(1O,"2T",6.1T)};l(6.18.1y)6(1O).3J(q(){u L=6.L,1i=L.1i;H(u B 1q 1i){u 3H=1i[B],i=3H.D;l(i>0)68 l(B!=\'3J\')L.22(3H[i-1],B);2d(--i)}});6.C.1L({4z:6.C.1C,1C:q(11,G){v 11?7.1W({1z:"1C",27:"1C",1j:"1C"},11,G):7.4z()},5W:6.C.1s,1s:q(11,G){v 11?7.1W({1z:"1s",27:"1s",1j:"1s"},11,G):7.5W()},6h:q(11,G){v 7.1W({1z:"1C"},11,G)},6j:q(11,G){v 7.1W({1z:"1s"},11,G)},6k:q(11,G){v 7.U(q(){u 4B=6(7).4o(":1V")?"1C":"1s";6(7).1W({1z:4B},11,G)})},84:q(11,G){v 7.1W({1j:"1C"},11,G)},6n:q(11,G){v 7.1W({1j:"1s"},11,G)},6q:q(11,2q,G){v 7.1W({1j:2q},11,G)},1W:q(I,11,G){v 7.1w(q(){7.2P=I;H(u p 1q I){u e=1f 6.2O(7,6.11(11,G),p);l(I[p].N==4M)e.2M(e.1m(),I[p]);F e[I[p]](I)}})},1w:q(B,C){l(!C){C=B;B="2O"}v 7.U(q(){l(!7.1w)7.1w={};l(!7.1w[B])7.1w[B]=[];7.1w[B].1l(C);l(7.1w[B].D==1)C.17(7)})}});6.1L({5i:q(e,p){l(e.4K)v;l(p=="1z"&&e.4D!=3f(6.20(e,p)))v;l(p=="27"&&e.4F!=3f(6.20(e,p)))v;u a=e.1a[p];u o=6.20(e,p,1);l(p=="1z"&&e.4D!=o||p=="27"&&e.4F!=o)v;e.1a[p]=e.3t?"":"4I";u n=6.20(e,p,1);l(o!=n&&n!="4I"){e.1a[p]=a;e.4K=V}},11:q(s,o){o=o||{};l(o.N==1v)o={1I:o};u 4N={6x:6z,6A:4H};o.2F=(s&&s.N==4M?s:4N[s])||4S;o.3o=o.1I;o.1I=q(){6.4P(7,"2O");l(o.3o&&o.3o.N==1v)o.3o.17(7)};v o},1w:{},4P:q(E,B){B=B||"2O";l(E.1w&&E.1w[B]){E.1w[B].3O();u f=E.1w[B][0];l(f)f.17(E)}},2O:q(E,2m,I){u z=7;z.o={2F:2m.2F||4S,1I:2m.1I,2p:2m.2p};z.R=E;u y=z.R.1a;z.a=q(){l(2m.2p)2m.2p.17(E,[z.2a]);l(I=="1j")6.1r(y,"1j",z.2a);F l(3f(z.2a))y[I]=3f(z.2a)+"5f";y.1t="2Q"};z.57=q(){v 3Z(6.1g(z.R,I))};z.1m=q(){u r=3Z(6.20(z.R,I));v r&&r>-6R?r:z.57()};z.2M=q(4t,2q){z.42=(1f 54()).55();z.2a=4t;z.a();z.3Y=3R(q(){z.2p(4t,2q)},13)};z.1C=q(p){l(!z.R.1G)z.R.1G={};z.R.1G[I]=7.1m();l(I=="1j")z.2M(z.R.1G[I],1);F z.2M(0,z.R.1G[I]);l(I!="1j")y[I]="6Z"};z.1s=q(){l(!z.R.1G)z.R.1G={};z.R.1G[I]=7.1m();z.o.1s=V;z.2M(z.R.1G[I],0)};l(!z.R.71)z.R.59=6.1g(z.R,"39");y.39="1V";z.2p=q(47,46){u t=(1f 54()).55();l(t>z.o.2F+z.42){56(z.3Y);z.3Y=Q;z.2a=46;z.a();z.R.2P[I]=V;u 1J=V;H(u i 1q z.R.2P)l(z.R.2P[i]!==V)1J=14;l(1J){y.39=z.R.59;l(z.o.1s)y.1t=\'21\';l(z.o.1s){H(u p 1q z.R.2P){l(p=="1j"&&6.18.1y)6.1r(y,p,z.R.1G[p]);F y[p]=z.R.1G[p]+"5f";l(p==\'1z\'||p==\'27\')6.5i(z.R,p)}}}l(1J&&z.o.1I&&z.o.1I.N==1v)z.o.1I.17(z.R)}F{u p=(t-7.42)/z.o.2F;z.2a=((-5t.7m(p*5t.7q)/2)+0.5)*(46-47)+47;z.a()}}}});6.C.1L({7v:q(M,1K,G){7.2T(M,1K,G,1)},2T:q(M,1K,G,1E){l(M.N==1v)v 7.3B("2T",M);G=G||q(){};u B="4d";l(1K){l(1K.N==1v){G=1K;1K=Q}F{1K=6.2C(1K);B="4x"}}u 3q=7;6.3C(B,M,1K,q(3r,12){l(12=="2w"||!1E&&12=="5s"){3q.5y(3r.2Z).U(G,[3r.2Z,12]);6("2b",3q).U(q(){l(7.3m)6.4v(7.3m);F 37.4i(1O,7.2V||7.7A||7.2u||"")})}F G.17(3q,[3r.2Z,12])},1E);v 7},7F:q(){v 6.2C(7)}});l(6.18.1y&&1Y 3b=="P")3b=q(){v 1f 7K(5J.5K.1c("7R 5")>=0?"7U.5P":"7W.5P")};1f q(){u e="4G,5M,5F,5D,5x".3y(",");H(u i=0;i-1)?"&":"?")+6.2C(J);6.3C("4d",M,Q,q(r,12){l(G)G(6.3n(r,B),12)},1E)},5Z:q(M,J,G,B){6.1o(M,J,G,B,1)},4v:q(M,G){6.1o(M,G,"2b")},64:q(M,J,G){l(G)6.1o(M,J,G,"3S");F{6.1o(M,J,"3S")}},6b:q(M,J,G,B){6.3C("4x",M,6.2C(J),q(r,12){l(G)G(6.3n(r,B),12)})},1u:0,6i:q(1u){6.1u=1u},38:{},3C:q(B,M,J,K,1E){l(!M){K=B.1I;u 2w=B.2w;u 2k=B.2k;u 49=B.49;u 1i=1Y B.1i=="85"?B.1i:V;u 1u=1Y B.1u=="6s"?B.1u:6.1u;u 1E=B.1E||14;J=B.J;M=B.M;B=B.B}l(1i&&!6.3I++)6.L.1Q("4G");u 4p=14;u O=1f 3b();O.6y(B||"4d",M,V);l(J)O.30("6D-6E","6F/x-6J-6L-6O");l(1E)O.30("6S-40-6V",6.38[M]||"6W, 6Y 70 72 3V:3V:3V 73");O.30("X-74-75","3b");l(O.78)O.30("7c","7g");u 2A=q(43){l(O&&(O.2Y==4||43=="1u")){4p=V;u 12=6.4y(O)&&43!="1u"?1E&&6.4Q(O,M)?"5s":"2w":"2k";l(12!="2k"){u 3F;3x{3F=O.4b("4T-40")}3h(e){}l(1E&&3F)6.38[M]=3F;l(2w)2w(6.3n(O,49),12);l(1i)6.L.1Q("5x")}F{l(2k)2k(O,12);l(1i)6.L.1Q("5D")}l(1i)6.L.1Q("5F");l(1i&&!--6.3I)6.L.1Q("5M");l(K)K(O,12);O.2A=q(){};O=Q}};O.2A=2A;l(1u>0)7X(q(){l(O){O.82();l(!4p)2A("1u");O=Q}},1u);O.65(J)},3I:0,4y:q(r){3x{v!r.12&&6l.6m=="4l:"||(r.12>=4H&&r.12<6B)||r.12==4W||6.18.3e&&r.12==P}3h(e){}v 14},4Q:q(O,M){3x{u 50=O.4b("4T-40");v O.12==4W||50==6.38[M]||6.18.3e&&O.12==P}3h(e){}v 14},3n:q(r,B){u 4k=r.4b("7G-B");u J=!B&&4k&&4k.1c("O")>=0;J=B=="O"||J?r.8j:r.2Z;l(B=="2b")37.4i(1O,J);l(B=="3S")37("J = "+J);v J},2C:q(a){u s=[];l(a.N==2y||a.2J){H(u i=0;i'; + $(this).prepend(str); + }); + + // attach folds + $(".outline ul li").toggle( + + // hide + function(){ + if ( $(this).children("ul").size() == 0 ) return; + $(this).children("ul").slideUp("slow"); + $(this).find(".linenum").addClass("linenum-folded"); + }, + + // show + function(){ + $(this).children("ul").slideDown("slow"); + $(this).find(".linenum").removeClass("linenum-folded"); + } + ); + +}); diff -r 868dae1581ff -r 1ae1a79094fa javascript/theme3.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javascript/theme3.js Fri Jul 24 07:49:06 2009 -0700 @@ -0,0 +1,22 @@ +$(document).ready(function(){ + + // append content div + $("body").prepend("
test
"); + $("#content").hide(); + + // FIXME - document.width + document.height + $(".outline").click(function(){ + $("#content").html( $(this).html() ); + $("body").background("#7b7c8c"); + $("#content").show(); + }); + + $("#content").click(function(){ + $(this).hide(); + $("body").background("#acadc3"); + }); + + // re-activate links (the event is stomped on by the li event) + $(".outline a").click(function(){ window.location.href = this; return false; }); + +}); diff -r 868dae1581ff -r 1ae1a79094fa otl.js --- a/otl.js Fri Jul 24 07:39:57 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ - -// otl_handler javascript functions - - -var scroll = new Array(); -var itemcount = 0; - -function init_page() -{ - if (! document.getElementById ) return false; - - var spans = document.getElementsByTagName('span'); - for (i = 0; i < spans.length; i++) { - var id = spans[i].getAttribute('id'); - if (id == null || id == "") continue; - if (id.indexOf("itemtoplevel_") == -1) continue; - - // ie doesn't support negative substr positions :\ - // var num = id.substr(-1, 1); - var num = id.substr(13, 1); - var itemtoplevel = spans[i]; - var itemgroup = document.getElementById("itemgroup_" + num); - if (! itemtoplevel || ! itemgroup) continue; - - itemcount++; - - itemgroup.style.display = 'none'; - itemgroup.style.overflow = 'hidden'; - itemtoplevel.onmouseover = function() { this.className = 'level0_over'; } - itemtoplevel.onmouseout = function() { this.className = 'level0'; } - itemtoplevel.onmouseup = function() { this.className = 'level0'; toggle(this); return false; } - itemtoplevel.onselectstart = function() { return false; } - - } - - return; -} - - -function toggle(i) -{ - var ig = document.getElementById( i.id.replace("toplevel", "group") ); - if (! ig ) return; - - var num = ig.id.substr(10,1); - - // show - if (ig.style.display == "" || - ig.style.display == "none") { - - ig.style.height = "0pt"; - ig.style.display = 'block'; - grow(num); - - // hide others - for (i = 0; i != itemcount; i++) { - if (i != num) shrink(i); - } - - } - // hide - else { - shrink(num); - } - - return; -} - -function grow(num) -{ - var ig = document.getElementById( "itemgroup_" + num ); - if (! ig ) return; - scroll[num] = 1; - - var curheight = parseInt(ig.style.height.replace("pt", "")); - if (curheight >= 250) { - ig.style.overflow = 'auto'; - scroll[num] = 0; - return; - } - - var newheight = curheight + 25 + "pt"; - ig.style.height = newheight; - - setTimeout("grow(" + num + ")", 30); - return; -} - -function shrink(num) -{ - var ig = document.getElementById( "itemgroup_" + num ); - if (! ig ) return; - if (scroll[num] == 1) return; - ig.style.overflow = 'hidden'; - - var curheight = parseInt(ig.style.height.replace("pt", "")); - if (curheight == 0) { - ig.style.display = 'none'; - return; - } - - var newheight = curheight - 50 + "pt"; - ig.style.height = newheight; - - setTimeout("shrink(" + num + ")", 30); - return; -} - - diff -r 868dae1581ff -r 1ae1a79094fa sample.otl --- a/sample.otl Fri Jul 24 07:39:57 2009 -0700 +++ b/sample.otl Fri Jul 24 07:49:06 2009 -0700 @@ -1,37 +1,39 @@ -:title=Sample OTL list :style=/otl_style.css :divs=1 :dividers=0 :legend=1 :js=/otl.js :last_mod=1 +:title=Sample OTL list :counts=1 :timer=1 :style=styles/theme1.css :legend=1 :last_mod=1 + +: Theme examples: +: basic advanced advanced2 -[_] 58% Things to get for party - [_] 50% Food +[_] 29% Things to get for party + [_] 25% Food [_] Chips - [X] Dips + [_] Dips [X] Honey roasted peanuts [_] Sausage - [_] 66% Party favors - [X] Hats - [X] Whistles - [_] Beer bong + [_] 33% Party favors + [_] Hats + [_] Whistles + [X] Beer bong -[_] 18% House projects - [_] 12% Paint - [_] 25% Buy paint and supplies +[_] 19% House projects + [_] 25% Paint + [_] 50% Buy supplies [_] Paint [X] Brushes - [_] Trays + [X] Trays 2006-09-14 [_] Overalls [_] 0% Rooms done [_] Bathroom [_] Bedroom : Red? - [_] 20% Upgrade electrical + [_] 13% Upgrade electrical [_] 2 circuits to computer room [_] 40% Get equipment [X] Romex wire - [_] 0% Entry feed wire - : How much of this do I really need? - : I should probably go out to the street - : and measure stuff. + [_] Entry feed wire + : How much of this do I really need? I should probably go out to the street and measure stuff. + : Make sure the inspector has access to examine stuff on side of house. [_] Service meter [X] Grounding rods [_] Breakers [_] Learn about electricity - [_] Don't die + [_] Don't die diff -r 868dae1581ff -r 1ae1a79094fa styles/theme1.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/theme1.css Fri Jul 24 07:49:06 2009 -0700 @@ -0,0 +1,81 @@ + +body +{ + width: 600px; + font-size: 0.9em; + font-family: sans; +} + +ul +{ + list-style-type: none; + line-height: 1.5em; + padding-left: 20px; +} + +.date +{ + font-size: 0.6em; +} + +.outline +{ + margin-bottom: 30px; +} + +.percent +{ + color: blue; +} + +.comment, .counts +{ + font-size: 0.7em; + line-height: 1em; + padding-top: 2px; + margin-bottom: 5px; + font-family: sans; +} + +.counts +{ + margin-left: 10px; +} + +.counts:before { content: "("; } +.counts:after { content: ")"; } + +.todo +{ + padding-left: 4px; +} + +.done +{ + background-color: #f4f4f4; + color: #777; + padding-left: 4px; +} + +.done:before +{ + font-size: 1.5em; + color: green; + content: "\2611 "; +} + +.todo:before +{ + font-size: 1.5em; + color: #777; + content: "\2610 "; +} + +.legend .todo, .legend .done { border: 0 } +.legend +{ + margin-bottom: 30px; + margin-top: 20px; +} + + diff -r 868dae1581ff -r 1ae1a79094fa styles/theme2.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/theme2.css Fri Jul 24 07:49:06 2009 -0700 @@ -0,0 +1,145 @@ + +body +{ + background-color: #444; + font: 11px/1.8em sans-serif; + margin: 0; + padding-bottom: 50px; + color: #ccc; +} + +a, a:visited +{ + text-decoration: none; + color: #7f9ab5; +} + +.header +{ + background-color: #aaa; + padding: 3px 0 3px 120px; + margin-top: 50px; + color: #3a5f85; + border-top: 5px solid #333; + font-size: 20px; + font-weight: bold; +} + +.last_mod +{ + padding-left: 120px; + background-color: #333; + border-bottom: 1px solid #000; + font-size: 0.85em; + color: #999; +} + +.percent +{ + display: none; + color: #7f9ab5; + font-weight: bold; + position: absolute; + left: 115px; +} + +.linenum +{ + color: #7f9ab5; + position: absolute; + left: 0; + font-size: 9px; + font-weight: normal; + font-style: normal; + width: 60px; + text-align: right; +} + +.linenum-folded +{ + color: #666; +} + +.timer +{ + color: #666; + position: absolute; + top: 5px; + right: 10px; +} + +.outline +{ + width: 400px; + margin: 20px 0 0 150px; + display: none; + cursor: pointer; +} + +.outline ul +{ + margin: 0; + padding: 0 10px 0 5px; + list-style-type: none; +} + +.outline ul li +{ + padding: 0 0 0 10px; + display: block; + color: #fff; + font-size: 14px; + font-weight: bold; +} + +.outline ul li:hover +{ + color: #fff; +} + +.outline ul li ul li +{ + border-left: 1px solid #666; + color: #ccc; + font-size: 11px; + font-weight: normal; +} + +.outline ul li ul li:hover +{ + border-left: 1px solid #aaa; +} + +.done +{ + color: #777 !important; + font-style: italic; +} + +.done:after +{ + font-size: 0.9em; + content: " (done)"; +} + +.comment +{ + padding-right: 2px !important; + font-style: italic; + border-top: 1px solid #666; + border-bottom: 1px solid #666; + border-right: 1px solid #666; +} + +.comment:hover +{ + border-top: 1px solid #aaa; + border-bottom: 1px solid #aaa; + border-right: 1px solid #aaa; +} + +.selected +{ + background-color: #3d3d3d; +} + diff -r 868dae1581ff -r 1ae1a79094fa styles/theme3.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/styles/theme3.css Fri Jul 24 07:49:06 2009 -0700 @@ -0,0 +1,102 @@ + +body +{ + background-color: #acadc3; + font: 12px Verdana, sans-serif; + color: #000; + text-align: center; +} + +a, a:visited +{ + text-decoration: none; + color: blue; +} + +.header +{ + margin-top: 40px; + font-size: 2em; + font-weight: bold; +} + +.header:after { content: " ----|" } +.header:before { content: "|---- " } + +.last_mod { font-size: .85em; } +.percent { font-weight: bold; } + +.sort +{ + margin-bottom: 30px; + font-size: .85em; +} + +.outline +{ + cursor: pointer; + float: left; + padding: 20px; + border: 1px solid #8082a9; + margin-left: 10px; + background-color: #ccc; +} + +.outline:hover +{ + border: 1px solid #000; +} + +.outline ul, #content ul +{ + padding: 0; + margin: 0; + list-style-type: none; +} + +.outline ul li ul li { display: none; } + +#content ul li ul { padding-left: 20px; } + +#content ul li +{ + font-weight: bold; + font-size: 1.5em; + text-align: center; + color: #3a3d85; +} + +#content ul li ul li +{ + font-weight: normal; + text-align: left; + font-size: 10px; + color: #000; +} + +#content .done { color: #777; } +.comment { font-style: italic; } + +#content ul li .percent { color: #ff7e00; } +#content ul li ul li .percent { color: #000; } + +#content .comment +{ + font-style: italic; + border-left: 1px solid #999; + padding-left: 5px; + margin-bottom: 3px; +} + +#content +{ + position: absolute; + left: 15%; + width: 60%; + height: 80%; + cursor: pointer; + background-color: #fff; + border: 2px solid #3a3d85; + padding: 10px; +} + diff -r 868dae1581ff -r 1ae1a79094fa themes/bg.gif Binary file themes/bg.gif has changed diff -r 868dae1581ff -r 1ae1a79094fa themes/otl_style.css --- a/themes/otl_style.css Fri Jul 24 07:39:57 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -body -{ - font-family: Verdana; - font-size: 12px; - color: black; - background-color: #efefef; - margin: 30px 30px 100px 30px; -} - -.legend -{ - margin-bottom: 10px; -} - -.timer -{ - position: absolute; - top: 5; - right: 10; - color: #ccc; -} - -.group -{ - padding: 0px; - background-color: white; - width: 600px; - border: 1px solid #ccc; - margin-bottom: 5px; -} - -.header -{ - font-size: 24px; - font-variant: small-caps; - font-weight: bold; -} - -.last_mod -{ - display: block; - border-top: 1px solid #ccc; - font-style: italic; - color: #777; -} - -.counts -{ - font-size: 11px; - display: block; - color: #777; - margin-left: 30px; - font-style: italic; -} - -.sort -{ - margin-bottom: 30px; - border-bottom: 1px solid #ccc; - font-weight: bold; -} - -.sort a -{ - font-weight: normal; - text-decoration: none; - color: #777; -} - -.sort a:hover -{ - color: black; -} - -.date, .time { } - -.level0 -{ - background-color: #ddd; - font-size: 18px; - font-weight: bold; - display: block; - cursor: pointer; - -moz-user-select: none; -} - -.level0_over -{ - display: block; - background-color: #ecebe2; - cursor: pointer; -} - -.level1 -{ - font-size: 14px; - font-weight: bold; - margin-left: 15px; - color: #333; - display: block; -} - -.level2 -{ - font-size: 12px; - margin-left: 30px; - color: #555; - display: block; -} - -.level3 -{ - font-size: 10px; - margin-left: 45px; - color: #777; - display: block; -} - -.level4 -{ - font-size: 10px; - margin-left: 60px; - color: #aaa; - display: block; -} - -.percent -{ - font-weight: bold; - color: #7c8ee8; -} - -.todo -{ - background-color: #ccc; - padding-right: 12px; - margin-right: 10px; -} - -.done -{ - background-color: #7c8ee8; - margin-right: 10px; - padding-right: 12px; -} - -.comment -{ - font-weight: normal; - font-style: italic; - display: block; -} - diff -r 868dae1581ff -r 1ae1a79094fa themes/otl_style2.css --- a/themes/otl_style2.css Fri Jul 24 07:39:57 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -body -{ - font-family: Verdana; - font-size: 11px; - background-color: white; - margin: 30px 30px 100px 30px; -} - -.header -{ - font-size: 18px; - font-weight: bold; -} - -.last_mod -{ - display: block; - border-top: 1px solid #ccc; - font-style: italic; - color: #777; -} - -.legend {} -.date {} -.time {} - -.group -{ - width: 50%; - min-width: 500px; - margin-bottom: 5px; - border-bottom: 1px solid #eee; -} - -.timer -{ - position: absolute; - top: 5; - right: 10; - color: #999; -} - -.counts -{ - color: #777; - margin-left: 10px; - font-weight: normal; - font-size: 10px; - font-style: italic; -} - -.sort -{ - margin-bottom: 15px; - font-weight: bold; -} - -.sort a -{ - font-weight: normal; - text-decoration: none; - color: #777; -} - -.sort a:hover -{ - color: black; -} - -.level0 -{ - font-weight: bold; - cursor: pointer; - display: block; - -moz-user-select: none; -} - -.level0_over -{ - background-color: #eee; - cursor: pointer; - display: block; -} - -.level1 -{ - display: block; - margin-left: 20px; -} - -.level2 -{ - display: block; - margin-left: 40px; -} - -.level3 -{ - display: block; - margin-left: 60px; -} - -.level4 -{ - display: block; - margin-left: 80px; -} - -.percent -{ - color: #8193c8; - font-weight: bold; -} - -.todo -{ - padding-left: 10px; - margin-right: 5px; - border: .5px solid #c88181; - background-color: #fbf5f5; -} - -.done -{ - padding-left: 10px; - margin-right: 5px; - border: .5px solid #8193c8; - background-color: #f5f7fb; -} - -.comment -{ - font-style: italic; - display: block; -} - diff -r 868dae1581ff -r 1ae1a79094fa themes/otl_style3.css --- a/themes/otl_style3.css Fri Jul 24 07:39:57 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,158 +0,0 @@ -body -{ - font-family: Verdana; - font-size: 12px; - color: black; - background-color: #efefef; - margin: 30px 30px 100px 30px; -} - -.legend -{ - margin-bottom: 10px; -} - -.timer -{ - position: absolute; - top: 5; - right: 10; - color: #ccc; -} - -.group -{ - padding: 0px; - background-color: white; - border: 1px solid #ccc; - margin-bottom: 5px; - width: 600px; -} - -.header -{ - font-size: 24px; - font-variant: small-caps; - font-weight: bold; -} - -.last_mod -{ - display: block; - border-top: 1px solid #ccc; - font-style: italic; - color: #777; -} - -.counts -{ - font-size: 11px; - display: block; - color: #777; - margin-left: 30px; - font-style: italic; -} - -.sort -{ - margin-bottom: 30px; - border-bottom: 1px solid #ccc; - font-weight: bold; -} - -.sort a -{ - font-weight: normal; - text-decoration: none; - color: #777; -} - -.sort a:hover -{ - color: black; -} - -.time, .date -{ - font-weight: normal; - font-size: 10px; - color: #777; -} - -.level0 -{ - background-color: #ddd; - font-size: 18px; - font-weight: bold; - display: block; - cursor: pointer; - -moz-user-select: none; -} - -.level0_over -{ - display: block; - background-color: #ecebe2; - cursor: pointer; -} - -.level1 -{ - font-size: 14px; - font-weight: bold; - margin-left: 15px; - color: #333; - display: block; -} - -.level2 -{ - font-size: 12px; - margin-left: 30px; - color: #555; - display: block; -} - -.level3 -{ - font-size: 10px; - margin-left: 45px; - color: #777; - display: block; -} - -.level4 -{ - font-size: 10px; - margin-left: 60px; - color: #aaa; - display: block; -} - -.percent -{ - font-weight: bold; - color: #7c8ee8; -} - -.todo -{ - background-color: #ccc; - padding-right: 12px; - margin-right: 10px; -} - -.done -{ - background-color: #7c8ee8; - margin-right: 10px; - padding-right: 12px; -} - -.comment -{ - font-weight: normal; - font-style: italic; - display: block; -} -