@@ -62,6 +62,75 @@ test("`stringify()` xml syntax doctype", () =>
62
62
} ,
63
63
) )
64
64
65
+ test ( "`stringify()` lume example issue #96" , ( ) => {
66
+ expect ( stringify ( {
67
+ "@version" : "1.0" ,
68
+ "@encoding" : "UTF-8" ,
69
+ urlset : {
70
+ "@xmlns" : "http://www.sitemaps.org/schemas/sitemap/0.9" ,
71
+ "@xmlns:xhtml" : "http://www.w3.org/1999/xhtml" ,
72
+ url : [
73
+ {
74
+ loc : "https://example.com/overrided-page2/" ,
75
+ lastmod : "2020-06-21T00:00:00.000Z" ,
76
+ } ,
77
+ {
78
+ loc : "https://example.com/page5/" ,
79
+ lastmod : "1979-06-21T23:45:00.000Z" ,
80
+ } ,
81
+ {
82
+ loc : "https://example.com/page_3/" ,
83
+ lastmod : "2020-01-01T00:00:00.000Z" ,
84
+ } ,
85
+ {
86
+ loc : "https://example.com/pages/new-name/page7/" ,
87
+ lastmod : "2022-01-02T00:00:00.000Z" ,
88
+ } ,
89
+ {
90
+ loc : "https://example.com/pages/page4/" ,
91
+ lastmod : "2021-01-02T18:32:00.000Z" ,
92
+ } ,
93
+ {
94
+ loc : "https://example.com/pages/page6/" ,
95
+ lastmod : "2022-01-01T00:00:00.000Z" ,
96
+ } ,
97
+ ] ,
98
+ } ,
99
+ "#instructions" : {
100
+ "xml-stylesheet" : { "@href" : "/sitemap-style.xml" , "@type" : "text/xsl" } ,
101
+ } ,
102
+ } ) ) . toEqual (
103
+ `<?xml version="1.0" encoding="UTF-8"?>
104
+ <?xml-stylesheet href="/sitemap-style.xml" type="text/xsl"?>
105
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
106
+ <url>
107
+ <loc>https://example.com/overrided-page2/</loc>
108
+ <lastmod>2020-06-21T00:00:00.000Z</lastmod>
109
+ </url>
110
+ <url>
111
+ <loc>https://example.com/page5/</loc>
112
+ <lastmod>1979-06-21T23:45:00.000Z</lastmod>
113
+ </url>
114
+ <url>
115
+ <loc>https://example.com/page_3/</loc>
116
+ <lastmod>2020-01-01T00:00:00.000Z</lastmod>
117
+ </url>
118
+ <url>
119
+ <loc>https://example.com/pages/new-name/page7/</loc>
120
+ <lastmod>2022-01-02T00:00:00.000Z</lastmod>
121
+ </url>
122
+ <url>
123
+ <loc>https://example.com/pages/page4/</loc>
124
+ <lastmod>2021-01-02T18:32:00.000Z</lastmod>
125
+ </url>
126
+ <url>
127
+ <loc>https://example.com/pages/page6/</loc>
128
+ <lastmod>2022-01-01T00:00:00.000Z</lastmod>
129
+ </url>
130
+ </urlset>` ,
131
+ )
132
+ } )
133
+
65
134
for ( const indent of [ " " , "" ] ) {
66
135
test ( `\`stringify()\` xml example w3schools.com#3 (indent = "${ indent } ")` , ( ) =>
67
136
expect (
0 commit comments