Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Mar 2002 14:50:55 +0200
From:      Peter Pentchev <roam@ringlet.net>
To:        doc@FreeBSD.org
Subject:   RFC: dynamically generated MASTERDOC?
Message-ID:  <20020313145055.B1288@straylight.oblivion.bg>

next in thread | raw e-mail | index | archive | help

--jy6Sn24JjFx/iggw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

For some time now, I have been fooling myself that I am working
on a Bulgarian translation of the FDP.  However, today I actually
sat down and tried to fix some of the more obvious bogons in what
I had done so far.  In doing so, I stumbled into some weirdness
in docproj.mk's handling of document files.

First of all, some background.  In CP1251 (or windows-12512), which
is the character set most widely used for Bulgarian Cyrillic documents,
the lowercase letter 'ja' has a character code of 255.  This, needless
to say, confuzzles jade (as it should rightfully confuzzle any SGML
validator), and the only way this character can be represented is by
using the &#1130; SGML entity.  However, using &#1130; instead of
the letter 'ja' throughout the documentation is cumbersome to say
the least, so I came up with the idea of generating the article.sgml
(or chapter, or book) dynamically, using a simple sed(1) substitution.

This led to another problem - the generated article.sgml file is placed
into the obj directory, and doc.docbook.mk defines MASTERDOC to point
explicitly to ${.CURDIR}.  Therefore, I finally came up with the attached
patch, which introduces two new variables - XFORM_CMD and XFORM_ARGS -
and, conditional on their values and the existence of an article-raw.sgml
file, generates the article.sgml and sets MASTERDOC properly.

The truth is, I only tested this with an article build.  I have no idea
whether it will work with a book.  Still, I would like to gather some
opinions on whether people like this change or there is a far better
and faster way of dealing with "strange" characters in .sgml sources.

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
If I were you, who would be reading this sentence?

Index: doc/share/mk/doc.docbook.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/doc/share/mk/doc.docbook.mk,v
retrieving revision 1.62
diff -u -r1.62 doc.docbook.mk
--- doc/share/mk/doc.docbook.mk	25 Feb 2002 14:24:51 -0000	1.62
+++ doc/share/mk/doc.docbook.mk	13 Mar 2002 11:15:45 -0000
@@ -97,7 +97,14 @@
=20
 DOCBOOKSUFFIX?=3D sgml
=20
+.if defined(XFORM_CMD) && exists(${.CURDIR}/${DOC}-raw.${DOCBOOKSUFFIX})
+CLEANFILES+=3D	${DOC}.${DOCBOOKSUFFIX}
+MASTERDOC?=3D	${DOC}.${DOCBOOKSUFFIX}
+${DOC}.${DOCBOOKSUFFIX}:	${DOC}-raw.${DOCBOOKSUFFIX}
+	${XFORM_CMD} ${XFORM_ARGS} < ${.CURDIR}/${DOC}-raw.${DOCBOOKSUFFIX} > ${D=
OC}.${DOCBOOKSUFFIX}
+.else
 MASTERDOC?=3D	${.CURDIR}/${DOC}.${DOCBOOKSUFFIX}
+.endif
=20
 .if ${MACHINE_ARCH} =3D=3D "alpha"
 OPENJADE=3D	yes

--jy6Sn24JjFx/iggw
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjyPSy8ACgkQ7Ri2jRYZRVMNxwCcDcJE52DgFJ5gkRbTkCJgsl6A
gKUAnRqZ32N7jdnPF/2dJz8aNxYFuTsr
=+vyJ
-----END PGP SIGNATURE-----

--jy6Sn24JjFx/iggw--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020313145055.B1288>