Skip to content

Commit 176a240

Browse files
committed
refine error prompt
1 parent 51018c9 commit 176a240

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/_plugins/include_example.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,23 @@ def select_lines(code)
8585
.select { |l, i| l.include? "$example off#{@snippet_label}$" }
8686
.map { |l, i| i }
8787

88-
raise "Start indices amount is not equal to end indices amount, see #{@file}, #{@snippet_label}." \
88+
raise "Start indices amount is not equal to end indices amount, "\
89+
"see #{@file}, [labeled=#{@snippet_label}]." \
8990
unless startIndices.size == endIndices.size
9091

91-
raise "No code is selected by include_example, see #{@file}, #{@snippet_label}." \
92+
raise "No code is selected by include_example, see #{@file}, [labeled=#{@snippet_label}]." \
9293
if startIndices.size == 0
9394

9495
# Select and join code blocks together, with a space line between each of two continuous
9596
# blocks.
9697
lastIndex = -1
9798
result = ""
9899
startIndices.zip(endIndices).each do |start, endline|
99-
raise "Overlapping between two example code blocks are not allowed, see #{@file}, #{@snippet_label}." \
100+
raise "Overlapping between two example code blocks are not allowed, "\
101+
"see #{@file}, [labeled=#{@snippet_label}]." \
100102
if start <= lastIndex
101-
raise "$example on$ should not be in the same line with $example off$, see #{@file}, #{@snippet_label}." \
103+
raise "$example on$ should not be in the same line with $example off$, "\
104+
"see #{@file}, [labeled=#{@snippet_label}]." \
102105
if start == endline
103106
lastIndex = endline
104107
range = Range.new(start + 1, endline - 1)

0 commit comments

Comments
 (0)