diff --git a/LDP/lampadas/www/document_edit.pl b/LDP/lampadas/www/document_edit.pl index 38008185..a993fa82 100755 --- a/LDP/lampadas/www/document_edit.pl +++ b/LDP/lampadas/www/document_edit.pl @@ -240,7 +240,7 @@ print "\n"; - print "Comments: \n"; + + + $tempfile = "/tmp/document_wiki" . rand(); + open (TMP, "> $tempfile"); + print TMP $wiki; + close(TMP); + + open (TMP, $tempfile); + $wiki = ""; + $section = 0; + while ($line = ) { + if ($splitup) { + if ($line =~ /^===/) { + } elsif ($line =~ /^==/) { + } elsif ($line =~ /^=/) { + &printwiki; + } + } + $wiki .= $line; + } + close TMP; + unlink $tempfile; + &printwiki; + print "Comments: \n"; if ($revisions == 0) { print "There are no previous versions of this document. Your changes will be saved as version $revision\n"; } else { print "You are editing version $revisions. Your changes will be saved as version $revision\n"; } print "\n"; - print "\n"; - print "\n"; - print "\n"; print "\n"; print end_html; } if ($preview or $docbook) { - $txtfile = "$workpath/" . rand . ".txt"; + $txtfile = "/tmp/" . rand() . ".txt"; $sgmlfile = $txtfile; $sgmlfile =~ s/\.txt/\.sgml/; $htmlfile = $txtfile; @@ -141,15 +205,16 @@ if ($preview or $docbook) { $abstractfile =~ s/\./abs\./; $abstractsgmlfile = $sgmlfile; $abstractsgmlfile =~ s/\./abs\./; - system("rm $sgmlfile"); open(TXT, "> $txtfile"); print TXT $wiki; close(TXT); - $cmd = "/usr/lib/cgi-bin/gldp.org/txt2db.pl -o $sgmlfile $txtfile"; + $cmd = "/usr/local/bin/wt2db -o $sgmlfile $txtfile"; system($cmd); - + + print LOG "Wrote wt file to $txtfile for document $doc_id by $username.\n"; + $sgml = '' . "\n"; if ($class eq 'FAQ') { $sgml .= "
\n"; @@ -170,7 +235,7 @@ if ($preview or $docbook) { print ABSTRACT $abstract; close(ABSTRACT); - $cmd = "/usr/lib/cgi-bin/gldp.org/txt2db.pl -o $abstractsgmlfile $abstractfile"; + $cmd = "/usr/local/bin/wt2db -o $abstractsgmlfile $abstractfile"; system($cmd); $abstract = ""; @@ -202,10 +267,15 @@ if ($preview or $docbook) { $sgml .= "\n"; + print LOG "Opening sgml file $sgmlfile for document $doc_id by $username.\n"; + + $sgmlfileline = 0; open(SGML, $sgmlfile); while () { + print LOG "."; $line = $_; $sgml .= $line; + $sgmlfileline++; while ($line =~ /$line"; } close(SGML); + print LOG "\n"; + print LOG "Read $sgmlfileline lines from $sgmlfile for document $doc_id by $username.\n"; + $sgml .= "
\n"; open(SGML, "> $sgmlfile"); print SGML $sgml; close(SGML); + + print LOG "Wrote composite sgml file $sgmlfile for document $doc_id by $username.\n"; + } if ($docbook) { @@ -230,19 +306,23 @@ if ($docbook) { print "Content-Type: text/plain; charset=ISO-8859-1\n\n"; - while ($sgml =~ /\/) { - $sgml =~ s/\>/>/; - } +# while ($sgml =~ //) { +# $sgml =~ s/>/>/; +# } print $sgml; # print "\n"; # print "\n"; - } if ($preview) { + + print LOG "Previewing $sgmlfile for document $doc_id by $username.\n"; + + print LOG "Running xsltproc on $sgmlfile, into $htmlfile.\n"; + $cmd = "xsltproc --docbook /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/html/docbook.xsl $sgmlfile > $htmlfile"; system($cmd); @@ -252,11 +332,12 @@ if ($preview) { while () { $line = $_; $i += 1; -# if ($i > 8) { - print $line; -# } + print $line; } close(HTML); + + print LOG "HTML display of $htmlfile complete.\n"; + } @@ -277,3 +358,18 @@ sub printheader { print " | "; print "Version History\n"; } + +sub printwiki { + if (($wiki) or ($section == 0)) { + $section++; + print "Section $section\n"; + print "\n"; + if ($section == $section_max) { + print "Aborting due to loop control.\n"; + last; + } + $wiki = ""; + } +} + + diff --git a/LDP/lampadas/www/navbar.pl b/LDP/lampadas/www/navbar.pl index b5f73363..730eb4fa 100755 --- a/LDP/lampadas/www/navbar.pl +++ b/LDP/lampadas/www/navbar.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl - +# +# Generates a navigation bar suitable for display across the top or bottom of a page. +# use CGI qw(:standard); use Pg;