press-release/tools Makefile, NONE, 1.1 fdp-pr.dtd, NONE, 1.1 params.xsl.in, NONE, 1.1

Tommy Reynolds (jtr) fedora-docs-commits at redhat.com
Sun Aug 13 18:40:49 UTC 2006


Author: jtr

Update of /cvs/docs/press-release/tools
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv10234/tools

Added Files:
	Makefile fdp-pr.dtd params.xsl.in 
Log Message:
Interim re-organization.  Stand back.  Do not try this at home.



--- NEW FILE Makefile ---
########################################################################
# The ${DOC_BASE} symbol provides the basic name for this document.
DOC_BASE=fdp-pr
########################################################################
# The ${PRI_LANG} symbol gives the locale for the original language for 
# the document.
PRI_LANG=en_US
########################################################################
# The ${OTHERS} symbol is a list of additional locales into which the
# document is to be translated.
# OTHERS=de es it no
OTHERS=pt
########################################################################
# WARNING!  Make no changes below this line or you will void the
# warranty ;-)
########################################################################
# Provide some utility macros
XMLTO	=xmlto
XMLTOFLAGS=-m params.xsl
XSL	=fdp-pr.xsl
SED    =/bin/sed
XML2PO	=xml2po
MSGMERGE=msgmerge
MSGMERGEFLAGS=
########################################################################
LANGUAGES=${PRI_LANG} ${OTHERS}
########################################################################
# Define our own set of suffixes to streamline the process
.SUFFIXES:
.SUFFIXES:	.txt	.pdf	.po	.pot	.xml	.xsl	.dtd	.in
########################################################################
# Mark the proper virtual targets so that a "make -t all" does not create
# an empty file called "all".
.PHONY:	all clean distclean clobber pot help
########################################################################
# The default target "all"
all::	${DOC_BASE}.pot
all::	$(foreach LOCALE,${LANGUAGES},${DOC_BASE}-${LOCALE}.pdf)
# FIXME all::	$(foreach LOCALE,${LANGUAGES},${DOC_BASE}-${LOCALE}.txt)
########################################################################
HFMT	=%-31s\t%s\n
help::
	@printf "${HFMT}" "all" "Default target; generate PDF's"
	@printf "${HFMT}" "clean" "Delete temporary files"
	@printf "${HFMT}" "distclean" "Delete output and temporary files"
	@printf "${HFMT}" "clobber" "Delete output and temporary files"
	@printf "${HFMT}" "help" "This message; use 'make help|sort'"
########################################################################
# Compute the rules to transform our XML documents into both PDF and TXT
# forms
define	PDF_template
.PHONY:	pdf-${1}

pdf-${1}:: ${DOC_BASE}-${1}.pdf

help::
	@printf "${HFMT}" "pdf-${1}" "Generate PDF for locale '${1}'"

${DOC_BASE}-$(1).pdf::	${DOC_BASE}-$(1).xml params.xsl.in ${XSL}
	LC_ALL=${1}.UTF-8 ${SED} 					\
	       -e "s|DATE|$$(shell LC_ALL=${1} date +'%x %X')|" 	\
	       -e "s|LANG|${1}|"					\
	       params.xsl.in >params.xsl
	LC_ALL=${1}.UTF-8 ${XMLTO} -x ${XSL} ${XMLTOFLAGS} pdf 		\
	       ${DOC_BASE}-$(1).xml

help::
	@printf "${HFMT}" "${DOC_BASE}-${1}.pdf" "Render PDF for locale '${1}'"

distclean::
	${RM} ${DOC_BASE}-${1}.pdf
endef

$(foreach LOCALE,${LANGUAGES},$(eval $(call PDF_template,${LOCALE})))
########################################################################

########################################################################
define	TXT_template
# This assumes w3m(1) is installed.  The stock xmlto RPM uses it.
XMLPOSTFLAGS=-p '-cols 72'

.PHONY:	txt-${1}

txt-${1}:: ${DOC_BASE}-${1}.txt

help::
	@printf "${HFMT}" "txt-${1}" "Generate text version for locale '${1}'"

${DOC_BASE}-$(1).txt::	${DOC_BASE}-$(1).xml params.xsl.in ${XSL}
	LC_ALL=${1}.UTF-8 ${SED} 					\
	       -e "s|DATE|$$(shell LC_ALL=${1} date +'%x %X')|"		\
	       params.xsl.in >params.xsl
	LC_ALL=${1}.UTF-8 ${XMLTO} -x ${XSL} ${XMLTOFLAGS} $${XMLPOSTFLAGS} \
	       txt ${DOC_BASE}-$(1).xml

help::
	@printf "${HFMT}" "${DOC_BASE}-${1}.txt" "Render locale '${1}' text"

distclean::
	${RM} ${DOC_BASE}-${1}.txt
endef
# FIXME $(foreach LOCALE,${LANGUAGES},$(eval $(call TXT_template,${LOCALE})))
########################################################################
# Always generate the current date.
params.xsl: params.xsl.in Makefile
	${SED} -e "s|DATE|$$(LC_ALL=${PRI_LANG} date +'%x %X')|" 	\
	       -e "s|LANG|${PRI_LANG}|"					\
		$< >$@.tmp && move-if-change $@.tmp $@

help::
	@printf "${HFMT}" "params.xsl" "Generate dynamic parameters"
########################################################################
# The ${DOC_BASE}.pot target produces a new .POT file everytime the
# original XML file is updated.
.PHONY:	pot

pot::	${DOC_BASE}.pot

help::
	@printf "${HFMT}" "pot" "Generate .POT file for translation"

${DOC_BASE}.pot:: ${DOC_BASE}-${PRI_LANG}.xml
	xml2po -o $@ $<

help::
	@printf "${HFMT}" "${DOC_BASE}.pot" "Generate .POT file for translation"
########################################################################
# Compute the rules to create or update a language-specific .po file
# any time the ${DOC_BASE}.pot file is updated.  We try to avoid losing
# current .PO translations by calling msgmerge if a .po file already 
# exists.
define PO_template
.PHONY:	po-${1}
po-${1}::	${1}.po

help::
	@printf "${HFMT}" "po-${1}" "Update translations for locale '${1}'"

.PRECIOUS: ${1}.po
${1}.po:: ${DOC_BASE}.pot
	@if [ ! -f ${1}.po ]; then					\
		echo Creating pristine ${1}.po;				\
		cp ${DOC_BASE}.pot ${1}.po;				\
	else								\
		echo Updating existing ${1}.po;				\
		${MSGMERGE} ${MSGMERGEFLAGS} 				\
			${1}.po $${DOC_BASE}.pot >${1}.po;		\
	fi

help::
	@printf "${HFMT}" "${1}.po" "Update translations for locale '${1}'"
endef

$(foreach LOCALE,${OTHERS},$(eval $(call PO_template,${LOCALE})))
########################################################################
# Compute the rules and targets to generate the translated XML files
# given an updated .PO file and the source XML file.
define NEWLANG_template
.PHONY:	xml-${1}
xml-${1}::	${DOC_BASE}-${1}.xml

help::
	@printf "${HFMT}" "xml-${1}" "Translate XML for locale '${1}'"

${DOC_BASE}-${1}.xml:: ${DOC_BASE}-${PRI_LANG}.xml ${1}.po
	${XML2PO} -p ${1}.po ${DOC_BASE}-${PRI_LANG}.xml >${DOC_BASE}-${1}.xml

help::
	@printf "${HFMT}" "${DOC_BASE}-${1}.xml" "Create XML for locale '${1}'"

clean::
	${RM} ${DOC_BASE}-${1}.xml
endef

$(foreach LOCALE,${OTHERS},$(eval $(call NEWLANG_template,${LOCALE})))

.PHONY:	xml-${PRI_LANG}

xml-${PRI_LANG}:: ${DOC_BASE}-${PRI_LANG}.xml

help::
	@printf "${HFMT}" "${DOC_BASE}-${PRI_LANG}.xml" "Primary XML"
########################################################################
clean::
	${RM} params.xsl
distclean clobber:: clean
########################################################################
.PHONY:	mrproper
mrproper:: distclean
	${RM} *.pot
	${RM} *.po
	${RM} *.pdf
	${RM} *.txt
########################################################################
# End of Makefile
########################################################################


--- NEW FILE fdp-pr.dtd ---
<!ELEMENT fdp-pr			(source,(header|para|list)+)	>
<!ATTLIST fdp-pr	embargo		CDATA	"FOR IMMEDIATE RELEASE"	>
<!ATTLIST fdp-pr	end		CDATA	"# # #"			>
<!ATTLIST fdp-pr	lang		CDATA	"en"			>
<!ATTLIST fdp-pr	org		CDATA	"FEDORA PROJECT"	>
<!ATTLIST fdp-pr	kind		CDATA	"PRESS RELEASE"		>
<!ATTLIST fdp-pr       spare           CDATA   ""                     >
<!ELEMENT source			(#PCDATA)			>

<!ELEMENT para				(#PCDATA|ulink|dateline)*	>
<!ELEMENT header			(#PCDATA)			>

<!ELEMENT list				(item+)				>
<!ATTLIST list		mark		(star|dot)	"star"		>
<!ELEMENT item				(#PCDATA|ulink)*		>

<!ELEMENT ulink				EMPTY				>
<!ATTLIST ulink		url		CDATA		#REQUIRED	>

<!ELEMENT dateline                     (location,date)                >
<!ELEMENT location                      (#PCDATA)                     >
<!ELEMENT date                          (#PCDATA)                     >
<!ATTLIST date          format          (iso)  	#REQUIRED       >


--- NEW FILE params.xsl.in ---
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <!--
    The 'today' value is provided by the Makefile, so please do not edit this definition yourself!
  -->
  <xsl:param name="today">DATE</xsl:param>
  <xsl:param name="lang">LANG</xsl:param>
  <!--
    <xsl:param name="font">Verdana</xsl:param>
    <xsl:param name="font.size.header">12pt</xsl:param>
    <xsl:param name="font.size.body">12pt</xsl:param>
    <xsl:param name="font.size.footer">12pt</xsl:param>
    -->
</xsl:stylesheet>




More information about the docs-commits mailing list