[LON-CAPA-cvs] cvs: doc /help texxml2latex.pl

bowersj2 lon-capa-cvs@mail.lon-capa.org
Fri, 18 Jul 2003 20:58:33 -0000


bowersj2		Fri Jul 18 16:58:33 2003 EDT

  Modified files:              
    /doc/help	texxml2latex.pl 
  Log:
  Change default heading level to work better; escape pipes in RE 
  expression as explained in comments.
  
  
Index: doc/help/texxml2latex.pl
diff -u doc/help/texxml2latex.pl:1.5 doc/help/texxml2latex.pl:1.6
--- doc/help/texxml2latex.pl:1.5	Fri Jul 18 16:42:27 2003
+++ doc/help/texxml2latex.pl	Fri Jul 18 16:58:33 2003
@@ -81,13 +81,19 @@
 	    my $file = $attr->{'file'};
 	    my $section = $attr->{'section'};
 	    if (!defined($section)) { $section = ''; }
-	    else { $section = "-section $section"; }
+	    else { 
+		$section = "-section $section";
+		# Escape the pipes so they are considered ORs in the
+		# RE for podselect's "section" option, and not 
+		# pipes by the shell:
+		$section =~ s/\|/\\\|/g;
+	    }
 	    $file = '../../loncom/' . $file;
 	    my $tempfile = 't' . substr($file, rindex($file, '/') + 1);
 	    system ("cp $file $tmpdir");
 	    # The "echo" command is necessary; pod2latex can't
 	    # handle a perl file that *starts* with pod.
-	    system ("echo > $tmpdir/$tempfile; cat $file | podselect $section >> $tmpdir/$tempfile; cd $tmpdir; pod2latex $tempfile");
+	    system ("echo > $tmpdir/$tempfile; cat $file | podselect $section >> $tmpdir/$tempfile; cd $tmpdir; pod2latex -h1level 2 $tempfile");
 	    my $latexFile = substr($tempfile, 0, rindex($tempfile, '.')) . '.tex';
 	    open LATEX_FILE, $tmpdir . '/' . $latexFile;
 	    print <LATEX_FILE>;