[pve-devel] [PATCH common] pod: generate property string documentation
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Feb 25 17:44:56 CET 2016
Generate the more detailed documentation with the
'description' property provided in the property-string
format schema for the '*.conf'(5) manpages.
---
PS: perlpod's =over is WEIRD
src/PVE/PodParser.pm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/src/PVE/PodParser.pm b/src/PVE/PodParser.pm
index f61317b..8ad0598 100644
--- a/src/PVE/PodParser.pm
+++ b/src/PVE/PodParser.pm
@@ -120,6 +120,19 @@ sub schema_get_type_text {
return $type;
}
+sub generate_property_text {
+ my ($schema) = @_;
+ my $data = '';
+ foreach my $key (sort keys %$schema) {
+ my $d = $schema->{$key};
+ my $desc = $d->{description};
+ my $typetext = schema_get_type_text($d);
+ $desc = 'No description available' if !$desc;
+ $data .= "=item $key: $typetext\n\n$desc\n\n";
+ }
+ return $data;
+}
+
# generta epop from JSON schema properties
sub dump_properties {
my ($properties) = @_;
@@ -150,6 +163,15 @@ sub dump_properties {
my $typetext = schema_get_type_text($d);
$data .= "=item $base: $typetext\n\n";
$data .= "$descr\n\n";
+
+ if ($d->{type} eq 'string') {
+ my $format = $d->{format};
+ if ($format && ref($format) eq 'HASH') {
+ $data .= "=over 1.1\n\n";
+ $data .= generate_property_text($format);
+ $data .= "=back\n\n";
+ }
+ }
}
$data .= "=back";
--
2.1.4
More information about the pve-devel
mailing list