Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add todo, turn doc to template using new system.

  • Loading branch information...
commit de74cf7d5379e5b35c7a8bc524af27b012617106 1 parent 57365a8
@benkasminbullock authored
View
13 Makefile.PL
@@ -2,13 +2,18 @@ use strict;
use warnings;
use ExtUtils::MakeMaker;
-my $pm = 'lib/Data/Kanji/KanjiVG.pm';
-my $repo = 'https://github.com/benkasminbullock/Data-Kanji-KanjiVG';
+my $name = 'Data::Kanji::KanjiVG';
+my $pm = "lib/$name.pm";
+$pm =~ s!::!/!g;
+my $pod = $pm;
+$pod =~ s!\.pm$!.pod!;
+my $repo = "https://github.com/benkasminbullock/$name";
+$repo =~ s!::!-!g;
WriteMakefile (
- NAME => 'Data::Kanji::KanjiVG',
+ NAME => $name,
VERSION_FROM => $pm,
- ABSTRACT_FROM => $pm,
+ ABSTRACT_FROM => $pod,
AUTHOR => 'Ben Bullock <bkb@cpan.org>',
LICENSE => 'perl',
PREREQ_PM => {
View
4 build.pl
@@ -2,4 +2,6 @@
use warnings;
use strict;
use Perl::Build;
-perl_build;
+perl_build (
+ pod => ['lib/Data/Kanji/KanjiVG.pod'],
+);
View
8 doc/0TODO
@@ -0,0 +1,8 @@
+Things to do:
+
+Update/download feature for original data.
+
+Add to SQLite database module (submodule).
+
+Parsing of either format of data (new/old).
+
View
2  lib/Data/Kanji/.gitignore
@@ -0,0 +1,2 @@
+# Output of template.
+*.pod
View
91 lib/Data/Kanji/KanjiVG.pm
@@ -1,8 +1,3 @@
-=head1 NAME
-
-Data::Kanji::KanjiVG - parse KanjiVG kanji data.
-
-=cut
package Data::Kanji::KanjiVG;
require Exporter;
@ISA = qw(Exporter);
@@ -13,91 +8,6 @@ our $VERSION = 0.02;
use XML::Parser::Expat;
use Carp;
-=head2 parse
-
- parse (
- file_name => $file_name,
- callback => $callback,
- callback_data => $callback_data,
- );
-
-Parse the file specified by C<$file_name>. As a complete piece of
-kanji data is achieved, call C<$callback> in the following form:
-
- &{$callback} ($callback_data, $kanji);
-
-Possible arguments are
-
-=over
-
-=item file_name
-
-Give the name of the file to parse.
-
-=item callback
-
-Give a function to call back each time a complete piece of kanji
-information is parsed.
-
-=item callback_data
-
-An optional piece of data to pass to the callback function.
-
-=item flatten
-
-A boolean. If it is false (or if it is omitted), the kanji information
-is sent as a complete hash reference. If it is true, the kanji
-information is sent as an array reference containing the paths.
-
-=back
-
-If the data is not flattened using C<flatten>, C<$kanji> is a hash
-reference containing the following fields:
-
-=over
-
-=item id
-
-The identification number of the kanji.
-
-=item g
-
-A group of strokes of the kanji. This contains the following sub-fields:
-
-=over
-
-=item paths
-
-An array reference to strokes or groups of strokes. Each element
-contains its type and attributes.
-
-=back
-
-=back
-
-Each path is a single stroke of the kanji. This hash reference contains the
-following sub-fields:
-
-=over
-
-=item id
-
-The stroke's identification number.
-
-=item type
-
-The type of the stroke, a field describing the general shape of the
-stroke.
-
-=item d
-
-The SVG path information. This information is a string. To parse it,
-the module L<Image::SVG::Path> may be useful.
-
-=back
-
-=cut
-
sub parse
{
my (%inputs) = @_;
@@ -250,3 +160,4 @@ sub follow
}
1;
+
View
125 lib/Data/Kanji/KanjiVG.pod.tmpl
@@ -0,0 +1,125 @@
+=head1 NAME
+
+Data::Kanji::KanjiVG - parse KanjiVG kanji data.
+
+=head1 SYNOPSIS
+
+ parse (xml => $xml, callback => \& callback);
+
+Parse a piece of kanjivg data and call C<callback> as each piece is
+parsed.
+
+ parse (
+ file_name => $kanjivg_file,
+ callback => \& callback,
+ flatten => 1,
+ );
+
+Parse the file of kanji vg data, and as each complete <kanji> element
+is parsed, flatten it out into an array reference, then call back the
+function "callback" as each piece of data is parsed,
+
+=head1 DESCRIPTION
+
+This Perl library is for handling the data files generated by the
+"KanjiVG project". The KanjiVG project is a project to create vector
+graphic descriptions of Kanji (Japanese versions of Chinese
+characters). This Perl library is intended to parse the output XML
+files of the KanjiVG project.
+
+=head1 FUNCTIONS
+
+
+=head2 parse
+
+ parse (
+ file_name => $file_name,
+ callback => $callback,
+ callback_data => $callback_data,
+ );
+
+ parse (
+ xml => $xml_text,
+ callback => $callback,
+ callback_data => $callback_data,
+ );
+
+Parse the file specified by C<file_name> or C<xml>. As a complete
+piece of kanji data is achieved, call C<$callback> in the following
+form:
+
+ &{$callback} ($callback_data, $kanji);
+
+Possible arguments are
+
+=over
+
+=item file_name
+
+Give the name of the file to parse.
+
+=item callback
+
+Give a function to call back each time a complete piece of kanji
+information is parsed.
+
+=item callback_data
+
+An optional piece of data to pass to the callback function.
+
+=item flatten
+
+A boolean. If it is false (or if it is omitted), the kanji information
+is sent as a complete hash reference. If it is true, the kanji
+information is sent as an array reference containing the paths.
+
+=back
+
+If the data is not flattened using C<flatten>, C<$kanji> is a hash
+reference containing the following fields:
+
+=over
+
+=item id
+
+The identification number of the kanji.
+
+=item g
+
+A group of strokes of the kanji. This contains the following sub-fields:
+
+=over
+
+=item paths
+
+An array reference to strokes or groups of strokes. Each element
+contains its type and attributes.
+
+=back
+
+=back
+
+Each path is a single stroke of the kanji. This hash reference contains the
+following sub-fields:
+
+=over
+
+=item id
+
+The stroke's identification number.
+
+=item type
+
+The type of the stroke, a field describing the general shape of the
+stroke.
+
+=item d
+
+The SVG path information. This information is a string. To parse it,
+the module L<Image::SVG::Path> may be useful.
+
+=back
+
+=cut
+
+[% INCLUDE "author" %]
Please sign in to comment.
Something went wrong with that request. Please try again.