Repository: spark
Updated Branches:
  refs/heads/master d3ca8cfac -> e6dc89a33


[SPARK-12035] Add more debug information in include_example tag of Jekyll

https://issues.apache.org/jira/browse/SPARK-12035

When we debuging lots of example code files, like in 
https://github.com/apache/spark/pull/10002, it's hard to know which file causes 
errors due to limited information in `include_example.rb`. With their 
filenames, we can locate bugs easily.

Author: Xusen Yin <yinxu...@gmail.com>

Closes #10026 from yinxusen/SPARK-12035.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/e6dc89a3
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/e6dc89a3
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/e6dc89a3

Branch: refs/heads/master
Commit: e6dc89a33951e9197a77dbcacf022c27469ae41e
Parents: d3ca8cf
Author: Xusen Yin <yinxu...@gmail.com>
Authored: Mon Nov 30 17:18:44 2015 -0800
Committer: Andrew Or <and...@databricks.com>
Committed: Mon Nov 30 17:18:44 2015 -0800

----------------------------------------------------------------------
 docs/_plugins/include_example.rb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/e6dc89a3/docs/_plugins/include_example.rb
----------------------------------------------------------------------
diff --git a/docs/_plugins/include_example.rb b/docs/_plugins/include_example.rb
index 564c866..f748582 100644
--- a/docs/_plugins/include_example.rb
+++ b/docs/_plugins/include_example.rb
@@ -75,10 +75,10 @@ module Jekyll
         .select { |l, i| l.include? "$example off$" }
         .map { |l, i| i }
 
-      raise "Start indices amount is not equal to end indices amount, please 
check the code." \
+      raise "Start indices amount is not equal to end indices amount, see 
#{@file}." \
         unless startIndices.size == endIndices.size
 
-      raise "No code is selected by include_example, please check the code." \
+      raise "No code is selected by include_example, see #{@file}." \
         if startIndices.size == 0
 
       # Select and join code blocks together, with a space line between each 
of two continuous
@@ -86,8 +86,10 @@ module Jekyll
       lastIndex = -1
       result = ""
       startIndices.zip(endIndices).each do |start, endline|
-        raise "Overlapping between two example code blocks are not allowed." 
if start <= lastIndex
-        raise "$example on$ should not be in the same line with $example 
off$." if start == endline
+        raise "Overlapping between two example code blocks are not allowed, 
see #{@file}." \
+            if start <= lastIndex
+        raise "$example on$ should not be in the same line with $example off$, 
see #{@file}." \
+            if start == endline
         lastIndex = endline
         range = Range.new(start + 1, endline - 1)
         result += trim_codeblock(lines[range]).join


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to