Changed the Help so that chapters with only 1 page are directly linked, saving a click.

Added pluggable template parser docs.
From the dev list, changed HTMLTemplateExpr to translate all dots in template
variables to underscores, since EXPR's don't do dots, just like TemplateToolkit.
This commit is contained in:
Colin Kuskie 2006-10-29 23:36:18 +00:00
parent 8905b7252c
commit 0b1e077f69
14 changed files with 319 additions and 4 deletions

View file

@ -149,6 +149,71 @@ our $HELP = {
]
},
'template parsers list' => {
title => 'template parsers list title',
body => sub {
my $session = shift;
my $dir = join '/', $session->config->getWebguiRoot,"lib","WebGUI","Asset","Template";
opendir (DIR,$dir) or $session->errorHandler->fatal("Can't open Macro directory: $dir!");
my @plugins = map { s/\.pm//; $_; }
grep { $_ ne "Parser.pm" }
grep { /\.pm$/ }
readdir(DIR); ##list of namespaces
closedir(DIR);
##Build list of enabled macros, by namespace, by reversing session hash:
my @enabledPlugins = map { s/^WebGUI::Asset::Template:://; $_ } @{ $session->config->get("templateParsers") };
my $defaultParser = $session->config->get('defaultTemplateParser');
$defaultParser =~ s/^WebGUI::Asset::Template:://;
my %enabledPlugins = map { $_ => 1 } @enabledPlugins;
my $i18n = WebGUI::International->new($session, 'Asset_Template');
my $yes = $i18n->get(138, 'WebGUI');
my $no = $i18n->get(139, 'WebGUI');
use Data::Dumper;
$session->errorHandler->warn(Dumper \@enabledPlugins);
$session->errorHandler->warn(Dumper \@plugins);
my $plugin_table =
join "\n",
map { join '', '<tr><td>', $_,
'</td><td>',
($enabledPlugins{$_} ? $yes : $no),
'</td><td>',
($_ eq $defaultParser ? $yes : $no),
'</td>',
} @plugins;
$plugin_table =
join("\n",
$i18n->get('template parsers list body'),
'<table border="1" cellpadding="3">',
'<tr><th>',$i18n->get('plugin name'),
'</th><th>',
$i18n->get('plugin enabled header'),
'</th><th>',
$i18n->get('default parser'),
'</th></tr>',$plugin_table,'</table>');
},
fields => [],
related => sub { ##Hey, you gotta pass in the session var, right?
my $session = shift;
sort { $a->{tag} cmp $b->{tag} }
map {
s/^WebGUI::Asset::Template:://;
$tag = $_;
$tag =~ s/^[a-zA-Z]+_//; #Remove initial shortcuts
$tag =~ s/([A-Z]+(?![a-z]))/$1 /g; #Separate acronyms
$tag =~ s/([a-z])([A-Z])/$1 $2/g; #Separate studly caps
$tag =~ s/\s+$//;
$tag = lc $tag;
$namespace = join '', 'Template_', $_;
{ tag => $tag,
namespace => $namespace }
}
@{ $session->config->get("templateParsers") }
},
,
},
};
1;