| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | use Text::FormatTable; | ||
| 4 | |||
| 5 | my @mods = (qw( | ||
| 6 | QWizard::Generator::HTML | ||
| 7 | QWizard::Generator::Gtk2 | ||
| 8 | QWizard::Generator::Tk | ||
| 9 | QWizard::Generator::ReadLine | ||
| 10 | )); | ||
| 11 | |||
| 12 | print_header(); | ||
| 13 | |||
| 14 | # | ||
| 15 | # print general support matrix | ||
| 16 | # | ||
| 17 | my %types; | ||
| 18 | foreach my $name (@mods) { | ||
| 19 | my $g = eval "require $name; | ||
| 20 | new ${name}();"; | ||
| 21 | if (!$g || ref($g) ne $name) { | ||
| 22 | next; | ||
| 23 | } | ||
| 24 | map { | ||
| 25 | $types{$name}{$_} = 'X'; | ||
| 26 | $types{'all'}{$_} = 'X'; | ||
| 27 | } $g->get_supported_tags(); | ||
| 28 | } | ||
| 29 | |||
| 30 | my $table = Text::FormatTable->new(' |' . 'l|' x ($#mods+2)); | ||
| 31 | my @smnames = @mods; | ||
| 32 | map { s/.*:://; } @smnames; | ||
| 33 | $table->rule('-'); | ||
| 34 | $table->head(' ', @smnames); | ||
| 35 | $table->rule('-'); | ||
| 36 | foreach my $tag (sort keys(%{$types{'all'}})) { | ||
| 37 | my @row = $tag; | ||
| 38 | map { push @row, $types{$_}{$tag} } @mods; | ||
| 39 | $table->row(@row); | ||
| 40 | } | ||
| 41 | $table->rule('-'); | ||
| 42 | my $tabletxt = $table->render(75); | ||
| 43 | $tabletxt =~ s/^--/ /gm; | ||
| 44 | print "$tabletxt\n"; | ||
| 45 | |||
| 46 | print "\n\n=head1 THE GENERATORS\n\n"; | ||
| 47 | |||
| 48 | # | ||
| 49 | # print detailed args | ||
| 50 | # | ||
| 51 | foreach my $name (qw( | ||
| 52 | QWizard::Generator::HTML | ||
| 53 | QWizard::Generator::Gtk2 | ||
| 54 | QWizard::Generator::Tk | ||
| 55 | QWizard::Generator::ReadLine | ||
| 56 | )) { | ||
| 57 | my $g = eval "require $name; | ||
| 58 | new ${name}();"; | ||
| 59 | if (!$g || ref($g) ne $name) { | ||
| 60 | next; | ||
| 61 | } | ||
| 62 | print "=head2 $name | ||
| 63 | |||
| 64 | These are the question types known to the $name generator class: | ||
| 65 | |||
| 66 | \=over | ||
| 67 | |||
| 68 | "; | ||
| 69 | $g->print_handler_tags("=item %s => %s %s %s\n\n", | ||
| 70 | "=item %s\n\n=over\n\n", "=back\n\n"); | ||
| 71 | print "=back\n\n"; | ||
| 72 | print "\n\n"; | ||
| 73 | } | ||
| 74 | |||
| 75 | print_trailer(); | ||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | sub print_header { | ||
| 80 | |||
| 81 | print ' | ||
| 82 | |||
| 83 | =pod | ||
| 84 | |||
| 85 | =head1 NAME | ||
| 86 | |||
| 87 | QWizard_Widgets - Describes the Widgets available to QWizard Generators | ||
| 88 | |||
| 89 | =head1 OVERVIEW | ||
| 90 | |||
| 91 | This document describes the various QWizard backend widgets that can | ||
| 92 | be produced and what tags they support, and what the values of those | ||
| 93 | tags are expected to produce (either by direct value such as | ||
| 94 | |||
| 95 | tag => "string" | ||
| 96 | |||
| 97 | or as a result of a code execution like | ||
| 98 | |||
| 99 | tag => sub { return "string" } | ||
| 100 | |||
| 101 | or even: | ||
| 102 | |||
| 103 | tag => [sub { return $_[$#_] }, "string"] | ||
| 104 | |||
| 105 | =head2 Tag Value Expectations | ||
| 106 | |||
| 107 | The documentation to follow will reference a number of different value | ||
| 108 | types for various tags. These possible values are described below: | ||
| 109 | |||
| 110 | =over | ||
| 111 | |||
| 112 | =item single | ||
| 113 | |||
| 114 | A single value is expected for this tag. If a subroutine returns | ||
| 115 | multiple values only the first will be used. | ||
| 116 | |||
| 117 | =item multi | ||
| 118 | |||
| 119 | The tag expects or can accept multiple values. These values should be | ||
| 120 | specified in the form of an array reference. | ||
| 121 | |||
| 122 | =item norecuse | ||
| 123 | |||
| 124 | This is a special form of "multi"... I need to go look at the code | ||
| 125 | again to remember exactly what it does. | ||
| 126 | |||
| 127 | =item values,labels | ||
| 128 | |||
| 129 | This is a special tag to indicate the widget needs both values and | ||
| 130 | labels associated with the multiple sub-widgets it can display (radio | ||
| 131 | boxes, menu items, check boxes, ...). The values tag (an array ref) | ||
| 132 | will indicate which values are used within the program. The labels | ||
| 133 | clause will map those values to human strings. The labels clause can | ||
| 134 | be either a hash mapping values to labels, or an array where the even | ||
| 135 | elements of the array (0, 2, 4, ...) will be the values and the odd | ||
| 136 | elements (1, 3, 5, ...) will be the labels to associate with them. An | ||
| 137 | array reference for labels allows the order of label presentation to | ||
| 138 | be specified, where as a hash will display the labels/sub-widgets in a | ||
| 139 | somewhat random order. | ||
| 140 | |||
| 141 | If the labels clause is left out, the values themselves will be | ||
| 142 | present to the user. | ||
| 143 | |||
| 144 | If the values clause is left out, the values will be pulled from the labels. | ||
| 145 | |||
| 146 | It is likely a rare case that you need to specify both. This special | ||
| 147 | tag name specifically indicates you can specify both. | ||
| 148 | |||
| 149 | =item forced | ||
| 150 | |||
| 151 | This is a value which is forced for a particular tag for internal use | ||
| 152 | and can\'t be manipulated by the programmer. It\'s documented here | ||
| 153 | anyway for completeness. | ||
| 154 | |||
| 155 | =head2 Notes about this document. | ||
| 156 | |||
| 157 | =over | ||
| 158 | |||
| 159 | =item 1) | ||
| 160 | |||
| 161 | This file is automatically generated from the Generator\'s own | ||
| 162 | expect ions of their supported widgets and the requirements. Thus, | ||
| 163 | not all widgets in all generators are perfectly equal. Some | ||
| 164 | generators have better support for extra options for certain widgets, | ||
| 165 | for example. | ||
| 166 | |||
| 167 | =item 2) | ||
| 168 | |||
| 169 | This document does not specify some of the other tags that every | ||
| 170 | question is allowed to have, such as "name", "text", "helpddesc", | ||
| 171 | "check_value", ... It only discusses the tags that the back end | ||
| 172 | generators make use of. | ||
| 173 | |||
| 174 | =head1 WIDGET SUPPORT SUMMARY MATRIX | ||
| 175 | |||
| 176 | '; | ||
| 177 | |||
| 178 | } | ||
| 179 | |||
| 180 | sub print_trailer { | ||
| 181 | print ' | ||
| 182 | |||
| 183 | =head1 AUTHOR | ||
| 184 | |||
| 185 | Wes Hardaker, hardaker@users.sourceforge.net | ||
| 186 | |||
| 187 | =head1 SEE ALSO | ||
| 188 | |||
| 189 | QWizard, perl(1) | ||
| 190 | |||
| 191 | Net-Policy: http://net-policy.sourceforge.net/ | ||
| 192 | |||
| 193 | =cut | ||
| 194 | |||
| 195 | '; | ||
| 196 | |||
| 197 | } |