summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2014-03-01 02:52:17 -0700
committerDan Allen <dan.j.allen@gmail.com>2014-03-01 02:52:17 -0700
commit62a3c98d48e1b740664b80fd064d472a96ed0c4c (patch)
treec41e4e39916e67d267d10ea8257e02802356280c
parent1329875559cf22c4c6ed758fe1b155cadf91bae9 (diff)
parent8b4c5ee16f4f3cbceb32af0096ca3bd5357bc94c (diff)
Merge pull request #911 from mojavelinux/issue-903
resolves #903 ignore case of attribute in conditional directives
-rw-r--r--lib/asciidoctor/reader.rb3
-rw-r--r--test/reader_test.rb12
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/asciidoctor/reader.rb b/lib/asciidoctor/reader.rb
index dbb19ce2..ee96a7e2 100644
--- a/lib/asciidoctor/reader.rb
+++ b/lib/asciidoctor/reader.rb
@@ -698,6 +698,9 @@ class PreprocessorReader < Reader
return false
end
+ # attributes are case insensitive
+ target = target.downcase
+
if directive == 'endif'
stack_size = @conditional_stack.size
if stack_size > 0
diff --git a/test/reader_test.rb b/test/reader_test.rb
index 1d6e17e6..4cbbcf0f 100644
--- a/test/reader_test.rb
+++ b/test/reader_test.rb
@@ -1024,6 +1024,18 @@ There was much rejoicing.
end
assert_equal "On our quest we go...\nThere is a holy grail!\nThere was much rejoicing.", (lines * ::Asciidoctor::EOL)
end
+
+ test 'ifdef attribute name is not case sensitive' do
+ input = <<-EOS
+ifdef::showScript[]
+The script is shown!
+endif::showScript[]
+ EOS
+
+ doc = Asciidoctor::Document.new input, :attributes => { 'showscript' => '' }
+ result = doc.reader.read
+ assert_equal 'The script is shown!', result
+ end
test 'ifndef with defined attribute does not include text in brackets' do
input = <<-EOS