summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Allen <dallen@redhat.com>2013-04-21 00:10:29 -0600
committerDan Allen <dallen@redhat.com>2013-04-21 00:10:29 -0600
commite87b8adbd4e14e32bacf24bd0fbd73a798e0be94 (patch)
treeec4b50a91ef847d76efe5ccce824e5e4db2b8f8a /lib
parent98133fbb6b4981a7b07ff71bdb7b943c1ff435b9 (diff)
resolves #262 warn if file in include macro doesn't exist
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor/reader.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/asciidoctor/reader.rb b/lib/asciidoctor/reader.rb
index 7302bd02..31e353bf 100644
--- a/lib/asciidoctor/reader.rb
+++ b/lib/asciidoctor/reader.rb
@@ -441,6 +441,13 @@ class Reader
# FIXME currently we're not checking the upper bound of the include depth
elsif @document.attributes.fetch('include-depth', 0).to_i > 0
advance
+ # FIXME this borks line numbers
+ include_file = @document.normalize_asset_path(target, 'include file')
+ if !File.file?(include_file)
+ puts "asciidoctor: WARNING: line #{@lineno}: include file not found: #{include_file}"
+ return true
+ end
+
lines = nil
tags = nil
if !raw_attributes.empty?
@@ -466,8 +473,6 @@ class Reader
tags = attributes['tags'].split(/[,;]/).uniq
end
end
- # FIXME this borks line numbers
- include_file = @document.normalize_asset_path(target, 'include file')
if !lines.nil?
if !lines.empty?
selected = []