diff --git a/basis/xml/syntax/syntax-tests.factor b/basis/xml/syntax/syntax-tests.factor index c30feab039..aa1e458831 100644 --- a/basis/xml/syntax/syntax-tests.factor +++ b/basis/xml/syntax/syntax-tests.factor @@ -2,7 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: xml io kernel math sequences strings xml.traversal tools.test math.parser xml.syntax xml.data xml.syntax.private -accessors multiline locals inverse xml.writer splitting classes ; +accessors multiline locals inverse xml.writer splitting classes +xml.private ; IN: xml.syntax.tests ! TAGS test @@ -130,3 +131,21 @@ XML-NS: foo http://blah.com [ "apple" ] [ pple XML> dispatch-doc ] unit-test [ "apple" ] [ [XML pple XML] dispatch-doc ] unit-test [ "apple" ] [ pple XML> body>> dispatch-doc ] unit-test + +! Make sure nested XML documents interpolate correctly +{ + """it's blue!""" +} [ + "it's blue!" <-> XML> + <-> XML> xml>string +] unit-test + +{ + """asdfasdf2""" +} [ + default-prolog + "asdf" + "asdf" f f + "asdf2" + <-> XML> xml>string +] unit-test diff --git a/basis/xml/syntax/syntax.factor b/basis/xml/syntax/syntax.factor index 8738bef20b..5d1e9a5947 100644 --- a/basis/xml/syntax/syntax.factor +++ b/basis/xml/syntax/syntax.factor @@ -103,6 +103,10 @@ M: xml-data push-item , ; M: object push-item present , ; M: sequence push-item dup xml-data? [ , ] [ [ push-item ] each ] if ; +M: xml push-item + [ before>> push-item ] + [ body>> push-item ] + [ after>> push-item ] tri ; M: number push-item present , ; M: xml-chunk push-item % ;