commit b7f146655da9f802fe062c31842189a4399ac4f5
parent 900833c5c04bec243e74726ac39d3cc60f34c7b0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Fri, 10 Feb 2023 16:14:47 +0100
Fix convert_man.sh script
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/convert_man.sh b/convert_man.sh
@@ -48,7 +48,7 @@ man_section=$(echo "${input}" \
# After html conversion, the output file is modified to remove its header and
# its footer (that are replaced by ours), and to fix some html patterns that
# are not correctly handled by tidy (see below)
- sed 's/^\.P$/.PP/' ${input} \
+ sed 's/^\.P$/.PP/' "${input}" \
| sed '/^\.PP$/{$!{N;s/\.PP\n\.RE/.RE\n.PP/;t sub;P;D;:sub}}' \
| man2html -r \
| tail -n +10 \
@@ -63,6 +63,7 @@ man_section=$(echo "${input}" \
# Fix the hyperlink toward the GPLv3+ license
# Remove unexpected link on sqrt(2)
# Fix the man2html issues that translates the ' char in cq
+tmp=$(mktemp)
sed\
-e 's/<B><A HREF="\.\.\/man1\/csplit\.1\.html">csplit<\/A><\/B>/csplit/g'\
-e 's/<B><A HREF="\.\.\/man1\/feh\.1\.html">feh<\/A><\/B>/feh/g'\
@@ -72,9 +73,9 @@ sed\
-e 's/<B><A HREF="\.\.\/man2\/mmap\.2\.html">mmap<\/A><\/B>/mmap/g'\
-e 's/gpl\.html\.">\(.*\).<\/A>/gpl.html">\1<\/A>./g'\
-e 's/<A HREF="\.\.\/man2\/sqrt\.2\.html">sqrt<\/A>/sqrt/g'\
- -e "s/cq\([a-z]\)\>/'\1/g" <<EOF >"${output}"
-$(cat "${output}")
-EOF
+ -e "s/cq\([a-z]\)\>/'\1/g" "${output}" > "${tmp}"
+
+mv "${tmp}" "${output}"
# Clean the html file generated by man2html and lint it if necessary
tidy --show-info no -m "${output}" > /dev/null 2>&1 || sh lint_html.sh "${output}"