mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 01:12:13 +00:00
print.jam: Provide escaped strings for Windows and Unix
regex.jam: Provide "escape" routine that escapes a string with certain escape characters boostbook.jam: Use print.escape to properly escape argument to "echo" on Windows and Unix (BoostBook now works on non-Cygwin Windows) [SVN r18148]
This commit is contained in:
@@ -72,18 +72,14 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
|
||||
xsltroc = [ modules.peek : XSLTPROC ] ;
|
||||
}
|
||||
|
||||
boostbook-xsl-dir = [ modules.peek : BOOST_ROOT ] ;
|
||||
boostbook-xsl-dir = $(boostbook-xsl-dir)/tools/boostbook/xsl ;
|
||||
boostbook-dtd-dir = [ modules.peek : BOOST_ROOT ] ;
|
||||
boostbook-dtd-dir = $(boostbook-dtd-dir)/tools/boostbook/dtd ;
|
||||
|
||||
if ! $(.initialized)
|
||||
{
|
||||
$(.initialized) = true ;
|
||||
.docbook-xsl-dir = $(docbook-xsl-dir) ;
|
||||
.docbook-dtd-dir = $(docbook-dtd-dir) ;
|
||||
.boostbook-xsl-dir = $(boostbook-xsl-dir) ;
|
||||
.boostbook-dtd-dir = $(boostbook-dtd-dir) ;
|
||||
.docbook-xsl-dir = [ path.make $(docbook-xsl-dir) ] ;
|
||||
.docbook-dtd-dir = [ path.make $(docbook-dtd-dir) ] ;
|
||||
local boost-root = [ path.make [ modules.peek : BOOST_ROOT ] ] ;
|
||||
.boostbook-xsl-dir = [ path.join $(boost-root) tools boostbook xsl/ ] ;
|
||||
.boostbook-dtd-dir = [ path.join $(boost-root) tools boostbook dtd/ ] ;
|
||||
.xsltproc = $(xsltproc) ;
|
||||
}
|
||||
}
|
||||
@@ -93,6 +89,21 @@ rule xsl-dir
|
||||
return $(.boostbook-xsl-dir) ;
|
||||
}
|
||||
|
||||
rule dtd-dir
|
||||
{
|
||||
return $(.boostbook-dtd-dir) ;
|
||||
}
|
||||
|
||||
rule docbook-xsl-dir
|
||||
{
|
||||
return $(.docbook-xsl-dir) ;
|
||||
}
|
||||
|
||||
rule docbook-dtd-dir
|
||||
{
|
||||
return $(.docbook-dtd-dir) ;
|
||||
}
|
||||
|
||||
rule xslt ( target : source stylesheet : properties * )
|
||||
{
|
||||
local flags ;
|
||||
@@ -101,7 +112,6 @@ rule xslt ( target : source stylesheet : properties * )
|
||||
local namevalue = [ regex.split $(param) "=" ] ;
|
||||
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
|
||||
}
|
||||
|
||||
STYLESHEET on $(target) = $(stylesheet) ;
|
||||
FLAGS on $(target) = $(flags) ;
|
||||
NAME on $(target) = $(.xsltproc) ;
|
||||
@@ -132,40 +142,43 @@ rule dtdxml-to-boostbook ( target : source : properties * )
|
||||
|
||||
rule boostbook-to-docbook ( target : source : properties * )
|
||||
{
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/docbook.xsl" : $(properties) ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=docbook:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
|
||||
}
|
||||
|
||||
rule docbook-to-onehtml ( target : source : properties * )
|
||||
{
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/html-single.xsl" : $(properties) ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=html-single:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
|
||||
}
|
||||
|
||||
rule docbook-to-htmldir ( target : source : properties * )
|
||||
{
|
||||
xslt-dir $(target) : $(source) "$(.boostbook-xsl-dir)/html.xsl" : $(properties) : html ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=html:S=.xsl) ;
|
||||
xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : html ;
|
||||
}
|
||||
|
||||
rule docbook-to-manpages ( target : source : properties * )
|
||||
{
|
||||
xslt-dir $(target) : $(source) "$(.boostbook-xsl-dir)/manpages.xsl" : $(properties) : man ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=manpages:S=.xsl) ;
|
||||
xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : man ;
|
||||
}
|
||||
|
||||
rule docbook-to-fo ( target : source : properties * )
|
||||
{
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/fo.xsl" : $(properties) ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=fo:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
|
||||
}
|
||||
|
||||
rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
{
|
||||
action.__init__ $(target) : : generate-xml-catalog : $(property-set) ;
|
||||
|
||||
self.docbook-xsl-dir =
|
||||
[ feature.get-values <docbook-xsl> : $(catalog-entries) ] ;
|
||||
self.docbook-dtd-dir =
|
||||
[ feature.get-values <docbook-dtd> : $(catalog-entries) ] ;
|
||||
self.boostbook-dtd-dir =
|
||||
[ feature.get-values <boostbook-dtd> : $(catalog-entries) ] ;
|
||||
|
||||
rule actualize ( )
|
||||
{
|
||||
if ! $(self.actualized)
|
||||
@@ -180,9 +193,12 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
text += "<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">" ;
|
||||
|
||||
# BoostBook DTD catalog entry
|
||||
text += " <rewriteURI uriStartString=\"http://www.boost.org/tools/boostbook/dtd/\" rewritePrefix=\"$(self.boostbook-dtd-dir)/\"/>" ;
|
||||
local boostbook-dtd-dir = [ boostbook.dtd-dir ] ;
|
||||
|
||||
if ! $(self.docbook-xsl-dir)
|
||||
text += " <rewriteURI uriStartString=\"http://www.boost.org/tools/boostbook/dtd/\" rewritePrefix=\"file://$(boostbook-dtd-dir)/\"/>" ;
|
||||
|
||||
local docbook-xsl-dir = [ boostbook.docbook-xsl-dir ] ;
|
||||
if ! $(docbook-xsl-dir)
|
||||
{
|
||||
ECHO "BoostBook warning: no DocBook XSL directory specified." ;
|
||||
ECHO " If you have the DocBook XSL stylesheets installed, please " ;
|
||||
@@ -194,10 +210,11 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
}
|
||||
else
|
||||
{
|
||||
text += " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"$(self.docbook-xsl-dir)/\"/>" ;
|
||||
text += " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"file://$(docbook-xsl-dir)/\"/>" ;
|
||||
}
|
||||
|
||||
if ! $(self.docbook-dtd-dir)
|
||||
local docbook-dtd-dir = [ boostbook.docbook-dtd-dir ] ;
|
||||
if ! $(docbook-dtd-dir)
|
||||
{
|
||||
ECHO "BoostBook warning: no DocBook DTD directory specified." ;
|
||||
ECHO " If you have the DocBook DTD installed, please set " ;
|
||||
@@ -209,7 +226,7 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
}
|
||||
else
|
||||
{
|
||||
text += " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"$(self.docbook-dtd-dir)/\"/>" ;
|
||||
text += " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"file://$(docbook-dtd-dir)/\"/>" ;
|
||||
}
|
||||
|
||||
text += "</catalog>" ;
|
||||
@@ -217,7 +234,9 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
print.output $(actual) ;
|
||||
print.text $(text) : true ;
|
||||
|
||||
ALWAYS $(actual) ;
|
||||
# ALWAYS $(actual) ;
|
||||
TEMPORARY $(actual) ;
|
||||
NOUPDATE $(actual) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,8 +329,6 @@ rule boostbook ( target-name : sources * : requirements * : default-build * )
|
||||
[ new boostbook-target-class $(target-name) : $(project) : $(sources)
|
||||
: [ targets.main-target-requirements $(requirements) : $(project) ]
|
||||
: [ targets.main-target-default-build $(default-build) : $(project) ]
|
||||
: <docbook-xsl>$(.docbook-xsl-dir) <docbook-dtd>$(.docbook-dtd-dir)
|
||||
<boostbook-dtd>$(.boostbook-dtd-dir)
|
||||
] ;
|
||||
}
|
||||
|
||||
@@ -388,7 +405,10 @@ rule testsuite-to-jamfiles ( target : source : properties * )
|
||||
{
|
||||
ECHO $(target) ;
|
||||
local boost_root = [ modules.peek : BOOST_ROOT ] ;
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/testing/Jamfile.xsl"
|
||||
local native-path =
|
||||
[ path.native [ path.join $(.boostbook-xsl-dir) testing/ ] ] ;
|
||||
local stylesheet = $(native-path:B=Jamfile:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet)
|
||||
: $(properties) <xsl:param>boost.root=$(boost_root)
|
||||
;
|
||||
}
|
||||
@@ -398,5 +418,6 @@ rule testsuite ( target-name : source : requirements * )
|
||||
local project = [ CALLER_MODULE ] ;
|
||||
|
||||
make $(target-name) : $(source) : boostbook.testsuite-to-jamfiles
|
||||
: $(requirements) : $(project) ;
|
||||
: $(requirements)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -243,8 +243,7 @@ rule text (
|
||||
while $(strings)
|
||||
{
|
||||
local line-v = $(output-target).line.$($(output-target).line) ;
|
||||
local echo-string = [ regex.split $(strings[1]) "\"" ] ;
|
||||
echo-string = $(echo-string:J="\\\"") ;
|
||||
local echo-string = [ escape $(strings[1]) ] ;
|
||||
$(line-v) on $(output-target) = $(echo-string) ;
|
||||
NOCARE $(line-v) ;
|
||||
NOTFILE $(line-v) ;
|
||||
@@ -275,13 +274,29 @@ rule wrapped-text ( text + )
|
||||
#
|
||||
actions quietly text-action
|
||||
{
|
||||
echo "$($(>))" >> $(<)
|
||||
echo $($(>)) >> $(<)
|
||||
}
|
||||
|
||||
# Writes a single line to target file (overwriting or creating the
|
||||
# file as necessary)
|
||||
actions quietly text-overwrite-action {
|
||||
echo "$($(>))" > $(<)
|
||||
echo $($(>)) > $(<)
|
||||
}
|
||||
|
||||
if [ modules.peek : NT ]
|
||||
{
|
||||
rule escape ( string )
|
||||
{
|
||||
return [ regex.escape $(string) : "&|()<>^" : "^" ] ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rule escape ( string )
|
||||
{
|
||||
local escaped = [ regex.escape $(string) : "\\\"" : "\\" ] ;
|
||||
return "\"$(escaped)\"" ;
|
||||
}
|
||||
}
|
||||
|
||||
local rule __test__ ( )
|
||||
|
||||
@@ -58,6 +58,26 @@ rule transform ( list * : pattern )
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
# Escapes all of the characters in symbols using the escape symbol
|
||||
# escape-symbol for the given string, and returns the escaped string
|
||||
rule escape ( string : symbols : escape-symbol )
|
||||
{
|
||||
local result = "" ;
|
||||
local m = 1 ;
|
||||
while $(m)
|
||||
{
|
||||
m = [ MATCH ^([^$(symbols)]*)([$(symbols)])(.*) : $(string) ] ;
|
||||
if $(m)
|
||||
{
|
||||
m += "" ; # Supposedly a bug fix; borrowed from regex.split
|
||||
result = "$(result)$(m[1])$(escape-symbol)$(m[2])" ;
|
||||
string = $(m[3]) ;
|
||||
}
|
||||
}
|
||||
string ?= "" ;
|
||||
result = "$(result)$(string)" ;
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
rule __test__ ( )
|
||||
{
|
||||
@@ -81,4 +101,10 @@ rule __test__ ( )
|
||||
|
||||
assert.result a.h c.h
|
||||
: transform <a.h> \"b.h\" <c.h> : <(.*)> ;
|
||||
|
||||
assert.result "^<?xml version=\"1.0\"^>"
|
||||
: escape "<?xml version=\"1.0\">" : "&|()<>^" : "^" ;
|
||||
|
||||
assert.result "<?xml version=\\\"1.0\\\">"
|
||||
: escape "<?xml version=\"1.0\">" : "\\\"" : "\\" ;
|
||||
}
|
||||
|
||||
@@ -72,18 +72,14 @@ rule init ( docbook-xsl-dir ? : docbook-dtd-dir ? : xsltproc ? )
|
||||
xsltroc = [ modules.peek : XSLTPROC ] ;
|
||||
}
|
||||
|
||||
boostbook-xsl-dir = [ modules.peek : BOOST_ROOT ] ;
|
||||
boostbook-xsl-dir = $(boostbook-xsl-dir)/tools/boostbook/xsl ;
|
||||
boostbook-dtd-dir = [ modules.peek : BOOST_ROOT ] ;
|
||||
boostbook-dtd-dir = $(boostbook-dtd-dir)/tools/boostbook/dtd ;
|
||||
|
||||
if ! $(.initialized)
|
||||
{
|
||||
$(.initialized) = true ;
|
||||
.docbook-xsl-dir = $(docbook-xsl-dir) ;
|
||||
.docbook-dtd-dir = $(docbook-dtd-dir) ;
|
||||
.boostbook-xsl-dir = $(boostbook-xsl-dir) ;
|
||||
.boostbook-dtd-dir = $(boostbook-dtd-dir) ;
|
||||
.docbook-xsl-dir = [ path.make $(docbook-xsl-dir) ] ;
|
||||
.docbook-dtd-dir = [ path.make $(docbook-dtd-dir) ] ;
|
||||
local boost-root = [ path.make [ modules.peek : BOOST_ROOT ] ] ;
|
||||
.boostbook-xsl-dir = [ path.join $(boost-root) tools boostbook xsl/ ] ;
|
||||
.boostbook-dtd-dir = [ path.join $(boost-root) tools boostbook dtd/ ] ;
|
||||
.xsltproc = $(xsltproc) ;
|
||||
}
|
||||
}
|
||||
@@ -93,6 +89,21 @@ rule xsl-dir
|
||||
return $(.boostbook-xsl-dir) ;
|
||||
}
|
||||
|
||||
rule dtd-dir
|
||||
{
|
||||
return $(.boostbook-dtd-dir) ;
|
||||
}
|
||||
|
||||
rule docbook-xsl-dir
|
||||
{
|
||||
return $(.docbook-xsl-dir) ;
|
||||
}
|
||||
|
||||
rule docbook-dtd-dir
|
||||
{
|
||||
return $(.docbook-dtd-dir) ;
|
||||
}
|
||||
|
||||
rule xslt ( target : source stylesheet : properties * )
|
||||
{
|
||||
local flags ;
|
||||
@@ -101,7 +112,6 @@ rule xslt ( target : source stylesheet : properties * )
|
||||
local namevalue = [ regex.split $(param) "=" ] ;
|
||||
flags += --stringparam $(namevalue[1]) $(namevalue[2]) ;
|
||||
}
|
||||
|
||||
STYLESHEET on $(target) = $(stylesheet) ;
|
||||
FLAGS on $(target) = $(flags) ;
|
||||
NAME on $(target) = $(.xsltproc) ;
|
||||
@@ -132,40 +142,43 @@ rule dtdxml-to-boostbook ( target : source : properties * )
|
||||
|
||||
rule boostbook-to-docbook ( target : source : properties * )
|
||||
{
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/docbook.xsl" : $(properties) ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=docbook:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
|
||||
}
|
||||
|
||||
rule docbook-to-onehtml ( target : source : properties * )
|
||||
{
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/html-single.xsl" : $(properties) ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=html-single:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
|
||||
}
|
||||
|
||||
rule docbook-to-htmldir ( target : source : properties * )
|
||||
{
|
||||
xslt-dir $(target) : $(source) "$(.boostbook-xsl-dir)/html.xsl" : $(properties) : html ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=html:S=.xsl) ;
|
||||
xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : html ;
|
||||
}
|
||||
|
||||
rule docbook-to-manpages ( target : source : properties * )
|
||||
{
|
||||
xslt-dir $(target) : $(source) "$(.boostbook-xsl-dir)/manpages.xsl" : $(properties) : man ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=manpages:S=.xsl) ;
|
||||
xslt-dir $(target) : $(source) $(stylesheet) : $(properties) : man ;
|
||||
}
|
||||
|
||||
rule docbook-to-fo ( target : source : properties * )
|
||||
{
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/fo.xsl" : $(properties) ;
|
||||
local native-path = [ path.native $(.boostbook-xsl-dir) ] ;
|
||||
local stylesheet = $(native-path:B=fo:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet) : $(properties) ;
|
||||
}
|
||||
|
||||
rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
{
|
||||
action.__init__ $(target) : : generate-xml-catalog : $(property-set) ;
|
||||
|
||||
self.docbook-xsl-dir =
|
||||
[ feature.get-values <docbook-xsl> : $(catalog-entries) ] ;
|
||||
self.docbook-dtd-dir =
|
||||
[ feature.get-values <docbook-dtd> : $(catalog-entries) ] ;
|
||||
self.boostbook-dtd-dir =
|
||||
[ feature.get-values <boostbook-dtd> : $(catalog-entries) ] ;
|
||||
|
||||
rule actualize ( )
|
||||
{
|
||||
if ! $(self.actualized)
|
||||
@@ -180,9 +193,12 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
text += "<catalog xmlns=\"urn:oasis:names:tc:entity:xmlns:xml:catalog\">" ;
|
||||
|
||||
# BoostBook DTD catalog entry
|
||||
text += " <rewriteURI uriStartString=\"http://www.boost.org/tools/boostbook/dtd/\" rewritePrefix=\"$(self.boostbook-dtd-dir)/\"/>" ;
|
||||
local boostbook-dtd-dir = [ boostbook.dtd-dir ] ;
|
||||
|
||||
if ! $(self.docbook-xsl-dir)
|
||||
text += " <rewriteURI uriStartString=\"http://www.boost.org/tools/boostbook/dtd/\" rewritePrefix=\"file://$(boostbook-dtd-dir)/\"/>" ;
|
||||
|
||||
local docbook-xsl-dir = [ boostbook.docbook-xsl-dir ] ;
|
||||
if ! $(docbook-xsl-dir)
|
||||
{
|
||||
ECHO "BoostBook warning: no DocBook XSL directory specified." ;
|
||||
ECHO " If you have the DocBook XSL stylesheets installed, please " ;
|
||||
@@ -194,10 +210,11 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
}
|
||||
else
|
||||
{
|
||||
text += " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"$(self.docbook-xsl-dir)/\"/>" ;
|
||||
text += " <rewriteURI uriStartString=\"http://docbook.sourceforge.net/release/xsl/current/\" rewritePrefix=\"file://$(docbook-xsl-dir)/\"/>" ;
|
||||
}
|
||||
|
||||
if ! $(self.docbook-dtd-dir)
|
||||
local docbook-dtd-dir = [ boostbook.docbook-dtd-dir ] ;
|
||||
if ! $(docbook-dtd-dir)
|
||||
{
|
||||
ECHO "BoostBook warning: no DocBook DTD directory specified." ;
|
||||
ECHO " If you have the DocBook DTD installed, please set " ;
|
||||
@@ -209,7 +226,7 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
}
|
||||
else
|
||||
{
|
||||
text += " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"$(self.docbook-dtd-dir)/\"/>" ;
|
||||
text += " <rewriteURI uriStartString=\"http://www.oasis-open.org/docbook/xml/4.2/\" rewritePrefix=\"file://$(docbook-dtd-dir)/\"/>" ;
|
||||
}
|
||||
|
||||
text += "</catalog>" ;
|
||||
@@ -217,7 +234,9 @@ rule xml-catalog-action ( target : property-set ? : catalog-entries * )
|
||||
print.output $(actual) ;
|
||||
print.text $(text) : true ;
|
||||
|
||||
ALWAYS $(actual) ;
|
||||
# ALWAYS $(actual) ;
|
||||
TEMPORARY $(actual) ;
|
||||
NOUPDATE $(actual) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,8 +329,6 @@ rule boostbook ( target-name : sources * : requirements * : default-build * )
|
||||
[ new boostbook-target-class $(target-name) : $(project) : $(sources)
|
||||
: [ targets.main-target-requirements $(requirements) : $(project) ]
|
||||
: [ targets.main-target-default-build $(default-build) : $(project) ]
|
||||
: <docbook-xsl>$(.docbook-xsl-dir) <docbook-dtd>$(.docbook-dtd-dir)
|
||||
<boostbook-dtd>$(.boostbook-dtd-dir)
|
||||
] ;
|
||||
}
|
||||
|
||||
@@ -388,7 +405,10 @@ rule testsuite-to-jamfiles ( target : source : properties * )
|
||||
{
|
||||
ECHO $(target) ;
|
||||
local boost_root = [ modules.peek : BOOST_ROOT ] ;
|
||||
xslt $(target) : $(source) "$(.boostbook-xsl-dir)/testing/Jamfile.xsl"
|
||||
local native-path =
|
||||
[ path.native [ path.join $(.boostbook-xsl-dir) testing/ ] ] ;
|
||||
local stylesheet = $(native-path:B=Jamfile:S=.xsl) ;
|
||||
xslt $(target) : $(source) $(stylesheet)
|
||||
: $(properties) <xsl:param>boost.root=$(boost_root)
|
||||
;
|
||||
}
|
||||
@@ -398,5 +418,6 @@ rule testsuite ( target-name : source : requirements * )
|
||||
local project = [ CALLER_MODULE ] ;
|
||||
|
||||
make $(target-name) : $(source) : boostbook.testsuite-to-jamfiles
|
||||
: $(requirements) : $(project) ;
|
||||
: $(requirements)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -243,8 +243,7 @@ rule text (
|
||||
while $(strings)
|
||||
{
|
||||
local line-v = $(output-target).line.$($(output-target).line) ;
|
||||
local echo-string = [ regex.split $(strings[1]) "\"" ] ;
|
||||
echo-string = $(echo-string:J="\\\"") ;
|
||||
local echo-string = [ escape $(strings[1]) ] ;
|
||||
$(line-v) on $(output-target) = $(echo-string) ;
|
||||
NOCARE $(line-v) ;
|
||||
NOTFILE $(line-v) ;
|
||||
@@ -275,13 +274,29 @@ rule wrapped-text ( text + )
|
||||
#
|
||||
actions quietly text-action
|
||||
{
|
||||
echo "$($(>))" >> $(<)
|
||||
echo $($(>)) >> $(<)
|
||||
}
|
||||
|
||||
# Writes a single line to target file (overwriting or creating the
|
||||
# file as necessary)
|
||||
actions quietly text-overwrite-action {
|
||||
echo "$($(>))" > $(<)
|
||||
echo $($(>)) > $(<)
|
||||
}
|
||||
|
||||
if [ modules.peek : NT ]
|
||||
{
|
||||
rule escape ( string )
|
||||
{
|
||||
return [ regex.escape $(string) : "&|()<>^" : "^" ] ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rule escape ( string )
|
||||
{
|
||||
local escaped = [ regex.escape $(string) : "\\\"" : "\\" ] ;
|
||||
return "\"$(escaped)\"" ;
|
||||
}
|
||||
}
|
||||
|
||||
local rule __test__ ( )
|
||||
|
||||
@@ -58,6 +58,26 @@ rule transform ( list * : pattern )
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
# Escapes all of the characters in symbols using the escape symbol
|
||||
# escape-symbol for the given string, and returns the escaped string
|
||||
rule escape ( string : symbols : escape-symbol )
|
||||
{
|
||||
local result = "" ;
|
||||
local m = 1 ;
|
||||
while $(m)
|
||||
{
|
||||
m = [ MATCH ^([^$(symbols)]*)([$(symbols)])(.*) : $(string) ] ;
|
||||
if $(m)
|
||||
{
|
||||
m += "" ; # Supposedly a bug fix; borrowed from regex.split
|
||||
result = "$(result)$(m[1])$(escape-symbol)$(m[2])" ;
|
||||
string = $(m[3]) ;
|
||||
}
|
||||
}
|
||||
string ?= "" ;
|
||||
result = "$(result)$(string)" ;
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
rule __test__ ( )
|
||||
{
|
||||
@@ -81,4 +101,10 @@ rule __test__ ( )
|
||||
|
||||
assert.result a.h c.h
|
||||
: transform <a.h> \"b.h\" <c.h> : <(.*)> ;
|
||||
|
||||
assert.result "^<?xml version=\"1.0\"^>"
|
||||
: escape "<?xml version=\"1.0\">" : "&|()<>^" : "^" ;
|
||||
|
||||
assert.result "<?xml version=\\\"1.0\\\">"
|
||||
: escape "<?xml version=\"1.0\">" : "\\\"" : "\\" ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user