aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2019-12-15 18:21:00 +0100
committerUlrich Müller <ulm@gentoo.org>2019-12-15 18:21:00 +0100
commit1a48b2360b0be82bd6f2c828142859235c44a0b3 (patch)
tree7b61d5d42434607cc6c054755355f4c7dab230f6 /bin
parentbin/gen-eclass-html.sh: Move header into a variable. (diff)
downloaddevmanual-1a48b2360b0be82bd6f2c828142859235c44a0b3.tar.gz
devmanual-1a48b2360b0be82bd6f2c828142859235c44a0b3.tar.bz2
devmanual-1a48b2360b0be82bd6f2c828142859235c44a0b3.zip
bin/gen-eclass-html.sh: Fix regexp for link substitution.
The previous regexp was too greedy and combined several links into one, if they were on the same line. Remove dead relative links (i.e., not pointing to other eclasses). Replace the complicated "tail" command by a simple "1,4d" in sed. This also makes the temporary file unnecessary. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gen-eclass-html.sh15
1 files changed, 6 insertions, 9 deletions
diff --git a/bin/gen-eclass-html.sh b/bin/gen-eclass-html.sh
index 5ccfc71..b557093 100755
--- a/bin/gen-eclass-html.sh
+++ b/bin/gen-eclass-html.sh
@@ -98,20 +98,17 @@ for i in $(/usr/bin/qlist eclass-manpages) /usr/share/man/man5/ebuild.5*; do
BASENAME="${FILEBASE%.5*}"
[[ ${BASENAME} != "${FILEBASE}" ]] || continue
DIRNAME="${OUTPUTDIR}/${BASENAME}"
- TMP="${DIRNAME}/index.html.tmp"
FINAL="${DIRNAME}/index.html"
DECOMPRESS=$(guesscompress "${i}")
[[ -d ${DIRNAME} ]] || mkdir -p ${DIRNAME}
# rebuild the man page each time
echo -n "${HEADER//@TITLE@/${BASENAME}}" > "${FINAL}"
- # generate html pages and fix hyperlinks for eclass and ebuild man pages
- $DECOMPRESS "$i" | /usr/bin/man2html -r - | \
- sed -e "/<A HREF=/s:=.*man.*/\(.*eclass\).*html\">:=../\1/index.html>:" \
- -e "/<\/BODY>/d" -e "/<\/HTML>/d" \
- -e "/<A HREF=/s:=.*man.*/\(.*ebuild\).*html\">:=../\1/\index.html>:" >> ${TMP}
- # The first 4 lines are cruft for devmanual
- tail -n $(($(wc -l ${TMP} | awk '{print $1}') - 4)) ${TMP} >> ${FINAL}
- rm -f ${TMP}
+ # generate html pages and fix hyperlinks for eclass and ebuild man pages
+ ${DECOMPRESS} "${i}" | /usr/bin/man2html -r - \
+ | sed -e "1,4d;/<\/BODY>/d;/<\/HTML>/d" \
+ -e '/<A HREF=/s:"\.\./man5/\([^"]*eclass\|ebuild\)\.5\.html":"../\1/index.html":g' \
+ -e 's:<A HREF="\.\./man[^"]*">\([^<>]*\)</A>:\1:g' \
+ >> "${FINAL}"
echo -n "${FOOTER}" >> "${FINAL}"
done