Anki-Import
view release on metacpan or search on metacpan
lib/Anki/Import.pm view on Meta::CPAN
. '/anki_import_files directory');
}
# fin
}
# functions for first pass parsing of source data
sub validate_src_file {
logi('Validating source file');
# throw error if file is empty
logf('Source data file is empty.') if !$lines[0];
# outer loop for parsing notes
my %fields; # keeps track of number of fields for each type of note
while (next_line()) {
# ignore blank lines
next if ($cline =~ /^$|^\s+$/);
if ($cline =~ /^#\s*(\S+)/) {
lib/Anki/Import.pm view on Meta::CPAN
those that exist in your Anki database to make importing the notes easier.
Note type comments not only assign a note type to the next note, but any
notes therafter until a new note type comment is encountered (see the example
in the next section). So note type comments actually delineate a note type
section. If no note types are indicated in your source file, the
"Basic" note type is used.
Note types are used to help C<Anki::Import> ensure other notes of the same type
have the same number of fields. If the notes assigned to a particular note type
do not all have the same number of fields, an error is thrown so be sure each
note has the correct number of fields.
Note: note type sections can be split across the file (i.e. you do not have to
group the notes of a particular note type together).
=head3 Tagging notes
Place your space seprated lit of tags in the last field. As long as there is
one more field in the source files that fields in the note you are importing
to, Anki will generate tags from the last field.
( run in 0.289 second using v1.01-cache-2.11-cpan-496ff517765 )