view release on metacpan or search on metacpan
lib/auto/TT2/Play/Area/public/codemirror/mode/tiki/tiki.js view on Meta::CPAN
}
if (err) setStyle = "error";
return cont(endcloseplugin(err));
}
else if (type == "string") {
if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
if (curState.tokenize == inText) popContext();
return cont();
}
else return cont();
}
view all matches for this distribution
view release on metacpan or search on metacpan
&& join($EMPTY_STR,
@{$self->{'data'}}[-2 .. -1])
eq q{--})
# CDATA.
|| ($self->{'tag_type'} =~ /^!\[cdata\[/ms
&& join($EMPTY_STR,
@{$self->{'data'}}[-2 .. -1])
eq ']]')) {
$self->{'stay'} = 98;
Tag types are:
- '[\w:]+' - element name.
- '/[\w:]+' - end of element name.
- '!data' - data
- '![cdata[' - cdata
- '!--' - comment
- '?\w+' - instruction
- '![\w+' - conditional
- '!attlist' - DTD attlist
- '!element' - DTD element
view all matches for this distribution
view release on metacpan or search on metacpan
# Attribute delimeter.
$self->{'attr_delimeter'} = '"';
# Indent CDATA section.
$self->{'cdata_indent'} = 0;
# CDATA callback.
$self->{'cdata_callback'} = undef;
# Data callback.
$self->{'data_callback'} = \&encode_char_entities;
# Callback to instruction.
return;
}
# CData.
sub _put_cdata {
my ($self, @cdata) = @_;
# Flush tmp code.
if (scalar @{$self->{'tmp_code'}}) {
$self->_print_tag('>');
}
# Added begin of cdata section.
unshift @cdata, '<![CDATA[';
# Check to bad cdata.
if ((join $EMPTY_STR, @cdata) =~ /]]>$/ms) {
err 'Bad CDATA section.';
}
# Added end of cdata section.
push @cdata, ']]>';
# Process data callback.
$self->_process_callback(\@cdata, 'cdata_callback');
$self->_newline;
$self->{'preserve_obj'}->save_previous;
# TODO Proc tohle nejde volat primo?
my $tmp = $self->{'indent_block'}->indent(
\@cdata, $self->{'indent'}->get,
$self->{'cdata_indent'} == 1 ? 0 : 1,
);
# To flush code.
$self->_flush_code($tmp);
=item * C<auto_flush>
Auto flush flag.
Default is 0.
=item * C<cdata_indent>
Flag, that means indent CDATA section.
Default value is no-indent (0).
=item * C<cdata_callback>
Subroutine for output processing of cdata.
Input argument is reference to array.
Default value is undef.
Example is similar as 'data_callback'.
=item * C<data_callback>
view all matches for this distribution
view release on metacpan or search on metacpan
# Default parameters.
sub _default_parameters {
my $self = shift;
# CDATA callback.
$self->{'cdata_callback'} = undef;
# Data callback.
$self->{'data_callback'} = undef;
# Document encoding.
unshift @{$self->{'printed_tags'}}, $begin_node;
return;
}
# CData.
sub _put_cdata {
my ($self, @cdata) = @_;
$self->_process_callback(\@cdata, 'cdata_callback');
my $cdata = join($EMPTY_STR, @cdata);
my $cdata_node = $self->{'doc'}->createCDATASection($cdata);
$self->{'printed_tags'}->[0]->addChild($cdata_node);
return;
}
# Comment.
sub _put_comment {
Constructor.
=over 8
=item * C<cdata_callback>
Subroutine for output processing of cdata.
Input argument is reference to array.
Default value is undef.
Example is similar as 'data_callback'.
=item * C<data_callback>
Subroutine for output processing of data, cdata and raw data.
Input argument is reference to array.
Default value is undef.
Example:
'data_callback' => sub {
view all matches for this distribution
view release on metacpan or search on metacpan
unshift @{$self->{'printed_tags'}}, $tag;
return;
}
# CData.
sub _put_cdata {
my ($self, @cdata) = @_;
$self->_put_data(@cdata);
return;
}
# Comment.
sub _put_comment {
view all matches for this distribution
view release on metacpan or search on metacpan
Structure.pm view on Meta::CPAN
return;
}
# CData.
sub _put_cdata {
my ($self, @cdata) = @_;
$self->_put_structure('cd', @cdata);
return;
}
# Comment.
view all matches for this distribution
view release on metacpan or search on metacpan
Data:
a - $attr, $value
b - $element
c - @comment
cd - @cdata
d - @data
e - $element
i - $target, $code
r - @raw_data
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Template/LiquidX/Tidy/impl.pm view on Meta::CPAN
my $nl = $html =~ /\n/;
my @return;
my $last_line_start = 0;
my $start_level = $level;
my $level_change = '';
while ($html =~ m{(?: (?<cdata> <!\[CDATA\[(.*?)\]\]> )
| (?<nl> \n )
| (?<close2> />)
| <(?<close> /)? (?<tag> \w+ )
) }gsx) {
#use Data::Dumper; warn Dumper \%+;
if ($+{cdata}) {
# ignore
}
elsif (length $+{nl}) {
1 while $level_change =~ s/\(\)//;
push @return, [ $start_level - ($level_change =~ y/)//), (substr $html, $last_line_start, (pos $html) - $last_line_start),
view all matches for this distribution
view release on metacpan or search on metacpan
t/05_value-type.t view on Meta::CPAN
<!--BAR-->
</root>
=== cdata x scalar
--- vars
'//text()[2]' => 'xxx > yyy'
--- template
<div>
<![CDATA[ foo > bar ]]>
t/05_value-type.t view on Meta::CPAN
--- expected
<div>
<![CDATA[xxx > yyy]]>
</div>
=== cdata x scalar-ref (TODO)
--- vars
'//text()[2]' => \'<b>xxx</b> > yyy²'
--- template
<root>
<![CDATA[ foo ]]>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[<b>xxx</b> > yyy²]]>
</root>
=== cdata x undef
--- vars
'//text()[2]' => undef
--- template
<root>
<![CDATA[ foo ]]>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
</root>
=== cdata x XML::LibXML::Element
--- vars
use XML::LibXML;
'//text()[2]' => do {
my $elem = XML::LibXML::Element->new('span');
$elem->appendText('foo');
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[<span>foo</span>]]>
</root>
=== cdata x XML::LibXML::Text
--- vars
use XML::LibXML;
'//text()[2]' => XML::LibXML::Text->new('xxx > yyy')
--- template
<root>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[xxx > yyy]]>
</root>
=== cdata x XML::LibXML::Attr
--- vars
use XML::LibXML;
'//text()[2]' => XML::LibXML::Attr->new('class', 'xxx')
--- template
<root>
<![CDATA[ foo ]]>
</root>
--- error
^Can't assign XML::LibXML::Attr to any element
=== cdata x XML::LibXML::Comment
--- vars
use XML::LibXML;
'//text()[2]' => XML::LibXML::Comment->new('xxx')
--- template
<root>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[xxx]]>
</root>
=== cdata x XML::LibXML::CDATASection
--- vars
use XML::LibXML;
'//text()[2]' => XML::LibXML::CDATASection->new('xxx')
--- template
<root>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[xxx]]>
</root>
=== cdata x Template::Semantic::Document
--- vars
'//text()[2]' => Template::Semantic->process(\'<span></span>')
--- template
<root>
<![CDATA[ foo ]]>
</root>
--- error
^Can't assign Template::Semantic::Document to XML::LibXML::CDATASection
=== cdata x hashref
--- vars
'//text()[2]' => {
'/span' => 'xxx',
}
--- template
t/05_value-type.t view on Meta::CPAN
<![CDATA[ foo ]]>
</root>
--- error
^Can't assign hashref to XML::LibXML::CDATASection
=== cdata x list
--- vars
'//text()[2]' => [
{ '/li' => 'AAA' },
{ '/li' => 'BBB' },
]
t/05_value-type.t view on Meta::CPAN
<![CDATA[ foo ]]>
</root>
--- error
^Can't assign loop list to XML::LibXML::CDATASection
=== cdata x sub (using $_)
--- vars
'//text()[2]' => sub { uc }
--- template
<root>
<![CDATA[ foo > bar ]]>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[ FOO > BAR ]]>
</root>
=== cdata x sub (using @_)
--- vars
'//text()[2]' => sub {
my $node = shift;
return ref($node) .'/'. $node->nodeName .'/'. $node->textContent;
}
t/05_value-type.t view on Meta::CPAN
<root>
<![CDATA[ foo ]]>
</root>
--- expected
<root>
<![CDATA[XML::LibXML::CDATASection/#cdata-section/ foo ]]>
</root>
=== cdata x sub (do nothing)
--- vars
'//text()[2]' => sub { \$_ }
--- template
<root>
<![CDATA[ foo > bar ]]>
t/05_value-type.t view on Meta::CPAN
--- expected
<root>
<![CDATA[ foo > bar ]]>
</root>
=== cdata x filter
--- vars
'//text()[2]' => [ ' bar ', sub { uc }, 'trim' ]
--- template
<root>
<![CDATA[ foo ]]>
view all matches for this distribution
view release on metacpan or search on metacpan
termbox2/tests/test_basic/test.php view on Meta::CPAN
$event->h,
$event->x,
$event->y
);
$test->ffi->tb_printf(0, $y++, 0, 0, "out_w=%d", $out_w->cdata);
$test->ffi->tb_present();
$test->screencap();
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-simple/mocha.js view on Meta::CPAN
};
if ('failed' == test.state) {
var err = test.err;
attrs.message = escape(err.message);
console.log(tag('testcase', attrs, false, tag('failure', attrs, false, cdata(err.stack))));
} else if (test.pending) {
console.log(tag('testcase', attrs, false, tag('skipped', {}, true)));
} else {
console.log(tag('testcase', attrs, true) );
}
t/01-simple/mocha.js view on Meta::CPAN
if (content) tag += content + '</' + name + end;
return tag;
}
/**
* Return cdata escaped CDATA `str`.
*/
function cdata(str) {
return '<![CDATA[' + escape(str) + ']]>';
}
}); // module: reporters/xunit.js
view all matches for this distribution
view release on metacpan or search on metacpan
"Matthew Somerville <matthew-github@dracos.co.uk>",
"Michal Sedlák <sedlakmichal@gmail.com>",
"Mohammad S Anwar <mohammad.anwar@yahoo.com>",
"Paul Williams <kwakwaversal@gmail.com>",
"Peter Mottram <peter@sysnix.com>",
"Russell Jenkins <russell.jenkins@strategicdata.com.au>",
"Russell Jenkins <russellj@strategicdata.com.au>",
"Toby <tobyc@strategicdata.com.au>",
"Toby Corkindale <tcorkindale@zendesk.com>",
"Toby Corkindale <tjc@wintrmute.net>",
"Veesh Goldman <rabbiveesh@gmail.com>",
"root <root@altar.int.qindel.com>"
],
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test/XMLElement.pm view on Meta::CPAN
*{$caller.'::number_of_attribs'} = \&number_of_attribs;
*{$caller.'::attrib_value'} = \&attrib_value;
*{$caller.'::attrib_name'} = \&attrib_name;
*{$caller.'::nth_child_name'} = \&nth_child_name;
*{$caller.'::all_children_are'} = \&all_children_are;
*{$caller.'::child_has_cdata'} = \&child_has_cdata;
*{$caller.'::is_descendants'} = \&is_descendants;
*{$caller.'::is_xpath'} = \&is_xpath;
*{$caller.'::is_xpath_count'} = \&is_xpath_count;
$Tst->exported_to($caller);
lib/Test/XMLElement.pm view on Meta::CPAN
$Tst->is_eq($valid_elt->att($name), $value, $msg) ||
$Tst->diag("Element \'",$valid_elt->name,"\' do not have any attribute named $name")
);
}
sub child_has_cdata {
my ($elt, $msg) = @_;
my $valid_elt = _parse($elt,$msg);
return 0 unless $valid_elt;
my @cdata = grep {$_->is_cdata} $valid_elt->children;
return
(
$Tst->ok(scalar(@cdata),$msg) ||
$Tst->diag("Element ",$valid_elt->name," do not have any CDATA")
)
}
sub is_descendants {
lib/Test/XMLElement.pm view on Meta::CPAN
=item all_children_are($xml, $name, $desc);
Test passes if the XML string in C<$xml> contains all direct child element with tag or gi value as C<$name>. Name or Describe the test with C<$desc>.
=item child_has_cdata($xml, $desc);
Test passes if the XML string in C<$xml> contains any CDATA element as its direct child. Name or Describe the test with C<$desc>.
=item is_xpath($xml, $xpath, $desc);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Test2/Harness/Renderer/JUnit.pm view on Meta::CPAN
push @{ $test->{'testcase'} }, $self->xml->testcase(
{ 'name' => "$test_name (TODO)", 'time' => $run_time, 'classname' => $test->{'testsuite'}->{'name'} },
$self->xml->error(
{ 'message' => $todo_message, 'type' => "TodoTestSucceeded" },
$self->_cdata("ok $test_name")
)
);
}
}
lib/Test2/Harness/Renderer/JUnit.pm view on Meta::CPAN
my @jobs = sort { $a->{'job_name'} <=> $b->{'job_name'} } values %{ $self->{'tests'} };
foreach my $job (@jobs) {
print {$fh} $xml->testsuite(
$job->{'testsuite'},
@{ $job->{'testcase'} },
$xml->$out_method( $self->_cdata( $job->{$out_method} ) ),
$xml->$err_method( $self->_cdata( $job->{$err_method} ) ),
) . "\n";
}
print {$fh} "</testsuites>\n";
close $fh;
lib/Test2/Harness/Renderer/JUnit.pm view on Meta::CPAN
my $xml = $self->xml;
push @{ $test->{'testcase'} }, $xml->testcase(
{ 'name' => $fail->{'test_name'}, 'time' => $fail->{'time'}, 'classname' => $test->{'testsuite'}->{'name'} },
$xml->failure(
{ 'message' => $fail->{message}, 'type' => 'TestFailed' },
$self->_cdata( $fail->{'full_message'} ) )
);
delete $test->{'last_failure'};
return;
}
lib/Test2/Harness/Renderer/JUnit.pm view on Meta::CPAN
}
###############################################################################
# Creates a CDATA block for the given data (which is made squeaky clean first,
# so that JUnit parsers like Hudson's don't choke).
sub _cdata {
my ( $self, $data ) = @_;
# When I first added this conditional, I returned $data and at one point it was returning ^A and breaking the xml parser.
return '' if ( !$data or $data !~ m/\S/ms );
return $self->xml->xmlcdata( _squeaky_clean($data) );
}
###############################################################################
# Clean a string to the point that JUnit can't possibly have a problem with it.
sub _squeaky_clean {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Yath/Renderer/JUnit.pm view on Meta::CPAN
push @{ $test->{'testcase'} }, $self->xml->testcase(
{ 'name' => "$test_name (TODO)", 'time' => $run_time, 'classname' => $test->{'testsuite'}->{'name'} },
$self->xml->error(
{ 'message' => $todo_message, 'type' => "TodoTestSucceeded" },
$self->_cdata("ok $test_name")
)
);
}
}
lib/App/Yath/Renderer/JUnit.pm view on Meta::CPAN
my @jobs = sort { $a->{'job_name'} <=> $b->{'job_name'} } values %{ $self->{'tests'} };
foreach my $job (@jobs) {
print {$fh} $xml->testsuite(
$job->{'testsuite'},
@{ $job->{'testcase'} },
$xml->$out_method( $self->_cdata( $job->{$out_method} ) ),
$xml->$err_method( $self->_cdata( $job->{$err_method} ) ),
) . "\n";
}
print {$fh} "</testsuites>\n";
close $fh;
lib/App/Yath/Renderer/JUnit.pm view on Meta::CPAN
my $xml = $self->xml;
push @{ $test->{'testcase'} }, $xml->testcase(
{ 'name' => $fail->{'test_name'}, 'time' => $fail->{'time'}, 'classname' => $test->{'testsuite'}->{'name'} },
$xml->failure(
{ 'message' => $fail->{message}, 'type' => 'TestFailed' },
$self->_cdata( $fail->{'full_message'} ) )
);
delete $test->{'last_failure'};
return;
}
lib/App/Yath/Renderer/JUnit.pm view on Meta::CPAN
}
###############################################################################
# Creates a CDATA block for the given data (which is made squeaky clean first,
# so that JUnit parsers like Hudson's don't choke).
sub _cdata {
my ( $self, $data ) = @_;
# When I first added this conditional, I returned $data and at one point it was returning ^A and breaking the xml parser.
return '' if ( !$data or $data !~ m/\S/ms );
return $self->xml->xmlcdata( _squeaky_clean($data) );
}
###############################################################################
# Clean a string to the point that JUnit can't possibly have a problem with it.
sub _squeaky_clean {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/Corpus/NewYorkTimes/Document.pm view on Meta::CPAN
return $Self->{categories_uncontrolled} if exists $Self->{categories_uncontrolled};
# below is a list of the xpath expressions to get all the hand assigned categories.
my @xpathExpressions =
(
'/nitf/head/docdata/identified-content/classifier[@class="indexing_service" and @type="biographical_categories"]', # 2.2.3 biographic categories
'/nitf/head/docdata/identified-content/classifier[@class="indexing_service" and @type="descriptor"]', # 2.2.15 descriptors
'/nitf/head/docdata/identified-content/location[@class="indexing_service"]', # 2.2.22 locations
'/nitf/head/docdata/identified-content/classifier[@class="indexing_service" and @type="names"]', # 2.2.23 names
'/nitf/head/docdata/identified-content/org[@class="indexing_service"]', # 2.2.34 organizations
'/nitf/head/docdata/identified-content/person[@class="indexing_service"]', # 2.2.36 people
'/nitf/head/docdata/identified-content/object.title[@class="indexing_service"]', # 2.2.45 titles
);
# get the categories.
my @categories;
foreach my $xpathExpression (@xpathExpressions)
lib/Text/Corpus/NewYorkTimes/Document.pm view on Meta::CPAN
return $Self->{categories_controlled} if exists $Self->{categories_controlled};
# below is a list of the xpath expressions to get all the hand assigned categories.
my @xpathExpressions =
(
'/nitf/head/docdata/identified-content/classifier[@class="online_producer" and @type="general_descriptor"]', # 2.2.17 general online descriptors
'/nitf/head/docdata/identified-content/classifier[@class="online_producer" and @type="descriptor"]', # 2.2.26 online descriptors
'/nitf/head/docdata/identified-content/location[@class="online_producer"]', # 2.2.29 online locations
'/nitf/head/docdata/identified-content/org[@class="online_producer"]', # 2.2.30 online organizations
'/nitf/head/docdata/identified-content/person[@class="online_producer"]', # 2.2.31 online people
'/nitf/head/docdata/identified-content/object.title[@class="online_producer"]', # 2.2.33 online titles
);
# get the categories.
my @categories;
foreach my $xpathExpression (@xpathExpressions)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/Embed.pm view on Meta::CPAN
my %def_parse =
(
':underscore' => qr/${NL}__([^_].*[^_])__$NL/,
':define' => qr/${NL}#define\s+?(\S+?)(?:$NL|\s+?$NL|\s+?)/,
':cdata' => sub{$_ = shift or return;
return($$_ =~ m#\s*?<!\[(.+?)\[(.*?)\]\]>\s*#sgo);
},
);
$def_parse{':default'} = $def_parse{':underscore'};
lib/Text/Embed.pm view on Meta::CPAN
#define BAZ baz baz baz
#define FOO foo foo foo
foo foo foo
=item :cdata
Line-agnostic CDATA-like format. Anything outside of tags is ignored.
<![BAZ[baz baz baz]]>
<
cdata : "\n><" /.+?(?=><\n)/so "><" ..."\n"
p : ...!p_terminal "\n" inline(s?)
p_terminal : h3 | "\n<<\n"
# Inline Elements
inline : /[^\n$arg{term}]+/
http : /https?:\/\/[A-Za-z0-9~\/._\?\&=\-%#\+:\;,\@\']+(?::title=[^\]]+)?/
lib/Text/Hatena.pm view on Meta::CPAN
my $tag = $items->[0] ? 'th' : 'td';
my $inlines = $class->expand($items->[1]);
return "<$tag>$inlines</$tag>\n";
}
sub cdata {
my $class = shift;
my $items = shift->{items};
my $data = $items->[1];
return "<$data>\n";
}
view all matches for this distribution
view release on metacpan or search on metacpan
discount-2.2.7d/Plan9/markdown.1 view on Meta::CPAN
Don't allow links.
.TP
.B nohtml
Don't allow any embedded HTML.
.TP
.B cdata
Generate valid XML output.
.TP
.B noheader
Do not process pandoc headers.
.TP
view all matches for this distribution
view release on metacpan or search on metacpan
carton.lock view on Meta::CPAN
"version" : "0.2"
},
"XML::Generator::DOM::util" : {
"file" : "XML/Generator/DOM.pm"
},
"XML::Generator::cdata" : {
"file" : "XML/Generator.pm"
},
"XML::Generator::comment" : {
"file" : "XML/Generator.pm"
},
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/MediawikiFormat.pm view on Meta::CPAN
_append_processed_line $parser, $text, 'nowiki';
}
sub _html_text {
my ( $parser, $dtext, $skipped_text, $is_cdata ) = @_;
my $tagstack = $parser->{tag_stack};
my ( $newtext, $newstate );
warnings::warnif("Got skipped_text: `$skipped_text'")
if $skipped_text;
if (@$tagstack) {
if ( grep /\Q$tagstack->[-1]\E/, qw{nowiki pre} ) {
$newstate = 'nowiki';
}
elsif ( $is_cdata && $HTML::Tagset::isCDATA_Parent{ $tagstack->[-1] } ) {
# If the user hadn't specifically allowed a tag which contains
# CDATA, then it won't be on the tag stack.
$newtext = $dtext;
}
lib/Text/MediawikiFormat.pm view on Meta::CPAN
my $parser = HTML::Parser->new(
start_h => [ \&_html_tag, 'self, "S", tagname, text, attr' ],
end_h => [ \&_html_tag, 'self, "E", tagname, text' ],
comment_h => [ \&_html_comment, 'self, text' ],
text_h => [ \&_html_text, 'self, dtext, skipped_text, is_cdata' ],
marked_sections => 1,
boolean_attribute_value => '__TEXT_MEDIAWIKIFORMAT_BOOL__',
);
$parser->{opts} = $opts;
$parser->{tags} = $tags;
view all matches for this distribution
view release on metacpan or search on metacpan
,'Config::Param' => 3.000000
,'Storable' => 0
},
resources => {
repository => {
url => 'svn://scm.orgis.org/thor/text-numericdata'
,web => 'http://scm.orgis.org/view/thor/text-numericdata'
,type => 'svn'
}
},
add_to_cleanup => [ 'Text-NumericData-*' ],
create_makefile_pl => 'traditional',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/Restructured.pm view on Meta::CPAN
if (! $parser->{_MathML}) {
eval "use Text::ASCIIMathML";
$parser->{_MathML} = new Text::ASCIIMathML unless $@;
}
chomp $text;
my $pcdata = $DOM->newPCDATA("$text\n");
my $math = $parser->{_MathML} ? $DOM->new('mathml') : $pcdata;
my $label_sub;
if ($parser->{_MathML}) {
my %mstyle = (($subst ? () : (displaystyle=>'true')),
($options->{mstyle} ?
%{$parser->HashifyFieldList($options->{mstyle})} :
lib/Text/Restructured.pm view on Meta::CPAN
($text, [title=>$text, xmlns=>"&mathml;",
$label ? (label=>$label) : ()],
[($parser->{opt}{D}{mstyle} ?
@{$parser->{opt}{D}{mstyle}} : ()), @mstyle_attr]);
return if ! defined $math->{attr}{mathml};
$math->append($pcdata);
if ($label) {
$label_sub =
$DOM->new('substitution_definition',
names=>[$parser->NormalizeName($label, 'keepcase')]);
my $counter = ++$parser->{TOPDOM}{equation};
my $pcdata = $DOM->newPCDATA($counter);
my $err = $parser->RegisterName($label_sub, $source, $lineno);
$label_sub->append($pcdata);
$math->{attr}{label} = $counter;
}
}
return $math if $subst;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/SRT/Align.pm view on Meta::CPAN
if (! -e $trgfile){$trgfile.='.gz';}
if (! -e $srcfile){die "$srcfile doesn't exist!\n";}
if (! -e $trgfile){die "$trgfile doesn't exist!\n";}
my @srcdata=();
my @trgdata=();
$srcfreq=undef;
$trgfreq=undef;
my %first=(); # word matches in initial part of the move
my %last=(); # matches in final part of the movie
print STDERR "parse '$srcfile' & '$trgfile' ... " if ($VERBOSE);
&parse_bitext($srcfile,$trgfile,\@srcdata,\@trgdata,\%first,\%last);
print STDERR "ok!\n" if ($VERBOSE);
## fix start and end times (without scaling and offsets)
&set_sent_times(\@srcdata);
&set_sent_times(\@trgdata);
## sort time frames by their starting time
## (strangely enough some subtitles are not chronogologically sorted)
@srcdata = &sort_time_frames(\@srcdata);
@trgdata = &sort_time_frames(\@trgdata);
if (defined $options{HARD_BOUNDARIES}){
&fit_hard_boundaries($options{HARD_BOUNDARIES},\@srcdata,\@trgdata);
}
my $score=undef;
my $baseScore=undef;
print STDERR "align sentences ... " if ($VERBOSE);
if ($COGNATE_RANGE){
if ($VERBOSE){
my $overlap = &time_overlap(\@srcdata,\@trgdata);
print STDERR "time overlap before = $overlap\n"
}
$score = &cognate_align($srcfile,$trgfile,
\@srcdata,\@trgdata,
\%first,\%last,$alignment);
}
if ($options{BEST_ALIGN}){
if ($VERBOSE){
my $overlap = &time_overlap(\@srcdata,\@trgdata);
print STDERR "time overlap before = $overlap\n";
}
($score,$baseScore) =
&best_align($srcfile,$trgfile,
\@srcdata,\@trgdata,
\%first,\%last,$alignment);
}
else{
$score = &standard_align(\@srcdata,\@trgdata,\%first,\%last,$alignment);
}
my $overlap = &time_overlap(\@srcdata,\@trgdata);
print STDERR "time overlap = $overlap\n" if ($VERBOSE);
print STDERR "done!\n" if ($VERBOSE);
if ($baseScore){
print STDERR "ratio = $score ($baseScore)\n" if ($VERBOSE);
lib/Text/SRT/Align.pm view on Meta::CPAN
sub best_align{
my ($srcfile,$trgfile,$srcdata,$trgdata,$first,$last,$alg)=@_;
my %types;
align_srt($srcdata,$trgdata,$alg,\%types);
my $bestratio = $SCORE_PROPORTION ?
($types{nonempty}+1) / ($types{nonempty} + $types{empty} +1) :
($types{nonempty}+1)/($types{empty}+1);
print STDERR "\nratio = " if $VERBOSE;
lib/Text/SRT/Align.pm view on Meta::CPAN
if ($VERBOSE){
print STDERR "use $anchor[0] and $anchor[1] as reference\n";
}
## compute slope and offset for this movie
my ($slope,$offset) = ComputeOffset(\@anchor,$srcdata,$trgdata);
print STDERR "time factor: $slope - offset: $offset\n" if $VERBOSE;
if ($slope<=0){
print STDERR "strange scaling factor -> ignore\n";
next;
}
## re-scale source language subtitles
# set_sent_times($srcdata,$slope,$offset);
synchronize($srcdata,$slope,$offset);
my %types=();
my @newalg=();
align_srt($srcdata,$trgdata,\@newalg,\%types);
my $newratio = $SCORE_PROPORTION ?
($types{nonempty}+1) / ($types{nonempty} + $types{empty} +1) :
($types{nonempty}+1)/($types{empty}+1);
print STDERR "ratio = " if $VERBOSE;
print STDERR $newratio if $VERBOSE;
lib/Text/SRT/Align.pm view on Meta::CPAN
}
sub standard_align{
my ($srcdata,$trgdata,$first,$last,$alg)=@_;
my %types;
align_srt($srcdata,$trgdata,$alg,\%types);
if ($types{empty}*2 > $types{nonempty}){
if (keys %{$first} && keys %{$last}){
&use_anchor_points($srcdata,$trgdata,$first,$last);
}
@{$alg} = ();
&align_srt($srcdata,$trgdata,$alg);
}
my $score = $SCORE_PROPORTION ?
($types{nonempty}+1) / ($types{nonempty} + $types{empty} +1) :
($types{nonempty}+1)/($types{empty}+1);
return $score;
}
sub cognate_align{
my ($srcfile,$trgfile,$srcdata,$trgdata,$first,$last,$alg)=@_;
my $best;
for (my $c=1;$c>$COGNATE_RANGE;$c-=0.05){
$BEST_ALIGN=1;
$USE_COGNATES=$c;
print STDERR "use c=$USE_COGNATES";
&parse_bitext($srcfile,$trgfile,$srcdata,$trgdata,$first,$last);
##
## TODO: Do I need to set starting time and to sort tie frames here again?
##
my @newalg=();
my $new=best_align($srcfile,$trgfile,
$srcdata,$trgdata,
$first,$last,\@newalg);
if ($new>$best){
print STDERR "--> best ($new)";
$best=$new;
@{$alg}=@newalg;
lib/Text/SRT/Align.pm view on Meta::CPAN
sub parse_bitext{
my ($srcfile,$trgfile,$srcdata,$trgdata,$first,$last)=@_;
## first and last sentences (size = WINDOW)
my $srcfirst=[];
my $srclast=[];
lib/Text/SRT/Align.pm view on Meta::CPAN
my $src_count=0;
my $trg_count=0;
if ($StoreXML && (exists $StoredXML{$srcfile})){
# print STDERR "retrieve $srcfile ...\n";
@{$srcdata} = @{ clone($StoredXML{$srcfile}{data}) };
@{$srcfirst} = @{ clone($StoredXML{$srcfile}{first}) };
@{$srclast} = @{ clone($StoredXML{$srcfile}{last}) };
%{$srcfreq} = %{ clone($StoredXML{$srcfile}{freq}) };
$src_count = $StoredXML{$srcfile}{count};
}
else{
my ($src_fh,$src_ph) = init_parser($srcfile,$srcdata);
$srcfreq = $src_ph->{WORDFREQ};
## parse through source language text
while (&ReadNextSentence($src_fh,$src_ph)){
lib/Text/SRT/Align.pm view on Meta::CPAN
$src_count++;
}
## store the data if flag is set
if ($StoreXML){
# print STDERR "store $srcfile ...\n";
$StoredXML{$srcfile}{data} = clone($srcdata);
$StoredXML{$srcfile}{first} = clone($srcfirst);
$StoredXML{$srcfile}{last} = clone($srclast);
$StoredXML{$srcfile}{freq} = clone($srcfreq);
$StoredXML{$srcfile}{count} = $src_count;
}
lib/Text/SRT/Align.pm view on Meta::CPAN
sub use_anchor_points{
my ($srcdata,$trgdata,$first,$last)=@_;
my @sortfirst = sort {$$first{$b} <=> $$first{$a} } keys %{$first};
my @sortlast = sort {$$last{$b} <=> $$last{$a} } keys %{$last};
## I need at least 2 reference points!
lib/Text/SRT/Align.pm view on Meta::CPAN
if ($VERBOSE){
print STDERR "use $fixpoints[0] and $fixpoints[1] as reference\n";
}
## compute slope and offset for this movie
my ($slope,$offset) = ComputeOffset(\@fixpoints,$srcdata,$trgdata);
print STDERR "time factor: $slope - offset: $offset\n" if $VERBOSE;
if ($slope<=0){
print STDERR "strange scaling factor -> ignore\n";
delete $last->{$sortlast[0]};
return use_anchor_points($srcdata,$trgdata,$first,$last);
}
## re-scale source language subtitles
# set_sent_times($srcdata,$slope,$offset);
synchronize($srcdata,$slope,$offset);
}
}
sub fit_hard_boundaries{
lib/Text/SRT/Align.pm view on Meta::CPAN
}
}
sub ComputeOffset{
my ($matches,$srcdata,$trgdata) = @_;
my @params=();
return AverageOffset(\@params) unless (ref($srcdata) eq 'ARRAY');
return AverageOffset(\@params) unless (ref($trgdata) eq 'ARRAY');
foreach my $i (0..$#{$matches}){
foreach my $j ($i+1..$#{$matches}){
my ($s1,$t1) = split(/:/,$$matches[$i]);
my ($s2,$t2) = split(/:/,$$matches[$j]);
next unless (exists $srcdata->[$s1]);
next unless (exists $srcdata->[$s2]);
next unless (exists $trgdata->[$t1]);
next unless (exists $trgdata->[$t2]);
# my $x1=$srcdata->[$s1]->{start};
# my $y1=$trgdata->[$t1]->{start};
# my $x2=$srcdata->[$s2]->{start};
# my $y2=$trgdata->[$t2]->{start};
my $x1=$srcdata->[$s1]->{end};
my $y1=$trgdata->[$t1]->{end};
my $x2=$srcdata->[$s2]->{end};
my $y2=$trgdata->[$t2]->{end};
# print STDERR "fit line from $x1:$y1 to $x2:$y2\n" if $VERBOSE;
my ($slope,$offset)=FitLine($x1,$y1,$x2,$y2);
# print STDERR "time factor=$slope, offset=$offset\n" if $VERBOSE;
lib/Text/SRT/Align.pm view on Meta::CPAN
push(@sorted,$$sent[$s]);
}
return @sorted;
}
=head2 C<time_overlap( \@srcdata, \@trgdata )>
Compute the proportion of overlapping in time between two sets of subtitles.
Returns overlap-ratio = common-time / ( common-time + different-time )
This is similar to time_overlap_ratio but uses the time frames from
subtitle data structures that may be synchronized using lexical anchors.
=cut
sub time_overlap{
my ($srcdata,$trgdata) = @_;
my @srctime = ();
my @trgtime = ();
foreach (0..$#{$srcdata}){
push(@srctime,$$srcdata[$_]{start});
push(@srctime,$$srcdata[$_]{end});
}
foreach (0..$#{$trgdata}){
push(@trgtime,$$trgdata[$_]{start});
push(@trgtime,$$trgdata[$_]{end});
}
view all matches for this distribution
view release on metacpan or search on metacpan
articles/116.html view on Meta::CPAN
The <strong>Data Exporter</strong> and <strong>Data Importer</strong> are found in the <strong>Tools</strong> menu at the top of any page. These tools import and export all of your link and rotator settings so you can reconstruct your setup in a...
<br />
If you want to export your <em>click</em> <em>data</em>, simply click on the UC column of your link or rotator stats, then click on the <span style="color:#009933;"><strong>Download CSV</strong></span> link in the upper right-hand corner:<br />
<br />
<br />
<img src="//cdn.clickmagick.com/images/user/faqs/faq158ucdata.png" /><br />
<br />
<br />
Using these tools you can easily export data from your ClickMagick account for all sorts of purposes, including further analysis in other 3rd-party tools.<br />
<br />
If you specifically want to export IP data, simply download your UC data and use a spreadsheet program to sort the results by IP address.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/XHTML.pm view on Meta::CPAN
maxlength method multiple name nohref rel rev rows rowspan
rules selected shape size src class afor style type title
usemap valign value width)]
);
our @EXPORT_OK = ( qw(text comment attr cdata)
, @{$EXPORT_TAGS{elements}}
, @{$EXPORT_TAGS{attributes}}
);
$EXPORT_TAGS{all} = \@EXPORT_OK;
lib/Text/XHTML.pm view on Meta::CPAN
cellpadding checked codebase cols colspan content coords
disabled enctype height href httpequiv identifier ismap lang
maxlength method multiple name nohref rel rev rows rowspan
rules selected shape size src class afor style type title
usemap valign value width
text comment attr cdata
=head1 AUTHOR
Eugene Grigoriev, C<< <eugene.grigoriev at gmail.com> >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/XML.pm view on Meta::CPAN
our $VERSION = '0.1';
sub pptext ($) { Text::Pretty::text(shift) }
our @EXPORT_OK = qw(elem ielem attr text comment cdata);
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
newtype Text::XML::Attribute;
newtype Text::XML::Element;
lib/Text/XML.pm view on Meta::CPAN
# inline-element( name, [element|Text|CData|Comment] )
sub ielem (*;$$){ Element( Name(shift), shift() || [], shift() || [], 1 ) }
sub attr ($$) { Attribute( Name(shift), shift ) }
sub text ($) { Text(shift) }
sub comment ($) { Comment(shift) }
sub cdata ($) { CData(shift) }
instance Text::Pretty::Print, Text::XML::XML,
pretty => sub
{ my( $doc, %opts ) = @_
; $opts{encoding} = 'UTF-8' unless defined $opts{encoding}
lib/Text/XML.pm view on Meta::CPAN
XML combinators and pretty printer.
More documentation is coming.
=head1 EXPORT
elem ielem attr text comment cdata
=head1 AUTHOR
Eugene Grigoriev, C<< <eugene.grigoriev at gmail.com> >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Text/vFile/toXML.pm view on Meta::CPAN
push @{ $result{lc $type} }, +{
convert($objects),
map {
my $propname = $_;
lc $propname => [ map { my ($p, $v) = @$_{qw(param value)}; +{
_cdata => $v,
_attrs => +{ map { $attrs{lc $_} || lc $_ => $p->{$_} } keys %$p } }
} @{ $props->{$propname} } ]
} keys %$props
};
}
view all matches for this distribution
view release on metacpan or search on metacpan
# Taiwan
# From smallufo (2010-04-03):
# According to Taiwan's CWB [Central Weather Bureau],
# http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm
# Taipei has DST in 1979 between July 1st and Sep 30.
# From Yu-Cheng Chuang (2013-07-12):
# On Dec 28, 1895, the Meiji Emperor announced Ordinance No. 167 of
# Meiji Year 28 "The clause about standard time", mentioned that
view all matches for this distribution
view release on metacpan or search on metacpan
pTk/mTk/additions/imgWindow.c view on Meta::CPAN
Tk_Window tkwin;
int fileWidth, fileHeight, i, depth, ncolors, nBytes, x, y;
char *name;
#ifndef __WIN32__
XImage *ximage;
ColormapData cdata;
#else
# undef XGetPixel
# define XGetPixel(P,X,Y) GetPixel(P, X, Y)
TkWinDCState DCi;
HDC ximage;
pTk/mTk/additions/imgWindow.c view on Meta::CPAN
* pixel values and RGB values. The code below should work
* for all Visual types.
*/
ncolors = visual->map_entries;
cdata.colors = (XColor *) ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
if (visual->class == DirectColor || visual->class == TrueColor) {
cdata.separated = 1;
cdata.red_mask = visual->red_mask;
cdata.green_mask = visual->green_mask;
cdata.blue_mask = visual->blue_mask;
cdata.red_shift = 0;
cdata.green_shift = 0;
cdata.blue_shift = 0;
while ((0x0001 & (cdata.red_mask >> cdata.red_shift)) == 0)
cdata.red_shift ++;
while ((0x0001 & (cdata.green_mask >> cdata.green_shift)) == 0)
cdata.green_shift ++;
while ((0x0001 & (cdata.blue_mask >> cdata.blue_shift)) == 0)
cdata.blue_shift ++;
for (i = 0; i < ncolors; i ++)
cdata.colors[i].pixel =
((i << cdata.red_shift) & cdata.red_mask) |
((i << cdata.green_shift) & cdata.green_mask) |
((i << cdata.blue_shift) & cdata.blue_mask);
} else {
cdata.separated=0;
for (i = 0; i < ncolors; i ++) cdata.colors[i].pixel = i;
}
cdata.color = !(visual->class == StaticGray || visual->class == GrayScale);
XQueryColors(Tk_Display(tkwin), cmap, cdata.colors, ncolors);
#endif
Tk_PhotoExpand(imageHandle, destX + width, destY + height);
block.offset[0] = 0;
block.offset[3] = 0;
#ifndef __WIN32__
if (cdata.color) {
#endif
block.pixelSize = 3;
block.offset[1] = green = 1;
block.offset[2] = blue = 2;
#ifndef __WIN32__
pTk/mTk/additions/imgWindow.c view on Meta::CPAN
p = block.pixelPtr;
for (y = 0; y<height; y++) {
for (x = 0; x<width; x++) {
unsigned long pixel = XGetPixel(ximage, x, y);
#ifndef __WIN32__
if (cdata.separated) {
int r = (pixel & cdata.red_mask) >> cdata.red_shift;
p[0] = cdata.colors[r].red >> 8;
if (cdata.color) {
int g = (pixel & cdata.green_mask) >> cdata.green_shift;
int b = (pixel & cdata.blue_mask) >> cdata.blue_shift;
p[1] = cdata.colors[g].green >> 8;
p[2] = cdata.colors[b].blue >> 8;
}
} else {
p[0] = cdata.colors[pixel].red >> 8;
if (cdata.color) {
p[1] = cdata.colors[pixel].green >> 8;
p[2] = cdata.colors[pixel].blue >> 8;
}
}
#else
p[0] = GetRValue(pixel);
p[1] = GetGValue(pixel);
pTk/mTk/additions/imgWindow.c view on Meta::CPAN
Tk_PhotoPutBlock(imageHandle, &block, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET);
#ifndef __WIN32__
XDestroyImage(ximage);
ckfree((char *) cdata.colors);
#else
# undef XGetPixel
TkWinReleaseDrawableDC(Tk_WindowId(tkwin), ximage, &DCi);
#endif
ckfree((char *) block.pixelPtr);
view all matches for this distribution