Changeset View
Changeset View
Standalone View
Standalone View
share/mk/doc.docbook.mk
Show First 20 Lines • Show All 125 Lines • ▼ Show 20 Lines | |||||
# | # | ||||
.if ${.OBJDIR} != ${.CURDIR} | .if ${.OBJDIR} != ${.CURDIR} | ||||
LOCAL_CSS_SHEET= ${.OBJDIR}/${CSS_SHEET:T} | LOCAL_CSS_SHEET= ${.OBJDIR}/${CSS_SHEET:T} | ||||
.else | .else | ||||
LOCAL_CSS_SHEET= ${CSS_SHEET:T} | LOCAL_CSS_SHEET= ${CSS_SHEET:T} | ||||
.endif | .endif | ||||
CLEANFILES+= ${DOC}.parsed.xml ${DOC}.parsed.print.xml | CLEANFILES+= ${DOC}.parsed.xml ${DOC}.parsed.print.xml ${DOC}.translate.xml | ||||
.if ${FORMATS:R:Mhtml-split} && ${FORMATS:R:Mhtml} | .if ${FORMATS:R:Mhtml-split} && ${FORMATS:R:Mhtml} | ||||
XSLTPROCOPTS+= --param docformatnav "'1'" | XSLTPROCOPTS+= --param docformatnav "'1'" | ||||
.endif | .endif | ||||
.for _curformat in ${FORMATS} | .for _curformat in ${FORMATS} | ||||
_cf=${_curformat} | _cf=${_curformat} | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | .if defined(PROFILING) | ||||
@${ECHO} "==> Profiling" | @${ECHO} "==> Profiling" | ||||
${XSLTPROC} ${PROFILING} ${XSLPROF} ${.TARGET}.tmp > ${.TARGET} | ${XSLTPROC} ${PROFILING} ${XSLPROF} ${.TARGET}.tmp > ${.TARGET} | ||||
${RM} ${.TARGET}.tmp | ${RM} ${.TARGET}.tmp | ||||
.else | .else | ||||
${MV} ${.TARGET}.tmp ${.TARGET} | ${MV} ${.TARGET}.tmp ${.TARGET} | ||||
.endif | .endif | ||||
${SED} 's|@@URL_RELPREFIX@@|http://www.FreeBSD.org|g' < ${.TARGET} > ${DOC}.parsed.print.xml | ${SED} 's|@@URL_RELPREFIX@@|http://www.FreeBSD.org|g' < ${.TARGET} > ${DOC}.parsed.print.xml | ||||
${SED} -i '' -e 's|@@URL_RELPREFIX@@|../../../..|g' ${.TARGET} | ${SED} -i '' -e 's|@@URL_RELPREFIX@@|../../../..|g' ${.TARGET} | ||||
# translation ------------------------------------------------------- | |||||
# choice of PO software, po4a or itstool | |||||
POSOFT?= po4a | |||||
hrs: Please do not use $PWD and use $DOC_PREFIX. Current doc.*.mk are also broken in this regard… | |||||
POFILE?= ${LANGCODE:C/_.*$//} | |||||
# create a po file for translations | |||||
po ${POFILE}.po: ${XML_INCLUDES:S/${LANGCODE}/en_US.ISO8859-1/} | |||||
# create the normalized translation file | |||||
@${XMLLINT} --nonet --valid --xinclude \ | |||||
${MASTERDOC:S/${LANGCODE}/en_US.ISO8859-1/} > ${DOC}.translate.tmp | |||||
# remove redundant xmlns:xlink attributes | |||||
Done Inline ActionsPlease consider to define a proper makefile target for a po file. Once we have such a target, make(1) can detect an old .po file compared to the xml file and kick a target for merge. hrs: Please consider to define a proper makefile target for a po file. Once we have such a target… | |||||
# ** this needs to be fixed to work with --nonet ** | |||||
@${XMLLINT} --nocatalogs --nsclean ${DOC}.translate.tmp > ${DOC}.translate.xml 2>/dev/null | |||||
@${RM} ${DOC}.translate.tmp | |||||
# generate the PO file from the normalized file | |||||
.if ${POSOFT:Mpo4a} | |||||
@${PO4AGETTEXTIZE} -p ${POFILE}.po.tmp -m ${DOC}.translate.xml -f docbook \ | |||||
-M UTF-8 -L UTF-8 --copyright-holder 'not set' | |||||
.elif ${POSOFT:Mitstool} | |||||
@${ITSTOOL} -k -o ${POFILE}.po.tmp ${DOC}.translate.xml | |||||
.else | |||||
.error "\"${POSOFT}\" not recognized, set POSOFT to po4a or itstool" | |||||
.endif | |||||
# if a PO file is already present, merge it | |||||
Not Done Inline ActionsPlease do not edit XML file by using sed or something which does not understand document structure. It can break DTD conformance and generally is not allowed in XML processing the doc tree. Eliminating redundant namespace attributes can be done --nsclean option in xmllint, for example. hrs: Please do not edit XML file by using sed or something which does not understand document… | |||||
# this needs thought, need to delete old translations | |||||
# that are no longer needed by the English document | |||||
@( if [ -f "${POFILE}.po" ]; then \ | |||||
echo "${POFILE}.po exists, merging" ; \ | |||||
${MSGMERGE} -o ${POFILE}.po.new ${POFILE}.po ${POFILE}.po.tmp ; \ | |||||
${MV} ${POFILE}.po.new ${POFILE}.po ; \ | |||||
${RM} ${POFILE}.po.tmp ; \ | |||||
else \ | |||||
${MV} ${POFILE}.po.tmp ${POFILE}.po ; \ | |||||
fi ) | |||||
Not Done Inline ActionsWhy can we assume UTF-8 here? hrs: Why can we assume UTF-8 here? | |||||
tran: ${POFILE}.po | |||||
.if ${POSOFT:Mpo4a} | |||||
@${PO4ATRANSLATE} -p ${POFILE}.po -f docbook -m ${DOC}.translate.xml \ | |||||
-M UTF-8 -L UTF-8 -l ${DOC}.xml -k 0 | |||||
.elif ${POSOFT:Mitstool} | |||||
@${ITSTOOL} -k -l ${LANGCODE:S/_.*//} -m ${POFILE}.mo -o ${DOC}.xml ${DOC}.translate.xml | |||||
.else | |||||
.error "\"${POSOFT}\" not recognized, set POSOFT to po4a or itstool" | |||||
.endif | |||||
# XHTML ------------------------------------------------------------- | # XHTML ------------------------------------------------------------- | ||||
index.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ | index.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ | ||||
${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET} ${XML_INCLUDES} | ${HTML_SPLIT_INDEX} ${LOCAL_CSS_SHEET} ${XML_INCLUDES} | ||||
${XSLTPROC} ${XSLTPROCOPTS} ${XSLXHTMLCHUNK} ${DOC}.parsed.xml | ${XSLTPROC} ${XSLTPROCOPTS} ${XSLXHTMLCHUNK} ${DOC}.parsed.xml | ||||
${DOC}.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ | ${DOC}.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ | ||||
▲ Show 20 Lines • Show All 445 Lines • Show Last 20 Lines |
Please do not use $PWD and use $DOC_PREFIX. Current doc.*.mk are also broken in this regard, but current directory should be carefully handled because make(1) uses OBJDIR.