ogajduse / rpms / texlive

Forked from rpms/texlive 5 years ago
Clone
Blob Blame History Raw
--- latexpand.old	2015-12-14 14:51:31.175864811 -0500
+++ latexpand	2015-12-14 14:52:58.631365447 -0500
@@ -83,7 +83,7 @@ sub process_file
 		# ignored by LaTeX, but we don't allow anything before
 		# to avoid e.g. \verb|\end{document}| from terminating
 		# the file.
-		if (!$keep_comments && $line =~ /^[ \t]*\\end{document}/) {
+		if (!$keep_comments && $line =~ /^[ \t]*\\end\{document}/) {
 		    last;
 		}
 	}
@@ -92,7 +92,8 @@ sub process_file
 
 sub process_line
 {
-	my ($_, $prefix) = @_;
+	my ($line, $prefix, $file) = @_;
+	$_ = $line;
 	unless ($keep_comments) {
 		if ($empty_comments) {
 			s/^%.*$/%/;
@@ -134,7 +135,7 @@ sub process_line
 	if ($expand_usepackage) {
 		# Don't bother with before and after text, we just require the
 		# usepackage to be alone on its line.
-		if (my ($package_name) = /^\s*\\usepackage{([^}]*)}\s*$/) {
+		if (my ($package_name) = /^\s*\\usepackage\{([^}]*)}\s*$/) {
 			my $full = find_file($package_name . ".sty", $TEXINPUTS);
 			if ($full) {
 				say $prefix . "Found package file: $full\n";
@@ -147,7 +148,7 @@ sub process_line
 	}
 	if ($expand_bbl) {
 		if (my ($before, $bib_name, $after)
-			 = /^(.*)\\bibliography{([^}]*)}(.*)$/) {
+			 = /^(.*)\\bibliography\{([^}]*)}(.*)$/) {
 			# The BBL file is not necessarily $bib_name.
 			# Take it from the command-line.
 			print $before . $nl;