Permalink
Browse files

xml output mode

  • Loading branch information...
1 parent f6b4797 commit 9b0aefbd9027469d8a5ae45084067ace79189041 @hax hax committed Aug 13, 2013
Showing with 15 additions and 1 deletion.
  1. +13 −0 examples/xml.jedi
  2. +2 −1 src/transpiler.php5.ometajs
View
13 examples/xml.jedi
@@ -0,0 +1,13 @@
+!xml
+
+urlset
+ @xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'
+ @xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ @xsi:schemaLocation=
+ 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'
+
+ url
+ loc 'http://www.example.com/'
+ lastmod '2013-09-01'
+ changefreq 'monthly'
+ priority '0.8'
View
3 src/transpiler.php5.ometajs
@@ -1,5 +1,5 @@
"import string, concat, flattenLines, isCharArray, dir, flattenArray from './util'"
-"import OutputHTML, OutputXHTML from './output'"
+"import OutputHTML, OutputXML, OutputXHTML from './output'"
"export PHP5Transpiler, Beautify"
ometa Beautify {
@@ -37,6 +37,7 @@ ometa PHP5Transpiler {
outputMethod [spaces ("xhtml" !this.setOutputMethod('xhtml') spaces "mp 1.1") spaces] -> ["echo '<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.1//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd\">', \"\\n\";"],
outputMethod [spaces ("xhtml" !this.setOutputMethod('xhtml') spaces "mp 1.2") spaces] -> ["echo '<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd\">', \"\\n\";"],
outputMethod [spaces ("xhtml" !this.setOutputMethod('xhtml') spaces "basic") spaces] -> ["echo '<!doctype html>', \"\\n\";"],
+ outputMethod [spaces ("xml" !this.setOutputMethod('xml')) spaces] -> ["echo '<?xml version=\"1.0\" encoding=\"utf-8\"?>', \"\\n\";"],
tupleItem [#Mapping [#Symbol :key] trans:expr] -> ("'" + key + "' => " + expr),

0 comments on commit 9b0aefb

Please sign in to comment.