A1z-HTML5-Template

 view release on metacpan or  search on metacpan

lib/A1z/HTML5/Template.pm  view on Meta::CPAN

				# Keep only those items that have -- in the beginning 
					
				if ( $h1 =~ /^\s+/ or $div =~ /^\s+/ ) 
				{
					next unless ($h1 =~ /^\s+--/ or $div =~ /^\s+--/);
					$div =~ s!^\s+--!!g;
					$h1 =~ s!^\s+--!!g;
				}
				else
				{
					next unless ($h1 =~ /^--/ or $div =~ /^--/);
					$div =~ s!^--!!g;
					$h1 =~ s!^--!!g;
				} 
				
				$out .= qq{\t<h3>$h1</h3>\n\t<div>$div</div>\n} if $line; 
			} 
			elsif ($output_format eq 'menu') 
			{
				# the first item will be used as link title and name
				# the second item will be used as the actual link  
				# no extensions added automatically by the script 
				# an id for each link/li is also provided in case, may be it is not needed 
				
				# Remove items with a # in the beginning; Sat Feb 21 18:48:19 2015
				next if ($h1 =~ /^#http/ or $div =~ /^#http/); 
				
				# Keep only those items that have a 'http' in the beginning 
				 
				if ( $h1 =~ /^\s+/ or $div =~ /^\s+/ ) 
				{
					next unless ($h1 =~ /^\s+http/ or $div =~ /^\s+http/);					
					#$div =~ s!^\s+http!!g;
					#$h1 =~ s!^\s+http!!g;
				}
				else
				{
					next unless ($h1 =~ /^http/ or $div =~ /^http/);
					#$div =~ s!^http!!g;
					#$h1 =~ s!^http!!g;
				}
				$out .= qq{\t<li id="li-$serial"><a id="a-$serial" href="$div" title="$h1">$h1</a></li>\n};
			}
			elsif ($output_format eq 'tabs') 
			{
				# Keep only those items that have a == in the beginning  
				
				if ( $h1 =~ /^\s+/ or $div =~ /^\s+/ ) 
				{
					next unless ($h1 =~ /^\s+==/ or $div =~ /^\s+==/);
					$div =~ s!^\s+==!!g;
					$h1 =~ s!^\s+==!!g;
				}
				else
				{
					next unless ($h1 =~ /^==/ or $div =~ /^==/);
					$div =~ s!^==!!g;
					$h1 =~ s!^==!!g;
				}
				
				# Mismatching fragment identifier. See 1797.
				# $div not available here as <FILE> is not open here.
				$out .= qq{\t<div id="tabs-$serial"><p>$div</p></div>\n}; 
				
			}
			elsif ($output_format eq 'dialog')
			{
				# includes everything; So, no filtering.
				
				# But, just remove symbols in both $h1 and $div
				$div =~ s!^(==|\#|--)!!g;
				$h1 =~ s!^(==|\#|--)!!g;
					
				$out .= qq{\t\t<h4 class="dialog-header">$h1</h4>\n\t\t<div class="dialog-content">$div <hr/></div>\n}; 
			}
			else 
			{
				$out .= qq{$h1 $div}; 	# or $line
			}
		} 
		
		# add an extra item at the end of file output 
		
		# Step 3 
		# set the output ending as per format  
		if ($output_format eq 'table') 
		{ 
			$out .= qq{\n</tbody>\n</table>\n\n}; 
		}
		elsif ($output_format eq 'accordion')
		{
			$out .= qq{\n<!--end accordion--></div>\n\n};
		} 
		elsif ($output_format eq 'menu') 
		{
			$out .= qq{</ul></ul>};
		}
		elsif ($output_format eq 'tabs')
		{
			$out .= qq{</div><!--end tabs-->\n}; 
		}
		elsif ($output_format eq 'dialog') 
		{
			$out .= qq{</div><!--end dialog-->\n}; 
		}
		else 
		{
			$out .= qq{\n\n}; 
		}
		
		# end file output wrapper
		$out .= qq{</div><!--end file output-->\n};  
		
		return $out; 
	}
	else 
	{
		my $out;

		
	



( run in 1.866 second using v1.01-cache-2.11-cpan-b16cb0d3907 )