diff paper/md2tex.pl @ 10:d43b107ad199

fix new line encode
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 30 Apr 2020 14:23:51 +0900
parents 8f1d03a81516
children dff5f09c28c7
line wrap: on
line diff
--- a/paper/md2tex.pl	Thu Apr 30 13:26:49 2020 +0900
+++ b/paper/md2tex.pl	Thu Apr 30 14:23:51 2020 +0900
@@ -1,25 +1,31 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
+use utf8;
+
+my $source_md = shift;
+my $target_tex = shift;
+
+open my $texFH, '>', $target_tex;
 
 {
   open my $fh, '<', 'md2tex/first.tex';
   while (my $line = <$fh> ) {
-    print "$line";
+    print $texFH $line;
   }
   close $fh;
 }
 
-open my $fh, '<', 'anatofuz-sigos.md';
+open my $fh, '<', $source_md;
 while (my $line = <$fh>) {
   if ($line =~/^#/) {
     $line =~ s/# (.*)/\\section{$1}/;
   }
-  print $line;
+  print $texFH $line;
 }
 close $fh;
 
-print <<'EOF';
+print $texFH  <<'EOF';
 
 \nocite{*}
 \bibliographystyle{ipsjunsrt}
@@ -28,3 +34,6 @@
 
 \end{document}
 EOF
+
+
+close $texFH;