Changeset View
Changeset View
Standalone View
Standalone View
share/mk/doc.docbook.mk
Context not available. | |||||
${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 ------------------------------------------------------- | |||||
# path to the English version to be translated | |||||
ENGDOCDIR= ${PWD:S/${LANGCODE}/en_US.ISO8859-1/} | |||||
hrs: Please do not use $PWD and use $DOC_PREFIX. Current doc.*.mk are also broken in this regard… | |||||
# detect the document type from the path, and make it singular for use in the DTD | |||||
# just removing the trailing "s" is less safe than distinct replacements | |||||
SRCDOCTYPE= ${PWD:H:T:S/articles/article/:S/books/book/} | |||||
# DTD for inclusion in translated documents | |||||
FREEBSDDTD= <!DOCTYPE ${SRCDOCTYPE} PUBLIC \"-//FreeBSD//DTD DocBook XML V5.0-Based Extension//EN\" \"http://www.FreeBSD.org/XML/share/xml/freebsd50.dtd\"> | |||||
# create a po file for translations | |||||
po ${DOC}.po: ${XML_INCLUDES} | |||||
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… | |||||
${MAKE} -C ${ENGDOCDIR} ${DOC}.parsed.xml | |||||
${ITSTOOL} -k -o ${DOC}.po.tmp ${ENGDOCDIR}/${DOC}.parsed.xml | |||||
( if [ -f "${DOC}.po" ]; then \ | |||||
echo "${DOC}.po exists, merging" ; \ | |||||
${MSGMERGE} -o ${DOC}.po.new ${DOC}.po ${DOC}.po.tmp ; \ | |||||
${MV} ${DOC}.po.new ${DOC}.po ; \ | |||||
${RM} ${DOC}.po.tmp ; \ | |||||
else \ | |||||
${MV} ${DOC}.po.tmp ${DOC}.po ; \ | |||||
fi ) | |||||
# create the translated ${DOC}.xml from the .po file. | |||||
tran: ${DOC}.po | |||||
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… | |||||
# abort if there is an existing ${DOC}.xml? | |||||
${MSGFMT} -o ${DOC}.mo ${DOC}.po | |||||
${ITSTOOL} -l ${LANGCODE:S/_.*//} -k -m ${DOC}.mo -o ${DOC}.xml ${ENGDOCDIR}/${DOC}.parsed.xml | |||||
# put the FreeBSD DTD back in after line 1 | |||||
${SED} -i'' -e "1a \\${.newline}${FREEBSDDTD}${.newline}" ${DOC}.xml | |||||
# XHTML ------------------------------------------------------------- | # XHTML ------------------------------------------------------------- | ||||
index.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ | index.html: ${DOC}.parsed.xml ${LOCAL_IMAGES_LIB} ${LOCAL_IMAGES_PNG} \ | ||||
Context not available. | |||||
Not Done Inline ActionsWhy can we assume UTF-8 here? hrs: Why can we assume UTF-8 here? |
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.