Apache-VimColor

 view release on metacpan or  search on metacpan

VimColor.pm  view on Meta::CPAN


For a complete list of all options and descriptions see L<below|/"CONFIGURATION DIRECTIVES">.

=cut

our $Position = 0;
our $Cache = {};

return (1);

sub escape_html ($)
{
	$_ = shift;

	s/\&/&amp;/g;
	s/</&lt;/g;
	s/>/&gt;/g;
	s/"/&quot;/g;

	s#\n#<br />\n#sg;
	s/(  +)/'&nbsp;' x length ($1)/ge;

	return ($_);
}

sub escape_tabs ($$)
{
	my $value   = shift;
	my $tabstop = shift;
	my $retval = '';

	$value =~ s/\r//g;

	while ($value =~ s/^([^\n\t]*)([\n\t])//s)
	{
		$retval .= $1;

VimColor.pm  view on Meta::CPAN

			$options->{'cache'}->set ($filename, $cache_entry);
		}
	}

	# For loop to prevent aliasing.
	for (my $i = 0; $i < scalar (@$elems); $i++)
	{
		my $type  = $elems->[$i][0];
		my $value = $elems->[$i][1];

		$value = escape_tabs ($value, $options->{'tabstop'});
		$value = escape_html ($value);

		if ($type)
		{
			$output .= qq(<span class="$type">$value</span>);
		}
		else
		{
			$output .= $value;
		}
	}



( run in 0.353 second using v1.01-cache-2.11-cpan-c21f80fb71c )