mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit 8cb0bd2c86d5aaf75ba43720549ac6c406f23e15
parent 8f1ab3afbdcb045ea3f67ab0a524a6e076565219
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Fri, 27 Sep 2013 16:51:06 +0200

support for ```

Diffstat:
shorthand.pl | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/shorthand.pl b/shorthand.pl @@ -3,6 +3,7 @@ # Convert my shorthand to beamer my $escaping = 0; +my $codeescape = 0; my $in_frame = 0; my @env = qw(); my @envd = qw(); @@ -71,8 +72,13 @@ END print $header; +my $defaultlang = ""; + while (<>) { last if /^$/; + if (/^\\usepackage\[[^]]*,([^\],]*)\]{babel}/) { + $defaultlang = $1; + } print; } @@ -88,6 +94,16 @@ while (<>) { } next; } + if ($codeescape) { + if ($l =~ /^```$/) { + $codeescape = 0; + print "\\end{minted}\n"; + print "\\end{otherlanguage}\n" if length($defaultlang) > 0; + } else { + print $l; + } + next; + } if ($l =~ /^<\?$/) { $escaping = 1; next; @@ -126,6 +142,12 @@ while (<>) { print "\\pause\n"; next; } + if ($l =~ /^```(.*)$/) { + print "\\begin{otherlanguage}{english}\n" if length($defaultlang) > 0; + print "\\begin{minted}{$1}\n"; + $codeescape = 1; + next; + } if ($l =~ /^$/) { while (@env > 0) { my $e = pop @env;