NAME Locale::TextDomain::OO::Extract::HTML - Extracts internationalization data from HTML

$Id: HTML.pm 683 2017-08-22 18:41:42Z steffenw $

$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/extract/trunk/lib/Locale/TextDomain/OO/Extract/HTML.pm $

VERSION

2.007

DESCRIPTION

This module extracts internationalization data from HTML.

Implemented rules:

Gettext::Loc

<any_tag ... class="... loc_ ..." ... >text to extract<
<any_tag ... class="... loc_ ..." ... >context{CONTEXT_SEPARATOR}text to extract<

Gettext

<any_tag ... class="... __ ..." ... >text to extract<
<any_tag ... class="... __ ..." ... >context{CONTEXT_SEPARATOR}text to extract<

Maketext

<any_tag ... class="... loc ..." ... >text to extract<
<any_tag ... class="... loc ..." ... >context{CONTEXT_SEPARATOR}text to extract<

Whitespace is allowed everywhere.

SYNOPSIS

use Locale::TextDomain::OO::Extract::HTML;
use Path::Tiny qw(path);

my $extractor = Locale::TextDomain::OO::Extract::HTML->new;
for ( @files ) {
    $extractor->clear;
    $extractor->filename($_);            # dir/filename for reference
    $extractor->content_ref( \( path($_)->slurp_utf8 ) );
    $exttactor->category('LC_Messages'); # set defaults or q{} is used
    $extractor->domain('default');       # set defaults or q{} is used
    $extractor->extract;
}
... = $extractor->lexicon_ref;

SUBROUTINES/METHODS

method new

All parameters are optional. See Locale::TextDomain::OO::Extract to replace the defaults.

my $extractor = Locale::TextDomain::OO::Extract::HTML->new;

method preprocess (called by method extract)

Remove code between <!-- -->

$extractor->preprocess;

method stack_item_mapping (called by method extract)

$extractor->stack_item_mapping;

method extract

This method runs the extraction.

$extractor->extract;

EXAMPLE

Inside of this distribution is a directory named example. Run this *.pl files.

DIAGNOSTICS

none

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Moo

MooX::Types::MooseLike::Base

namespace::autoclean

Locale::TextDomain::OO::Extract::Base::RegexBasedExtractor

Locale::TextDomain::OO::Extract::Role::File

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin::OO

HTML::Zoom

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2014 - 2017, Steffen Winkler <steffenw at cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.