2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

boostbook.jam; remove locals when using print.text.

print.jam; reimplement in terms of @() feature.


[SVN r31583]
This commit is contained in:
Rene Rivera
2005-11-06 22:34:44 +00:00
parent 4dc4edd0cc
commit 460df0d63d
2 changed files with 33 additions and 95 deletions

View File

@@ -196,17 +196,19 @@ rule docbook-to-fo ( target : source : properties * )
rule generate-xml-catalog ( target : sources * : properties * )
{
local text = "<?xml version=\"1.0\"?>" ;
print.output $(target) ;
text += "<!DOCTYPE catalog " ;
text += " PUBLIC \"-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN\"" ;
text += " \"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd\">" ;
text += "<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">" ;
# BoostBook DTD catalog entry
local boostbook-dtd-dir = [ boostbook.dtd-dir ] ;
text += " <rewriteURI uriStartString=\"http://www.boost.org/tools/boostbook/dtd/\" rewritePrefix=\"file://$(boostbook-dtd-dir)/\"/>" ;
print.text
"<?xml version=\"1.0\"?>"
"<!DOCTYPE catalog "
" PUBLIC \"-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN\""
" \"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd\">"
"<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">"
" <rewriteURI uriStartString=\"http://www.boost.org/tools/boostbook/dtd/\" rewritePrefix=\"file://$(boostbook-dtd-dir)/\"/>"
: true ;
local docbook-xsl-dir = [ boostbook.docbook-xsl-dir ] ;
if ! $(docbook-xsl-dir)
@@ -221,7 +223,7 @@ rule generate-xml-catalog ( target : sources * : properties * )
}
else
{
text += " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"file://$(docbook-xsl-dir)/\"/>" ;
print.text " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"file://$(docbook-xsl-dir)/\"/>" ;
}
local docbook-dtd-dir = [ boostbook.docbook-dtd-dir ] ;
@@ -237,13 +239,10 @@ rule generate-xml-catalog ( target : sources * : properties * )
}
else
{
text += " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"file://$(docbook-dtd-dir)/\"/>" ;
print.text " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"file://$(docbook-dtd-dir)/\"/>" ;
}
text += "</catalog>" ;
print.output $(target) ;
print.text $(text) : true ;
print.text "</catalog>" ;
}
class boostbook-generator : generator

View File

@@ -318,62 +318,35 @@ rule text (
}
else
{
while $(strings)
for local s in $(strings)
{
ECHO $(strings[1]) ;
strings = $(strings[2-]) ;
ECHO $(s) ;
}
}
}
# We ignore empty output because the Windows ECHO command is
# braindamaged. It doesn't have any facility for echoing a blank line.
else if $(output-target)
if ! $($(output-target).did-action)
{
if ! $($(output-target).did-action)
{
$(output-target).did-action = yes ;
_ on $(output-target) = " " ;
nl on $(output-target) = "
$(output-target).did-action = yes ;
$(output-target).text-prefix = ;
$(output-target).text-body = ;
$(output-target).text-suffix = ;
nl on $(output-target) = "
" ;
text-redirect-0 on $(output-target) = ">>" ;
text-redirect-n on $(output-target) = ">>" ;
text-front on $(output-target) = ;
text-prefix on $(output-target) = ;
text-body on $(output-target) = ;
text-suffix on $(output-target) = ;
text-action $(output-target) ;
text-front-section.$(output-target) = ;
}
text-redirect on $(output-target) = ">>" ;
if $(overwrite)
{
text-redirect-0 on $(output-target) = ">" ;
}
if ! $(text-front-section.$(output-target))
{
text-front on $(output-target) = [ echo-cmd $(strings[1]) ] ;
text-front-section.$(output-target) = $(prefix-body-suffix) ;
strings = $(strings[2-]) ;
}
if $(strings)
{
if ( $(prefix-body-suffix) = prefix &&
$(text-front-section.$(output-target)) != prefix ) ||
( $(prefix-body-suffix) = body &&
$(text-front-section.$(output-target)) = suffix )
{
text-$(text-front-section.$(output-target)) on $(output-target) =
[ on $(output-target) return $(text-front) ]
[ on $(output-target) return $(text-$(text-front-section.$(output-target))) ] ;
text-front on $(output-target) = [ echo-cmd $(strings[1]) ] ;
text-front-section.$(output-target) = $(prefix-body-suffix) ;
strings = $(strings[2-]) ;
}
for local string-n in $(strings)
{
text-$(prefix-body-suffix) on $(output-target) += [ echo-cmd $(string-n) ] ;
}
text-redirect on $(output-target) = ">" ;
}
text-content on $(output-target) = ;
text-action $(output-target) ;
}
$(output-target).text-$(prefix-body-suffix) += $(strings) ;
text-content on $(output-target) =
$($(output-target).text-prefix)
$($(output-target).text-body)
$($(output-target).text-suffix) ;
}
# Outputs the text to the current targets, after word-wrapping it.
@@ -414,41 +387,7 @@ rule escape-html (
#
actions quietly text-action
{
$(text-front)$(_)$(text-redirect-0)$(_)"$(<)"
$(text-prefix)$(_)$(text-redirect-n)$(_)"$(<)"$(nl)
$(text-body)$(_)$(text-redirect-n)$(_)"$(<)"$(nl)
$(text-suffix)$(_)$(text-redirect-n)$(_)"$(<)"$(nl)
}
if [ modules.peek : NT ]
{
rule echo-cmd ( string ? )
{
if $(string) || $(string) != ""
{
local escaped = [ regex.escape $(string) : "&|()<>^" : "^" ] ;
return "echo $(escaped)" ;
}
else
{
return "echo." ;
}
}
}
else
{
rule echo-cmd ( string ? )
{
if $(string) || $(string) != ""
{
local escaped = [ regex.escape $(string) : "\\\"" : "\\" ] ;
return "echo \"$(escaped)\"" ;
}
else
{
return "echo" ;
}
}
@($(STDOUT):E=$(text-content:J=$(nl))) $(text-redirect) "$(<)"
}
local rule __test__ ( )