Mercurial > hg > Papers > 2020 > anatofuz-sigos
comparison paper/md2tex.pl @ 24:d2a1d3d75484
...
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 04 May 2020 14:31:06 +0900 |
parents | 2be09c284a2e |
children | 5dbe39f52406 |
comparison
equal
deleted
inserted
replaced
23:2be09c284a2e | 24:d2a1d3d75484 |
---|---|
24 if ($line =~ /^```/) { | 24 if ($line =~ /^```/) { |
25 $in_codeblock = !$in_codeblock; | 25 $in_codeblock = !$in_codeblock; |
26 if (!$in_codeblock) { | 26 if (!$in_codeblock) { |
27 $line = '\end{lstlisting}' ."\n"; | 27 $line = '\end{lstlisting}' ."\n"; |
28 } | 28 } |
29 if ($line =~ /``` (.*),\s*(.*)/) { | 29 if ($line =~ /``` lab:(.*),\s*cap:(.*)/) { |
30 $line = '\b'."egin{lstlisting}[frame=lrbt,label=$1,caption={$2}]\n"; | 30 $line = '\b'."egin{lstlisting}[frame=lrbt,label=$1,caption={$2}]\n"; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 if ($in_codeblock) { | 34 if ($in_codeblock) { |
44 my $inlineCodeBlock = $1; | 44 my $inlineCodeBlock = $1; |
45 $inlineCodeBlock =~ s/_/\\_/g; | 45 $inlineCodeBlock =~ s/_/\\_/g; |
46 $line =~ s/`([\s\w_\-\\]+)`/\\texttt{$inlineCodeBlock}/; | 46 $line =~ s/`([\s\w_\-\\]+)`/\\texttt{$inlineCodeBlock}/; |
47 } | 47 } |
48 | 48 |
49 if ($line =~ /!\[(.*),\s*(.*)\]\((.*)\)/) { | 49 if ($line =~ /!\[lab:(.*),\s*cap:(.*)\]\((.*)\)/) { |
50 $line = <<"EOF"; | 50 $line = <<"EOF"; |
51 \\begin{figure}[tb] | 51 \\begin{figure}[tb] |
52 \\begin{center} | 52 \\begin{center} |
53 \\includegraphics[width=70mm]{$3} | 53 \\includegraphics[width=70mm]{$3} |
54 \\end{center} | 54 \\end{center} |
56 \\label{$1} | 56 \\label{$1} |
57 \\end{figure} | 57 \\end{figure} |
58 EOF | 58 EOF |
59 } | 59 } |
60 | 60 |
61 if ($line =~ /^\[(.*),\s*(.*)\]\((.*)\)/) { | 61 if ($line =~ /^\[lab:(.*),\s*cap:(.*)\]\((.*)\)/) { |
62 $line = '\l' ."stinputlisting[label=$1, caption={$2}]{$3}\n"; | 62 $line = '\l' ."stinputlisting[label=$1, caption={$2}]{$3}\n"; |
63 } | 63 } |
64 print $texFH $line; | 64 print $texFH $line; |
65 } | 65 } |
66 close $fh; | 66 close $fh; |