-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add code to convert downloaded manpage to html
- Loading branch information
TCY16
committed
Dec 10, 2021
1 parent
a71b51b
commit 32f5586
Showing
5 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ build/ | |
.DS_Store | ||
.vscode | ||
source/_build | ||
source/unbound-* | ||
source/unbound-* | ||
source/manpages/example.conf* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Unbound Website Sitetools man2pre.sh | ||
# makes nicely formatted manual page in a <pre> block. | ||
# first argument: manual page source. | ||
# second argument: destination file. | ||
|
||
if test "$#" -ne 2; then | ||
echo "usage: man2pre <manpage.8> <destfile.html>" | ||
echo "for unbound website tools" | ||
exit 1 | ||
fi | ||
echo "man2pre from $1 to $2" | ||
|
||
sed s!\<title\>\</title\>!\<title\>$(basename $1)\</title\>! man_header.html > $2 | ||
echo '<pre class="man">' >> $2 | ||
# exclude the ul and sed statements for plain ascii. | ||
# col -b removes backspaces. expand removes tabs. | ||
# the ul fails on Fedora now, we can parse the groff output right away. | ||
if groff -man -Tascii $1 | ul -txterm >/dev/null 2>&1; then | ||
groff -man -Tascii $1 | ul -txterm | sed -e "s?<?\<?g" -e "s?>?\>?g" | sed -e 's?\[1m?<b>?g' -e 's?(B\[m?</b>?g' | sed -e 's?\[4m\[22m?</b><i>?g' -e 's?\[m?</b>?g' -e 's?\[m\000?</b>?g' -e 's?\[4m?<i>?g' -e 's?\[24m?</i>?g' -e 's?<\([bi]\)>\([^<]*\)\[0m?<\1>\2</\1>?g' -e 's?\[22m?</b>?g' | col -b | expand >> $2 | ||
else | ||
groff -man -Tascii $1 | sed -e "s?<?\<?g" -e "s?>?\>?g" | sed -e 's?\[1m?<b>?g' -e 's?(B\[m?</b>?g' | sed -e 's?\[4m\[22m?</b><i>?g' -e 's?\[m?</b>?g' -e 's?\[m\000?</b>?g' -e 's?\[4m?<i>?g' -e 's?\[24m?</i>?g' -e 's?<\([bi]\)>\([^<]*\)\[0m?<\1>\2</\1>?g' -e 's?\[22m?</b>?g' | col -b | expand >> $2 | ||
fi | ||
echo '</pre>' >> $2 | ||
#echo '<div id="writings"><div class="footer" style="border:0; font-size: 60%;">Generated from manual pages of version ' >> $2 | ||
#cat version.txt >> $2 | ||
cat man_footer.html >> $2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<html> | ||
<head> | ||
<title></title> | ||
<meta name="template" content="documentation/unbound_main" /> | ||
<meta name="is_man_subpage" content="True" /> | ||
</head> | ||
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
</body></html> |