package HTML::LadyAleenaStyle; use strict; use warnings; use Exporter qw(import); our @EXPORT_OK = qw(title script heading anchor paragraph sparagraph list definition_list table form fieldset legend label selection input textarea div pre); use HTML::Entities qw(encode_entities); use Base::Data qw(data_file get_hash); use Base::Nifty qw(sline line); =head1 NAME B generates HTML tags for most of the HTML elements. =head1 SYNOPSIS To use B to print HTML tags, use the following. use Base::HTML::Element qw( title heading script anchor paragraph sparagraph list definition_list table form fieldset selection input textarea div pre ); ## Module Vars =head3 C To print readable html, set the indentation to the level. Can be 0 - 9. Each level constitutes a tab space multiplier applied to child elements (according to dominterpretation?). Default is no indentation in output or 0 level. $HTML::LadyAleenaStyle::inlvl = 7; Each child element will be indented seven tab stops from the relevant parent element =cut $HTML::LadyAleenaStyle::inlvl = 0 unless $HTML::LadyAleenaStyle::inlvl; # default indentation none; ### set module variables if required in calling script. sub in_depth { state $level = 0; # requires Perl version 5.10 return ( sub { $level += $HTML::LadyAleenaStyle::inlvl }, sub { $level -= $HTML::LadyAleenaStyle::inlvl }, ); } my ($ina,$ind) = in_depth; # now replace the $tab variables throughought the element subs with calls to # &$ina for ascending tab depth, # &$ind for descending tab depth, # and remove $tab assignement from secial array. # for example in sub div: # # sub div{ # # my ($code,$opt) = @_; # no $tab # my $tag = 'div'; # my $open = open_tag($tag,$opt,[@ics,@java]); # # line(&$ina,qq(<$open>)); # indent depth increase # &$code; # line(&$ind,qq()); # indent depth decrease # } #