From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- bin/masonize | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 bin/masonize (limited to 'bin/masonize') diff --git a/bin/masonize b/bin/masonize new file mode 100755 index 000000000..475c9a6bf --- /dev/null +++ b/bin/masonize @@ -0,0 +1,70 @@ +#!/usr/bin/perl + +foreach $file ( split(/\n/, `find . -depth -print | grep cgi\$`) ) { + open(F,$file) or die "can't open $file for reading: $!"; + @file = ; + #print "$file ". scalar(@file). "\n"; + close $file; + system("chmod u+w $file"); + open(W,">$file") or die "can't open $file for writing: $!"; + select W; $| = 1; select STDOUT; + $all = join('',@file); + + $mode = 'html'; + while ( length($all) ) { + + if ( $mode eq 'html' ) { + + if ( $all =~ /^(.+?)(<%=?.*)$/s && $1 !~ /<%/s ) { + print W $1; + $all = $2; + next; + } elsif ( $all =~ /^<%=(.*)$/s ) { + print W '<%'; + $all = $1; + $mode = 'perlv'; + #die; + next; + } elsif ( $all =~ /^<%(.*)$/s ) { + print W "\n"; + $all = $1; + $mode = 'perlc'; + next; + } elsif ( $all !~ /<%/s ) { + print W $all; + last; + } else { + warn length($all); die; + } + die; + + } elsif ( $mode eq 'perlv' ) { + + if ( $all =~ /^(.*?%>)(.*)$/s ) { + print W $1; + $all=$2; + $mode = 'html'; + next; + } + die 'unterminated <%= ???'; + + } elsif ( $mode eq 'perlc' ) { + + if ( $all =~ /^([^\n]*?)%>(.*)$/s ) { + print W "%$1\n"; + $all=$2; + $mode='html'; + next; + } + if ( $all =~ /^([^\n]*)\n(.*)$/s ) { + print W "%$1\n"; + $all=$2; + next; + } + + } else { die }; + + } + + close W; +} -- cgit v1.2.1 From ef7bb336cc67f127fb1d77532ad3da1369c0ae36 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Aug 2003 02:02:41 +0000 Subject: - fix Mason profiling to pass-through images (for graph/) - fix graph/money-time.cgi use of $m interfering with Mason - fix graph/money-time-graph.cgi to set content-type in a Mason/ASP-independant fashion - (beginning of) includes! - (beginning of) moving SQL search to including generic elements/search.html - fix global.asa typo - fix masonize to not prepend an extraneous blank line (breaking graph/money-time-graph.cgi) --- bin/masonize | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin/masonize') diff --git a/bin/masonize b/bin/masonize index 475c9a6bf..def0115b7 100755 --- a/bin/masonize +++ b/bin/masonize @@ -8,6 +8,7 @@ foreach $file ( split(/\n/, `find . -depth -print | grep cgi\$`) ) { system("chmod u+w $file"); open(W,">$file") or die "can't open $file for writing: $!"; select W; $| = 1; select STDOUT; + $newline = ''; #avoid prepending extraneous newlines $all = join('',@file); $mode = 'html'; @@ -26,7 +27,7 @@ foreach $file ( split(/\n/, `find . -depth -print | grep cgi\$`) ) { #die; next; } elsif ( $all =~ /^<%(.*)$/s ) { - print W "\n"; + print W $newline; $newline = "\n"; $all = $1; $mode = 'perlc'; next; -- cgit v1.2.1 From e283ab567e6890727e4d8e35c1d8097398678753 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Aug 2003 05:42:13 +0000 Subject: - (finish) includes! (closes: Bug#551) - (finish) moving SQL search to including generic elements/search.html - new elements: menubar.html, header.html, pager.html and table.html - have masonize process .html files also --- bin/masonize | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin/masonize') diff --git a/bin/masonize b/bin/masonize index def0115b7..3139e0af5 100755 --- a/bin/masonize +++ b/bin/masonize @@ -1,6 +1,7 @@ #!/usr/bin/perl -foreach $file ( split(/\n/, `find . -depth -print | grep cgi\$`) ) { +foreach $file ( split(/\n/, `find . -depth -print`) ) { + next unless $file =~ /(cgi|html)$/; open(F,$file) or die "can't open $file for reading: $!"; @file = ; #print "$file ". scalar(@file). "\n"; -- cgit v1.2.1 From 4dbd0e09bd8fe1958eb294ebd425878c420afe6a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 18 Jun 2004 10:28:11 +0000 Subject: masonize fix: avoid newline prepend fix from borking indented first <%, fixes customer search by otaker under mason, closes: Bug#830 --- bin/masonize | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'bin/masonize') diff --git a/bin/masonize b/bin/masonize index 3139e0af5..169ba718f 100755 --- a/bin/masonize +++ b/bin/masonize @@ -6,34 +6,38 @@ foreach $file ( split(/\n/, `find . -depth -print`) ) { @file = ; #print "$file ". scalar(@file). "\n"; close $file; - system("chmod u+w $file"); - open(W,">$file") or die "can't open $file for writing: $!"; - select W; $| = 1; select STDOUT; $newline = ''; #avoid prepending extraneous newlines $all = join('',@file); + $w = ''; + $mode = 'html'; while ( length($all) ) { if ( $mode eq 'html' ) { if ( $all =~ /^(.+?)(<%=?.*)$/s && $1 !~ /<%/s ) { - print W $1; + $w .= $1; $all = $2; next; } elsif ( $all =~ /^<%=(.*)$/s ) { - print W '<%'; + $w .= '<%'; $all = $1; $mode = 'perlv'; #die; next; } elsif ( $all =~ /^<%(.*)$/s ) { - print W $newline; $newline = "\n"; + $w .= $newline; $newline = "\n"; $all = $1; $mode = 'perlc'; + + #avoid newline prepend fix from borking indented first <% + $w =~ s/\n\s+\z/\n/; + $w .= "\n" if $w =~ /.+\z/; + next; } elsif ( $all !~ /<%/s ) { - print W $all; + $w .= $all; last; } else { warn length($all); die; @@ -43,7 +47,7 @@ foreach $file ( split(/\n/, `find . -depth -print`) ) { } elsif ( $mode eq 'perlv' ) { if ( $all =~ /^(.*?%>)(.*)$/s ) { - print W $1; + $w .= $1; $all=$2; $mode = 'html'; next; @@ -53,13 +57,13 @@ foreach $file ( split(/\n/, `find . -depth -print`) ) { } elsif ( $mode eq 'perlc' ) { if ( $all =~ /^([^\n]*?)%>(.*)$/s ) { - print W "%$1\n"; + $w .= "%$1\n"; $all=$2; $mode='html'; next; } if ( $all =~ /^([^\n]*)\n(.*)$/s ) { - print W "%$1\n"; + $w .= "%$1\n"; $all=$2; next; } @@ -68,5 +72,9 @@ foreach $file ( split(/\n/, `find . -depth -print`) ) { } + system("chmod u+w $file"); + select W; $| = 1; select STDOUT; + open(W,">$file") or die "can't open $file for writing: $!"; + print W $w; close W; } -- cgit v1.2.1