Permalink
Browse files

Preserve XML directives.

  • Loading branch information...
soveran committed Apr 21, 2012
1 parent 4b44ce8 commit 7b29833c75cf0de661a70fafd14553423ec1c595
Showing with 11 additions and 2 deletions.
  1. +1 −1 lib/mote.rb
  2. +10 −1 test/mote_test.rb
View
@@ -20,7 +20,7 @@
class Mote
VERSION = "0.2.2"
- PATTERN = /^\s*(%)(.*?)$|(<\?)\s*(.*?)\s*\?>|(\{\{)(.*?)\}\}/m
+ PATTERN = /^\s*(%)(.*?)$|(<\?)\s+(.*?)\s+\?>|(\{\{)(.*?)\}\}/m
def self.parse(template, context = self, vars = [])
terms = template.split(PATTERN)
View
@@ -83,7 +83,7 @@
assert_equal "1,4,9", example.call
end
- test "multi-line XML directives" do
+ test "multi-line XML-style directives" do
template = (<<-EOT).gsub(/^ /, "")
<? res = ""
[1, 2, 3].each_with_index do |item, idx|
@@ -96,6 +96,15 @@
example = Mote.parse(template)
assert_equal "\n1. 1\n2. 4\n3. 9\n\n", example.call
end
+
+ test "preserve XML directives" do
+ template = (<<-EOT).gsub(/^ /, "")
+ <?xml "hello" ?>
+ EOT
+
+ example = Mote.parse(template)
+ assert_equal "<?xml \"hello\" ?>\n", example.call
+ end
end
include Mote::Helpers

0 comments on commit 7b29833

Please sign in to comment.