NAME Tags::HTML::CPAN::Changes - Tags helper for CPAN changes. SYNOPSIS use Tags::HTML::CPAN::Changes; my $obj = Tags::HTML::CPAN::Changes->new(%params); $obj->cleanup; $obj->init($changes); $obj->prepare; $obj->process; $obj->process_css; METHODS "new" my $obj = Tags::HTML::CPAN::Changes->new(%params); Constructor. * "css" 'CSS::Struct::Output' object for process_css processing. Default value is undef. * "no_css" No CSS support flag. If this flag is set to 1, process_css() returns undef. Default value is 0. * "tags" 'Tags::Output' object. Default value is undef. "cleanup" $obj->cleanup; Cleanup module to init state. Returns undef. "init" $obj->init($changes); Set CPAN::Changes instance defined by $changes to object. Minimal version of CPAN::Changes is 0.500002. Returns undef. "prepare" $obj->prepare; Process initialization before page run. Do nothing in this module. Returns undef. "process" $obj->process; Process Tags structure for output with message. Returns undef. "process_css" $obj->process_css; Process CSS::Struct structure for output. Returns undef. ERRORS new(): From Class::Utils::set_params(): Unknown parameter '%s'. From Tags::HTML::new(): Parameter 'tags' must be a 'Tags::Output::*' class. Parameter 'css_class' is required. init(): Data object must be a 'CPAN::Changes' instance. Minimal version of supported CPAN::Changes is 0.500002.", Version: %s process(): From Tags::HTML::process(): Parameter 'tags' isn't defined. EXAMPLE1 use strict; use warnings; use CSS::Struct::Output::Raw; use CPAN::Changes; use Tags::HTML::CPAN::Changes; use Tags::HTML::Page::Begin; use Tags::HTML::Page::End; use Tags::Output::Raw; use Unicode::UTF8 qw(decode_utf8 encode_utf8); my $css = CSS::Struct::Output::Raw->new; my $tags = Tags::Output::Raw->new( 'xml' => 1, ); my $begin = Tags::HTML::Page::Begin->new( 'author' => decode_utf8('Michal Josef Å paÄek'), 'css' => $css, 'generator' => 'EXAMPLE1', 'lang' => { 'title' => 'Hello world!', }, 'tags' => $tags, ); my $end = Tags::HTML::Page::End->new( 'tags' => $tags, ); my $obj = Tags::HTML::CPAN::Changes->new( 'css' => $css, 'tags' => $tags, ); # Example changes object. my $changes = CPAN::Changes->new( 'preamble' => 'Revision history for perl module Foo::Bar', 'releases' => [ CPAN::Changes::Release->new( 'date' => '2009-07-06', 'entries' => [ CPAN::Changes::Entry->new( 'entries' => [ 'item #1', ], ), ], 'version' => 0.01, ), ], ); # Init. $obj->init($changes); # Process CSS. $obj->process_css; # Process HTML. $begin->process; $obj->process; $end->process; # Print out. print encode_utf8($tags->flush); # Output: # <!DOCTYPE html> # <html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><meta name="author" content="Michal Josef Å paÄek" /><meta name="generator" content="EXAMPLE1" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Hello world!</title><style type="text/css">.changes{max-width:800px;margin:auto;background:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);}.changes .version{border-bottom:2px solid #eee;padding-bottom:20px;margin-bottom:20px;}.changes .version:last-child{border-bottom:none;}.changes .version h2,.changes .version h3{color:#007BFF;margin-top:0;}.changes .version-changes{list-style-type:none;padding-left:0;}.changes .version-change{background-color:#f8f9fa;margin:10px 0;padding:10px;border-left:4px solid #007BFF;border-radius:4px;} # </style></head><body><div class="changes"><div class="version"><h2>0.01 - 2009-07-06</h2><ul class="version-changes"><li class="version-change">item #1</li></ul></div></div></body></html> EXAMPLE2 use strict; use warnings; use CSS::Struct::Output::Indent; use CPAN::Changes; use CPAN::Changes::Entry; use CPAN::Changes::Release; use Tags::HTML::CPAN::Changes; use Tags::HTML::Page::Begin; use Tags::HTML::Page::End; use Tags::Output::Indent; use Unicode::UTF8 qw(decode_utf8 encode_utf8); my $css = CSS::Struct::Output::Indent->new; my $tags = Tags::Output::Indent->new( 'preserved' => ['style'], 'xml' => 1, ); my $begin = Tags::HTML::Page::Begin->new( 'author' => decode_utf8('Michal Josef Å paÄek'), 'css' => $css, 'generator' => 'EXAMPLE2', 'lang' => { 'title' => 'Hello world!', }, 'tags' => $tags, ); my $end = Tags::HTML::Page::End->new( 'tags' => $tags, ); my $obj = Tags::HTML::CPAN::Changes->new( 'css' => $css, 'tags' => $tags, ); # Example changes object. my $changes = CPAN::Changes->new( 'preamble' => 'Revision history for perl module Foo::Bar', 'releases' => [ CPAN::Changes::Release->new( 'date' => '2009-07-06', 'entries' => [ CPAN::Changes::Entry->new( 'entries' => [ 'item #1', ], ), ], 'version' => 0.01, ), ], ); # Init. $obj->init($changes); # Process CSS. $obj->process_css; # Process HTML. $begin->process; $obj->process; $end->process; # Print out. print encode_utf8($tags->flush); # Output: # <!DOCTYPE html> # <html lang="en"> # <head> # <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> # <meta name="author" content="Michal Josef Å paÄek" /> # <meta name="generator" content="EXAMPLE2" /> # <meta name="viewport" content="width=device-width, initial-scale=1.0" /> # <title> # Hello world! # </title> # <style type="text/css"> # .changes { # max-width: 800px; # margin: auto; # background: #fff; # padding: 20px; # border-radius: 8px; # box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); # } # .changes .version { # border-bottom: 2px solid #eee; # padding-bottom: 20px; # margin-bottom: 20px; # } # .changes .version:last-child { # border-bottom: none; # } # .changes .version h2, .changes .version h3 { # color: #007BFF; # margin-top: 0; # } # .changes .version-changes { # list-style-type: none; # padding-left: 0; # } # .changes .version-change { # background-color: #f8f9fa; # margin: 10px 0; # padding: 10px; # border-left: 4px solid #007BFF; # border-radius: 4px; # } # </style> # </head> # <body> # <div class="changes"> # <div class="version"> # <h2> # 0.01 - 2009-07-06 # </h2> # <ul class="version-changes"> # <li class="version-change"> # item #1 # </li> # </ul> # </div> # </div> # </body> # </html> DEPENDENCIES Class::Utils, CPAN::Version, English, Error::Pure, Scalar::Util, Tags::HTML. REPOSITORY <https://github.com/michal-josef-spacek/Tags-HTML-CPAN-Changes> AUTHOR Michal Josef Å paÄek <mailto:skim@cpan.org> <http://skim.cz> LICENSE AND COPYRIGHT © 2024 Michal Josef Å paÄek BSD 2-Clause License VERSION 0.02