aboutsummaryrefslogtreecommitdiff
path: root/hack/markdown-preprocess
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-09 17:22:30 +0200
committerGitHub <noreply@github.com>2022-09-09 17:22:30 +0200
commit94864cbce6e758552c853999951681bfdef93b18 (patch)
tree51304fe1b82fe1f4fa757354977104d9ea2d1dab /hack/markdown-preprocess
parent765dfe0cfb1d761998466e6589ee473018fc1677 (diff)
parent3a9a7dcdcd897cf694bb9935098d3c24c08d01f0 (diff)
downloadpodman-94864cbce6e758552c853999951681bfdef93b18.tar.gz
podman-94864cbce6e758552c853999951681bfdef93b18.tar.bz2
podman-94864cbce6e758552c853999951681bfdef93b18.zip
Merge pull request #15706 from edsantiago/docs_dedup_volume
[CI:DOCS] Man pages: refactor common options: --volume
Diffstat (limited to 'hack/markdown-preprocess')
-rwxr-xr-xhack/markdown-preprocess13
1 files changed, 6 insertions, 7 deletions
diff --git a/hack/markdown-preprocess b/hack/markdown-preprocess
index 68e5890d8..9cd1e9605 100755
--- a/hack/markdown-preprocess
+++ b/hack/markdown-preprocess
@@ -32,9 +32,6 @@ def process(infile):
if '-pod-' in infile or '-kube-' in infile:
pod_or_container = 'pod'
- # Sometimes a man page includes the subcommand.
- subcommand = podman_subcommand(infile)
-
# foo.md.in -> foo.md -- but always write to a tmpfile
outfile = os.path.splitext(infile)[0]
outfile_tmp = outfile + '.tmp.' + str(os.getpid())
@@ -57,7 +54,8 @@ def process(infile):
with open(optionfile, 'r') as fh_optfile:
for opt_line in fh_optfile:
opt_line = replace_type(opt_line, pod_or_container)
- opt_line = opt_line.replace('<<subcommand>>', subcommand)
+ opt_line = opt_line.replace('<<subcommand>>', podman_subcommand(infile))
+ opt_line = opt_line.replace('<<fullsubcommand>>', podman_subcommand(infile, 'full'))
fh_out.write(opt_line)
fh_out.write("\n[//]: # (END included file " + optionfile + ")\n")
else:
@@ -67,10 +65,11 @@ def process(infile):
os.rename(outfile_tmp, outfile)
# Given a file path of the form podman-foo-bar.1.md.in, return "foo bar"
-def podman_subcommand(string: str) -> str:
+def podman_subcommand(string: str, full=None) -> str:
# Special case: 'podman-pod-start' becomes just 'start'
- if string.startswith("podman-pod-"):
- string = string[len("podman-pod-"):]
+ if not full:
+ if string.startswith("podman-pod-"):
+ string = string[len("podman-pod-"):]
if string.startswith("podman-"):
string = string[len("podman-"):]
if string.endswith(".1.md.in"):