Skip to content

Commit

Permalink
resolves #1916 for real; add test
Browse files Browse the repository at this point in the history
- actually make sourcemap property writable
- add test to verify sourcemap property is writable
  • Loading branch information
mojavelinux committed Dec 9, 2016
1 parent dc5aad8 commit 890761d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/asciidoctor/document.rb
Expand Up @@ -116,7 +116,7 @@ def to_s
attr_reader :compat_mode

# Public: Get or set the Boolean flag that indicates whether source map information should be tracked by the parser
attr :sourcemap
attr_accessor :sourcemap

# Public: Get the Hash of document references
attr_reader :references
Expand Down
12 changes: 12 additions & 0 deletions test/document_test.rb
Expand Up @@ -343,6 +343,18 @@ def [](key)
assert_equal 1, section_1.lineno
end

test 'should allow sourcemap option on document to be modified' do
doc = Asciidoctor.load_file fixture_path('sample.asciidoc'), :parse => false
doc.sourcemap = true
doc = doc.parse

section_1 = doc.sections[0]
assert_equal 'Section A', section_1.title
refute_nil section_1.source_location
assert_equal 'sample.asciidoc', section_1.file
assert_equal 10, section_1.lineno
end

test 'find_by should return Array of blocks anywhere in document tree that match criteria' do
input = <<-EOS
= Document Title
Expand Down

0 comments on commit 890761d

Please sign in to comment.