Skip to content

Commit 901c34a

Browse files
authored
Merge pull request #469 from Icinga:feature/improve_plugin_dic_visualisation
Feature: Improves plugin doc generator for better docs Adds table view for plugins with short summary of what the plugin is for and allows multi-lines in example docs
2 parents a7b9859 + d967681 commit 901c34a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

doc/100-General/10-Changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ documentation before upgrading to a new release.
77

88
Released closed milestones can be found on [GitHub](https://github.com/Icinga/icinga-powershell-framework/milestones?state=closed).
99

10+
## 1.9.0 (2022-05-03)
11+
12+
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/20?closed=1)
13+
14+
### Enhancements
15+
16+
* [#469](https://github.com/Icinga/icinga-powershell-framework/pull/469) Improves plugin doc generator to allow multi-lines in code examples and updates plugin overview as table, adding a short description on what the plugin is for
17+
1018
## 1.8.0 (2022-02-08)
1119

1220
[Issue and PRs](https://github.com/Icinga/icinga-powershell-framework/milestone/19?closed=1)

lib/core/framework/Publish-IcingaPluginDocumentation.psm1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@ function Publish-IcingaPluginDocumentation()
4747
Add-Content -Path $PluginDocFile -Value '\_ [WARNING] Core Total: 29,14817700% is greater than threshold 20% (15m avg.)';
4848
Add-Content -Path $PluginDocFile -Value "| 'core_total_1'=31.545677%;;;0;100 'core_total_15'=29.148177%;20;40;0;100 'core_total_5'=28.827410%;;;0;100 'core_total_20'=30.032942%;;;0;100 'core_total_3'=27.731669%;;;0;100 'core_total'=33.87817%;;;0;100";
4949
Add-Content -Path $PluginDocFile -Value '```';
50+
Add-Content -Path $PluginDocFile -Value ''
51+
Add-Content -Path $PluginDocFile -Value '| Plugin Name | Description |'
52+
Add-Content -Path $PluginDocFile -Value '| --- | --- |'
5053

5154
$AvailablePlugins = Get-ChildItem -Path $PluginDir -Recurse -Filter *.psm1;
5255
foreach ($plugin in $AvailablePlugins) {
5356
[string]$PluginName = $plugin.Name.Replace('.psm1', '');
5457
[string]$PluginDocName = '';
58+
$PluginDetails = Get-Help -Name $PluginName -Full;
5559
foreach ($DocFile in $MDFiles) {
5660
$DocFileName = $DocFile.Name;
5761
if ($DocFileName -Like "*$PluginName.md") {
@@ -73,9 +77,10 @@ function Publish-IcingaPluginDocumentation()
7377
[string]$PluginDescriptionFile = Join-Path -Path $PluginDocDir -ChildPath $PluginDocName;
7478

7579
Add-Content -Path $PluginDocFile -Value ([string]::Format(
76-
'* [{0}](plugins/{1})',
80+
'| [{0}](plugins/{1}) | {2} |',
7781
$PluginName,
78-
$PluginDocName
82+
$PluginDocName,
83+
$PluginDetails.Synopsis
7984
));
8085

8186
$PluginHelp = Get-Help $PluginName -Full;
@@ -136,10 +141,6 @@ function Publish-IcingaPluginDocumentation()
136141
foreach ($example in $PluginHelp.examples.example) {
137142
[string]$ExampleDescription = $example.remarks.Text;
138143
if ([string]::IsNullOrEmpty($ExampleDescription) -eq $FALSE) {
139-
$ExampleDescription = $ExampleDescription.Replace("`r`n", '');
140-
$ExampleDescription = $ExampleDescription.Replace("`r", '');
141-
$ExampleDescription = $ExampleDescription.Replace("`n", '');
142-
$ExampleDescription = $ExampleDescription.Replace(' ', '');
143144
}
144145

145146
Add-Content -Path $PluginDescriptionFile -Value ([string]::Format('### Example Command {0}', $ExampleIndex));

0 commit comments

Comments
 (0)