CSS-Inliner-4018/000755 000765 000024 00000000000 14400737264 014447 5ustar00kamelkevstaff000000 000000 CSS-Inliner-4018/ChangeLog000644 000765 000024 00000033503 14400737125 016221 0ustar00kamelkevstaff000000 000000 2304 2009-10-08 Kevin Kamel * Initial release to world. 2307 2009-10-08 Kevin Kamel * Tweaks to do correct release to CPAN 2534 2010-01-26 Kevin Kamel * Updates by Vivek Khera (vivek@khera.org) - Remove comment stripping of HTML passed through the Inliner 2536 2010-04-26 Kevin Kamel * Suggested update by Vivek Khera (vivek@khera.org) - adjust TreeParser to override skippable end tags * Adjust TreeParser to allow html comments to persist through processing 2540 2010-04-27 Kevin Kamel * Include a number of updates as suggested by Michael Peters - do not skip over style blocks with undefined media types - add feature to take previously defined HTML::TreeParser so users can modify the parameters the TreeParser has - skip css psuedo attributes that cannot be inlined 2544 2010-04-27 Kevin Kamel * Update the regex for skipping over non-inlineable psuedo attributes * In addition to skipping psuedo attributes, skip over @, like @import 2669 2010-08-19 Kevin Kamel * Include a number of contributions from Michael Peters - do not die if there is no style container within passed document - do not die if comments are encountered within

Howdy!

Let's Play

Got any games?

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html1 }); my $inlined1 = $inliner->inlinify(); ok($inlined1, 'Leading whitespace psuedo rule processed correctly'); my $html2 = < Test Document

Howdy!

Let's Play

Got any games?

END $inliner->read({ html => $html2 }); my $inlined2 = $inliner->inlinify(); ok($inlined2, 'No whitespace psuedo rule processed correctly'); CSS-Inliner-4018/t/important.t000644 000765 000024 00000001203 14400736560 017106 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; plan(tests => 2); use_ok('CSS::Inliner'); my $html = < Test Document

Howdy!

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, '!important applied correctly'); CSS-Inliner-4018/t/pseudotest.t000644 000765 000024 00000001435 14400736560 017277 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; use FindBin qw($Bin); plan(tests => 2); my @warnings = (); BEGIN { $SIG{'__WARN__'} = sub { push @warnings, $_[0] } } my $html_path = "$Bin/html/"; my $test_file = $html_path . 'pseudotest.html'; my $result_file = $html_path . 'pseudotest_result.html'; open( my $fh, $test_file ) or die "can't open $test_file: $!!\n"; my $html = do { local( $/ ) ; <$fh> } ; open( my $fh2, $result_file ) or die "can't open $result_file: $!!\n"; my $correct_result = do { local( $/ ) ; <$fh2> } ; my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok(scalar @warnings == 0, 'no warnings found'); ok($inlined eq $correct_result, 'result was correct'); CSS-Inliner-4018/t/advanced.t000644 000765 000024 00000003300 14400736560 016636 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; plan(tests => 8); my $html = <<'END'; Test Document

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

Aliquam ornare luctus egestas.

Nulla vulputate tellus vitae justo luctus scelerisque accumsan nunc porta.

Phasellus pharetra viverra sollicitudin. Vivamus ac enim ante.

Nunc augue massa, dictum id eleifend non posuere nec purus.

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Lorem ipsum/, 'h1.alert rule inlined'); ok($inlined =~ m/

Consectetur/, 'h1.cool rule inlined'); ok($inlined =~ m/

Aliquam/, '.intro rule inlined'); ok($inlined =~ m/

Phasellus/, 'div p rule inlined'); ok($inlined =~ m/

Nunc augue/, 'div p rule inlined again'); ok($inlined =~ m/

Nulla/, 'no rule for just "p"'); ok($inlined !~ m/

Howdy!

Let's Play

Got any games\N{INTERROBANG}‽

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, 'basic inlining correct'); ok($inlined =~ m/

Got any games\N{INTERROBANG}‽<\/p>/, 'UTF8 characters remain in same format'); CSS-Inliner-4018/t/fetch.perl000644 000765 000024 00000000645 14400736560 016672 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Cwd; use CSS::Inliner; my $url = shift || 'http://www.cpan.org/index.html'; my $inliner = CSS::Inliner->new({ relaxed => 1, leave_style => 1 }); $inliner->fetch_file({ url => $url }); my $inlined = $inliner->inlinify(); print $inlined; warn "================ ERRORS ==============="; foreach my $warning (@{$inliner->content_warnings}) { warn $warning; } CSS-Inliner-4018/t/charset.t000644 000765 000024 00000001123 14400736560 016523 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; use FindBin qw($Bin); plan(tests => 1); my $html_path = "$Bin/html/"; my $test_file = $html_path . 'charset.html'; my $result_file = $html_path . 'charset_result.html'; open(my $fh, '<:utf8', $result_file) or die "can't open $result_file: $!!\n"; my $correct_result = do { local( $/ ) ; <$fh> } ; my $inliner = CSS::Inliner->new(); $inliner->read_file({ filename => $test_file, charset => 'utf8' }); my $inlined = $inliner->inlinify(); ok($inlined eq $correct_result, 'result was correct'); CSS-Inliner-4018/t/atrules.t000644 000765 000024 00000001262 14400736560 016555 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; use FindBin qw($Bin); plan(tests => 1); my $html_path = "$Bin/html/"; my $test_file = $html_path . 'atruletest.html'; my $result_file = $html_path . 'atruletest_result.html'; open( my $fh, $test_file ) or die "can't open $test_file: $!!\n"; my $html = do { local( $/ ) ; <$fh> } ; open( my $fh2, $result_file ) or die "can't open $result_file: $!!\n"; my $correct_result = do { local( $/ ) ; <$fh2> } ; my $inliner = CSS::Inliner->new({ leave_style => 1 }); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined eq $correct_result, 'result was correct'); CSS-Inliner-4018/t/linktest.t000644 000765 000024 00000001231 14400736560 016727 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; use FindBin qw($Bin); plan(tests => 1); my $html_path = "$Bin/html/"; my $test_file = $html_path . 'linktest.html'; my $result_file = $html_path . 'linktest_result.html'; open( my $fh, $test_file ) or die "can't open $test_file: $!!\n"; my $html = do { local( $/ ) ; <$fh> } ; open( my $fh2, $result_file ) or die "can't open $result_file: $!!\n"; my $correct_result = do { local( $/ ) ; <$fh2> } ; my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined eq $correct_result, 'result was correct'); CSS-Inliner-4018/t/utf8_content.t000644 000765 000024 00000001607 14400736560 017521 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; use charnames ':full'; plan(tests => 5); use_ok('CSS::Inliner'); my $html = < Test Document

Howdy!

Let's Play

Got any games\N{INTERROBANG}

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, 'h1 rule inlined'); ok($inlined =~ m/

Let's Play<\/h2>/, 'h2 rule inlined'); ok($inlined =~ m/

Got any games\N{INTERROBANG}<\/p>/, 'p not styled'); ok($inlined !~ m/

Howdy!

Ahoy!

Hello!

Hola!

Gudentag!

Dziendobre!

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $css = $inliner->_css(); #shuffle stored styles around my $shuffle1 = 0; foreach (keys %{$css}) { $shuffle1++;} #shuffle stored styles around more my $shuffle2 = 0; while ( each %{$css} ) {$shuffle2++;} my $inlined = $inliner->inlinify(); ok($shuffle1 == $shuffle2); ok($inlined =~ m/

Howdy!<\/h1>/, 'order #1'); ok($inlined =~ m/

Ahoy!<\/h1>/, 'order #2'); ok($inlined =~ m/

Hello!<\/h1>/, 'order #3'); ok($inlined =~ m/

Hola!<\/h1>/, 'order #4'); ok($inlined =~ m/

Gudentag!<\/h1>/, 'order #5'); ok($inlined =~ m/

Dziendobre!<\/h1>/, 'order #6'); CSS-Inliner-4018/t/basic.t000644 000765 000024 00000001524 14400736560 016160 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; plan(tests => 5); use_ok('CSS::Inliner'); my $html = < Test Document

Howdy!

Let's Play

Got any games?

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, 'h1 rule inlined'); ok($inlined =~ m/

Let's Play<\/h2>/, 'h2 rule inlined'); ok($inlined =~ m/

Got any games\?<\/p>/, 'p not styled'); ok($inlined !~ m/

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

Aliquam ornare luctus egestas.

Nulla vulputate tellus vitae justo luctus scelerisque accumsan nunc porta.

Phasellus pharetra viverra sollicitudin. Vivamus ac enim ante.

Nunc augue massa, dictum id eleifend non posuere nec purus.

END my $inliner = CSS::Inliner->new({ strip_attrs => 1 }); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Lorem ipsum/, 'h1.alert rule inlined'); ok($inlined =~ m/

Consectetur/, 'h1.cool rule inlined'); ok($inlined =~ m/

Aliquam/, '.intro rule inlined'); ok($inlined =~ m/

Phasellus/, 'div p rule inlined'); ok($inlined =~ m/

Nunc augue/, 'div p rule inlined again'); ok($inlined =~ m/

Nulla/, 'no rule for just "p"'); ok($inlined !~ m/

Howdy!

Let's Play

Got any games?

Bar END my $html_tree = HTML::TreeBuilder->new(); $html_tree->ignore_unknown(1); my $inliner = CSS::Inliner->new({ html_tree => $html_tree }); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, 'h1 rule inlined'); ok($inlined !~ m/

Howdy!

Let's Play

Got any games

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, 'h1 rule inlined'); ok($inlined =~ m/

Let's Play<\/h2>/, 'h2 rule inlined'); ok($inlined =~ m/

Got any games<\/p>/, 'p not styled, contains utf8 attribute'); ok($inlined !~ m/

Howdy!

Let's Play

Got any games?

END my $inliner = CSS::Inliner->new({ leave_style => 1 }); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Howdy!<\/h1>/, 'h1 rule inlined'); ok($inlined =~ m/

Let's Play<\/h2>/, 'h2 rule inlined'); ok($inlined =~ m/

Got any games\?<\/p>/, 'p not styled'); ok($inlined =~ m/

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

Aliquam ornare luctus egestas.

Nulla vulputate tellus vitae justo luctus scelerisque accumsan nunc porta.

Phasellus pharetra viverra sollicitudin. Vivamus ac enim ante.

Nunc augue massa, dictum id eleifend non posuere nec purus.

Luctus scelerisque accumsan nunc porta

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/

Lorem ipsum/, 'h1.alert rule inlined'); ok($inlined =~ m/

Consectetur/, 'h1.cool rule inlined'); ok($inlined =~ m/

Aliquam/, '.intro rule inlined'); ok($inlined =~ m/

Phasellus/, 'div p rule inlined'); ok($inlined =~ m/

Nunc augue/, 'div p rule inlined again'); ok($inlined =~ m/

Nulla/, 'no rule for just "p"'); ok($inlined =~ m/

Luctus/, 'rich before the poor'); ok($inlined !~ m/

Lorem ipsum dolor sit amet

Consectetur adipiscing elit

Aliquam ornare luctus egestas.

Nulla vulputate tellus vitae justo luctus scelerisque accumsan nunc porta.

Phasellus pharetra viverra sollicitudin. Vivamus ac enim ante.

Nunc augue massa, dictum id eleifend non posuere nec purus.

Vivamus ac enim ante.

Dictum id eleifend non.

Luctus scelerisque accumsan nunc porta

END $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); $inlined = $inliner->inlinify(); ok($inlined =~ m/

Lorem ipsum/, 'cascading rules for h1.alert.cool inlined'); ok($inlined =~ m/

Consectetur/, 'h1.cool rule inlined'); ok($inlined =~ m/

Aliquam/, '.intro rule inlined'); ok($inlined =~ m/

Nulla/, 'just the "p" rule'); ok($inlined =~ m/

Phasellus/, 'div p rule inlined'); ok($inlined =~ m/

Nunc augue/, 'div p rule inlined again'); ok($inlined =~ m/

Vivamus/, '"div[align=right] p" + "div p" + "p"'); ok($inlined =~ m/

Dictum/, '"div[align=right] p" + "div p" + "p" + "p.rich"'); ok($inlined =~ m/

Luctus/, 'rich before the poor'); ok($inlined !~ m/

Test header with background

IN $inliner->read({ html => $input }); my $actual = $inliner->inlinify(); ok ($actual =~ m{url\(http://www.example.com/test.jpg\)}, 'url in style'); done_testing; CSS-Inliner-4018/t/basic_redeclare.t000644 000765 000024 00000001503 14400736560 020163 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; plan(tests => 2); use_ok('CSS::Inliner'); my $html = <
Example Text
END my $correct_result = <<'END';
Example Text
END my $inliner = CSS::Inliner->new({ strip_attrs => 1 }); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined eq $correct_result, 'result was correct'); CSS-Inliner-4018/t/basic_comment.t000644 000765 000024 00000001674 14400736560 017710 0ustar00kamelkevstaff000000 000000 use strict; use warnings; use lib qw( ./lib ../lib ); use Test::More; use Cwd; use CSS::Inliner; plan(tests => 6); use_ok('CSS::Inliner'); my $html = < Test Document

Howdy!

Let's Play

Got any games?

END my $inliner = CSS::Inliner->new(); $inliner->read({ html => $html }); my $inlined = $inliner->inlinify(); ok($inlined =~ m/\
Sample output from a computer program Textbreak
What about this text
CSS-Inliner-4018/t/html/linebreaktest_result.html000644 000765 000024 00000000324 14400736560 022773 0ustar00kamelkevstaff000000 000000

Email

CSS-Inliner-4018/t/html/pseudotest_result.html000644 000765 000024 00000001302 14400736560 022333 0ustar00kamelkevstaff000000 000000 Visit the Useful Tips Section
Within a div

or within a paragraph or within a link

  • Some text would be here
  • Some other text would be here
Useful Tips Section
I have a bike
I have a motorcycle

Complete the form

CSS-Inliner-4018/t/html/embedded_style.html000644 000765 000024 00000001607 14400736560 021517 0ustar00kamelkevstaff000000 000000
CSS-Inliner-4018/t/html/acidtest.html000644 000765 000024 00000010314 14400736560 020341 0ustar00kamelkevstaff000000 000000 Untitled Document (body)
(div id="id-one")

(h1)(/h1)

(h1 title="lorum")(/h1)

(h1 class="example")(/h1)

(h1 class="another one")(/h1)

(h1 title="myheading" class="last-one" rel="last")(/h1)

(h1 class="last-one")

(div)

(p) (em) (span class="sub-class")(/span) (span class="sub-class2")(/span) (span class="under_class2")(/span) (span class="sub-class2 under_class3")(/span) (/em) (/p)

(/div)
(div class="class-three")

(p) (em) (span class="sub-class")(/span) (span class="sub-class2")(strong)(/strong)(strong class="class-four")(/strong)(/span) (span class="under_class2")(/span) (/em) (/p)

(/div)
(div class="class-four")

(p)(/p)

(em)(/em) (/div)

(p class="class-two")(/p)

(p class="class-one") (span)(/span) text (span)(/span) (/p)

(div class="class-four")

(p)(/p)

(em)(/em) (/div)

(p class="class-two")(/p)

(/div)

(p class="class-one")(span)(/span) text (span)(/span)(/p)

(p class="class-two") (em)(/em) text (span)(/span)(a href="#")(/a) (/p)

(/body) CSS-Inliner-4018/t/html/linktest_result.html000644 000765 000024 00000001101 14400736560 021766 0ustar00kamelkevstaff000000 000000
CSS-Inliner-4018/t/html/atruletest.html000644 000765 000024 00000002426 14400736560 020742 0ustar00kamelkevstaff000000 000000 Test body font CSS-Inliner-4018/t/html/charset_result.html000644 000765 000024 00000000252 14400736560 021570 0ustar00kamelkevstaff000000 000000

This title was written based on the first-hand account of individuals who have transitioned.

CSS-Inliner-4018/t/html/relaxed.html000644 000765 000024 00000002020 14400736560 020160 0ustar00kamelkevstaff000000 000000 dafdsfdsaF
dafdsfdsaF
Sample output from a computer program Textbreak
What about this text
CSS-Inliner-4018/t/html/acidtest_result.html000644 000765 000024 00000011076 14400736560 021745 0ustar00kamelkevstaff000000 000000 Untitled Document (body)
(div id="id-one")

(h1)(/h1)

(h1 title="lorum")(/h1)

(h1 class="example")(/h1)

(h1 class="another one")(/h1)

(h1 title="myheading" class="last-one" rel="last")(/h1)

(h1 class="last-one")

(div)

(p) (em) (span class="sub-class")(/span) (span class="sub-class2")(/span) (span class="under_class2")(/span) (span class="sub-class2 under_class3")(/span) (/em) (/p)

(/div)
(div class="class-three")

(p) (em) (span class="sub-class")(/span) (span class="sub-class2")(strong)(/strong)(strong class="class-four")(/strong)(/span) (span class="under_class2")(/span) (/em) (/p)

(/div)
(div class="class-four")

(p)(/p)

(em)(/em) (/div)

(p class="class-two")(/p)

(p class="class-one") (span)(/span) text (span)(/span) (/p)

(div class="class-four")

(p)(/p)

(em)(/em) (/div)

(p class="class-two")(/p)

(/div)

(p class="class-one")(span)(/span) text (span)(/span)(/p)

(p class="class-two") (em)(/em) text (span)(/span)(a href="#")(/a) (/p)

(/body) CSS-Inliner-4018/t/html/pseudotest.html000644 000765 000024 00000003571 14400736560 020747 0ustar00kamelkevstaff000000 000000 Visit the Useful Tips Section
Within a div

or within a paragraph or within a link

  • Some text would be here
  • Some other text would be here
Useful Tips Section
I have a bike
I have a motorcycle

Complete the form

CSS-Inliner-4018/t/html/mediaquerytest.html000644 000765 000024 00000021702 14400736560 021611 0ustar00kamelkevstaff000000 000000

Having trouble reading this email? View it in your browser.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

#[SENDER_COMPANY]#
#[SENDER_ADDRESS]#
This email was sent to: #[USER_EMAIL]#
Unsubscribe
CSS-Inliner-4018/t/html/mediaquerytest_result.html000644 000765 000024 00000026233 14400736560 023213 0ustar00kamelkevstaff000000 000000

Having trouble reading this email? View it in your browser.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

 

Heading

 

Normal text.

 

Sub-Heading

 

Normal text.

#[SENDER_COMPANY]#
#[SENDER_ADDRESS]#
This email was sent to: #[USER_EMAIL]#
Unsubscribe
CSS-Inliner-4018/t/html/linktest.html000644 000765 000024 00000001461 14400736560 020401 0ustar00kamelkevstaff000000 000000