URI:
       gen_cache.pl - flashcards - Stupid LaTeX flashcard viewer
  HTML git clone git://lumidify.org/flashcards.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/git/flashcards.git (encrypted, but very slow)
  HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/flashcards.git (over tor)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
       gen_cache.pl (736B)
       ---
            1 #!/usr/bin/env perl
            2 
            3 use strict;
            4 use warnings;
            5 use utf8;
            6 use open qw< :encoding(UTF-8) >;
            7 binmode(STDOUT, ":utf8");
            8 use File::Compare;
            9 use File::Copy;
           10 
           11 if ($#ARGV != 0) {
           12         die "USAGE: ./gen_cache.pl <path_to_new_flashcards>\n";
           13 }
           14 
           15 my $path = shift;
           16 opendir my $dir, "$path/flashcards/" or die "ERROR: Failed to open flashcard directory!\n";
           17 while (my $filename = readdir($dir)) {
           18         next if ($filename =~ /\A\.\.?\z/);
           19         next if (-e "latex/$filename" && compare("latex/$filename", "$path/flashcards/$filename") == 0);
           20         if (system("./render_card.sh", "$path/flashcards/$filename", "$path/defs.tex") != 0) {
           21                 die "Error processing file $path/flashcards/$filename";
           22         }
           23         copy "$path/flashcards/$filename", "latex/$filename";
           24 }
           25 closedir $dir;