mirror of
https://github.com/inspec/inspec
synced 2024-11-22 04:33:09 +00:00
Foreport-6384 (#6466)
* DOCS: Generate cli.md with rake docs:cli Signed-off-by: Sonu Saha <sonu.saha@progress.com> * Remove unused require Signed-off-by: Sonu Saha <sonu.saha@progress.com> * FORMAT: Use html dl, dt, dd tags for displaying subcommands Signed-off-by: Sonu Saha <sonu.saha@progress.com> * REFACTOR: Remove repetitive dl closing for subcommands of single command Signed-off-by: Sonu Saha <sonu.saha@progress.com> --------- Signed-off-by: Sonu Saha <sonu.saha@progress.com> Co-authored-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
54c14b43c3
commit
7a33a918b0
2 changed files with 644 additions and 442 deletions
File diff suppressed because it is too large
Load diff
|
@ -14,10 +14,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
require "erb"
|
|
||||||
require "fileutils"
|
require "fileutils"
|
||||||
require "yaml"
|
|
||||||
require "git"
|
|
||||||
|
|
||||||
DOCS_DIR = "docs-chef-io/content/inspec".freeze
|
DOCS_DIR = "docs-chef-io/content/inspec".freeze
|
||||||
|
|
||||||
|
@ -62,7 +59,7 @@ class Markdown
|
||||||
end
|
end
|
||||||
|
|
||||||
def dl(msg)
|
def dl(msg)
|
||||||
"#{msg.gsub("\n", "\n ")}\n"
|
"<dl>\n#{msg}</dl>\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
def ul(msg)
|
def ul(msg)
|
||||||
|
@ -180,12 +177,12 @@ namespace :docs do # rubocop:disable Metrics/BlockLength
|
||||||
usage = opt.usage.split(", ")
|
usage = opt.usage.split(", ")
|
||||||
.map { |x| x.tr("[]", "") }
|
.map { |x| x.tr("[]", "") }
|
||||||
.map { |x| x.start_with?("-") ? x : "-" + x }
|
.map { |x| x.start_with?("-") ? x : "-" + x }
|
||||||
.map { |x| "`" + x + "`" }
|
.map { |x| "<code>" + x + "</code>" }
|
||||||
msg = "#{usage.join(", ")}\n"
|
msg = "<dt>#{usage.join(", ")}</dt>\n"
|
||||||
msg << ": #{opt.description}\n" if opt.description && !opt.description.empty?
|
msg << "<dd>#{opt.description}</dd>\n\n" if opt.description && !opt.description.empty?
|
||||||
list << f.dl(msg)
|
list << msg
|
||||||
end.join
|
end.join
|
||||||
res << f.ul(list)
|
res << f.dl(list)
|
||||||
end
|
end
|
||||||
|
|
||||||
# FIXME: for some reason we have extra lines in our RST; needs investigation
|
# FIXME: for some reason we have extra lines in our RST; needs investigation
|
||||||
|
|
Loading…
Reference in a new issue