1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
#!/bin/sh
inputfile="index.docbook"
outputfile="index.html"
#qhpfile="qtikz.qhp"
qchfile="qtikz.qch"
qhcpfile="qtikz.qhcp"
qhcfile="qtikz.qhc"
usage()
{
progname=`echo $0 | sed -e "s/[^\/]*\///g"`
cat << EOF
Usage: $progname [OPTIONS]
Options:
-c|--clean remove ${qchfile} and ${qhcfile}
--qhc generate ${qhcfile}; without this option,
only ${outputfile} is generated
EOF
}
cleanup()
{
rm ${outputfile} ${qchfile} ${qhcfile}
}
generate_html()
{
ksgmltoolsdir="`kde4-config --install data --expandvars`/ksgmltools2"
dtddir="${ksgmltoolsdir}/customization/dtd"
# xslfile="${ksgmltoolsdir}/docbook/xsl/html/docbook.xsl"
# xslfile="${ksgmltoolsdir}/customization/kde-chunk.xsl"
xslfile="/usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl"
xsltproc --path ${dtddir} -o ${outputfile} ${xslfile} ${inputfile}
sed -e "s/<head>/<head><meta http-equiv=\"Content-Style-Type\" content=\"text\/css\"><link href=\"index.css\" rel=\"stylesheet\" type=\"text\/css\">/" \
-e "s/KtikZ/QtikZ/g" \
-e "s/cmake/qmake/g" \
-e "s/<acronym class=\"acronym\">KDE<\/acronym>/Qt/g" \
-e "s/KDE/Qt/g" \
-e "s/kdebase and kdelibs from [^,]*,/Qt 4.4/g" \
${outputfile} > ${outputfile}_temp
# Remove information about "Report Bug" and "Switch Application Language" items in the Help menu which do not exist in the Qt-only version
sed -e ":a;s/<dt><span class=\"term\"><span class=\"guimenu\">Help<\/span> → <span class=\"guimenuitem\">Report Bug.*for this application\.<\/p><\/dd>//;/</N;//ba" \
${outputfile}_temp > ${outputfile}
# Remove duplicate "Qt 4.4" in the "Compilation and Installation" section
# Remove instructions about "Show Statusbar", "Configure Shortcuts" and "Configure Toolbars" which do not exist in the Qt-only version
sed -e "s/Qt 4.4, Qt 4.4/Qt 4.4,/" \
-e "/term-commands-show-statusbar/,/toolbar\.<\/p><\/dd>/d" \
${outputfile} > ${outputfile}_temp
mv ${outputfile}_temp ${outputfile}
}
generate_qhc()
{
generate_html
#qhelpgenerator ${qhpfile} -o ${qchfile} # this is already done in the following step (see <docFiles> in ${qhcpfile})
qcollectiongenerator ${qhcpfile} -o ${qhcfile}
}
while test x"$1" != x
do
case $1 in
-h|--help)
usage
exit 0;;
-c|--clean)
cleanup
exit 0;;
--qhc)
generate_qhc
exit 0;;
*) shift;;
esac
done
generate_html
|