From 7b1e4b04b2afd171e840bebde194735629608215 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 25 Feb 2016 17:44:56 +0100 Subject: [PATCH] pod: generate property string documentation Generate the more detailed documentation with the 'description' property provided in the property-string format schema for the '*.conf'(5) manpages. --- 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.39.2