Commit 75ab33e0 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

Upgrading documentation.

parent a142e620
......@@ -6,10 +6,15 @@ use English qw(-no_match_vars);
use Sympa::ConfDef;
use Sympa::Constants;
use Sympa::ListDef;
my %overrides;
while (my ($pname, $pitem) = each %Sympa::ListDef::pinfo) {
%overrides = (%overrides, _get_overrides($pname, $pitem, [$pname]));
}
my $parameters = '';
my $first_section = 1;
foreach my $param (@Sympa::ConfDef::params) {
if (exists $param->{'name'}) {
my $name = $param->{'name'};
......@@ -32,46 +37,113 @@ foreach my $param (@Sympa::ConfDef::params) {
my $scenario = $name
if exists $param->{'scenario'} and $param->{'scenario'};
#$parameters .= sprintf "=item %s\n\n", $param->{'name'};
$parameters .= sprintf "=head4 %s\n\n", $param->{'name'};
if (defined $default) {
$parameters .= sprintf "(Default value: C<%s>)\n",
_escape_pod($default);
} elsif ($optional) {
$parameters .= sprintf "(Optioal)\n";
if ($name eq 'color_0') {
$parameters .= "=head4 C<color_0>, ..., C<color_15>\n\n";
} elsif ($name =~ /\Acolor_/) {
next;
} elsif ($name eq 'dark_color') {
$parameters .=
"=head4 C<dark_color>, C<light_color>, C<text_color>, C<bg_color>, C<error_color>, C<selected_color>, C<shaded_color>\n\n";
} elsif ($name =~ /_color\z/) {
next;
} elsif ($name eq 'main_menu_custom_button_1_title') {
$parameters .=
"=head4 C<main_menu_custom_button_1_title>, ... C<main_menu_custom_button_3_title>, C<main_menu_custom_button_1_url>, ... C<main_menu_custom_button_3_url>, C<main_menu_custom_button_1_target>, ... C<main_menu_custom_button_3_target>\n\n";
} elsif ($name =~ /\Amain_menu_custom_button_/) {
next;
} else {
$parameters .= sprintf "(Mandatory)\n";
$parameters .= sprintf "=head4 C<%s>\n\n", $param->{'name'};
}
if (defined $vhost) {
$parameters .= sprintf "(Overridable by each F<robot.conf>)\n\n";
$parameters .= sprintf "%s\n\n", _escape_pod($query)
if defined $query;
$parameters .= "=over\n\n";
$parameters .= "=item Default:\n\n";
if ($name =~ /\Acolor_/ or $name =~ /_color\z/) {
$parameters .= "See description on web interface.\n\n";
} elsif (defined $default) {
if (exists $param->{gettext_unit}) {
$parameters .= sprintf "C<%s> (%s)\n\n",
_escape_pod($default), $param->{gettext_unit};
} else {
$parameters .= sprintf "C<%s>\n\n", _escape_pod($default);
}
} elsif ($optional) {
if (exists $param->{gettext_unit}) {
$parameters .= sprintf "None (%s).\n\n",
$param->{gettext_unit};
} else {
$parameters .= "None.\n\n";
}
} else {
$parameters .= "\n";
$parameters .= "None, I<mandatory>.\n\n";
}
$parameters .= "=item Overrides:\n\n";
$parameters .= "Virtual domain\n\n"
if defined $vhost;
if ($overrides{$name}) {
if ($overrides{$name} eq $name) {
$parameters .= "List\n\n";
} else {
$parameters .= sprintf "List (C<%s>)\n\n", $overrides{$name};
}
}
$parameters .= "None.\n\n"
unless defined $vhost or $overrides{$name};
$parameters .= "=back\n\n";
$parameters .=
sprintf "Value of this parameter is name of C<%s> scenario.\n\n",
$name
if defined $scenario;
$parameters .= sprintf "%s\n\n", _escape_pod($query)
if defined $query;
$parameters .= sprintf "Example:\n\n %s %s\n\n", $name, $example
if defined $example;
$parameters .= sprintf "%s\n\n", _escape_pod($advice)
$parameters .= sprintf "%s\n\n",
join("\n\n", split "\n", _escape_pod($advice))
if defined $advice;
if ($name eq 'main_menu_custom_button_1_title') {
$parameters .= "Example:\n\n";
$parameters .= " main_menu_custom_button_1_title FAQ\n";
$parameters .=
" main_menu_custom_button_1_url http://www.renater.fr/faq/universalistes/index\n";
$parameters .= " main_menu_custom_button_1_target Help\n\n";
} else {
$parameters .= sprintf "Example:\n\n %s %s\n\n", $name, $example
if defined $example;
}
} else {
#$parameters .= "=back\n\n" unless $first_section;
$first_section = 0;
$parameters .= sprintf "=head3 %s\n\n",
$parameters .= sprintf "=head2 %s\n\n",
_escape_pod($param->{'gettext_id'});
#$parameters .= "=over\n\n";
}
}
#$parameters .= "=back\n\n" unless $first_section;
printf do { local $RS; <DATA> }, Sympa::Constants::CONFIG(), $parameters,
Sympa::Constants::CONFIG();
exit 0;
sub _get_overrides {
my $pname = shift;
my $pitem = shift;
my $pnames = shift;
my %ov;
if (exists $pitem->{format} and ref $pitem->{format} eq 'HASH') {
%ov = map {
_get_overrides($_, $pitem->{format}->{$_}, [@$pnames, $_]);
} keys %{$pitem->{format}};
} elsif (exists $pitem->{default}
and ref $pitem->{default} eq 'HASH'
and exists $pitem->{default}->{conf}) {
%ov = ($pitem->{default}->{conf} => join('.', @$pnames));
} else {
%ov = ();
}
return %ov;
}
sub _escape_pod {
my $string = shift;
$string =~ s/([&<>])/
......@@ -91,8 +163,9 @@ sympa.conf, robot.conf - Configuration file for default site and robot
=head1 DESCRIPTION
F<%s> is main configuration file of Sympa.
Several parameters definied in this file may be overridden by F<robot.conf>
configuration file for each robot.
Several parameters defined in this file may be overridden by F<robot.conf>
configuration file for each virtual domain, or by F<config> configuration file
for each mailing list.
Format of F<sympa.conf> and F<robot.conf> is as following:
......@@ -109,10 +182,13 @@ I<value> may contain spaces but may not contain newlines.
=back
Below is entire list of configuration parameters.
For more details of each parameter see Reference Manual.
=head1 PARAMETERS
=head2 Parameters
Below is entire list of configuration parameters.
"Default" is built-in default value if any.
"Overrides" lists contexts (with parameter name) which can override
settings in site-wide context (F<sympa.conf>): Virtual domain (F<robot.conf>)
and/or List (F<config>).
%s
......@@ -126,7 +202,12 @@ Sympa main configuration file.
=item F<$SYSCONFDIR/E<lt>robot nameE<gt>/robot.conf>
Configuration specific to each virtual host.
Configuration specific to each virtual domain.
=item F<$EXPLDIR/E<lt>list nameE<gt>/config>
or F<$EXPLDIR/E<lt>robot nameE<gt>/E<lt>list nameE<gt>/config>
Configuration specific to each list.
=back
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment