Repository: spark
Updated Branches:
  refs/heads/master 2d2411faa -> 912b94363


[SPARK-11336] Add links to example codes

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

mengxr I add a hyperlink of Spark on Github and a hint of their existences in 
Spark code repo in each code example. I remove the config key for changing the 
example code dir, since we assume all examples  should be in spark/examples.

The hyperlink, though we cannot use it now, since the Spark v1.6.0 has not been 
released yet, can be used after the release. So it is not a problem.

I add some screen shots, so you can get an instant feeling.

<img width="949" alt="screen shot 2015-10-27 at 10 47 18 pm" 
src="https://cloud.githubusercontent.com/assets/2637239/10780634/bd20e072-7cfc-11e5-8960-def4fc62a8ea.png";>

<img width="1144" alt="screen shot 2015-10-27 at 10 47 31 pm" 
src="https://cloud.githubusercontent.com/assets/2637239/10780636/c3f6e180-7cfc-11e5-80b2-233589f4a9a3.png";>

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

Closes #9320 from yinxusen/SPARK-11336.


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

Branch: refs/heads/master
Commit: 912b94363bb113ab14024a45f17a4d2b82a09e66
Parents: 2d2411f
Author: Xusen Yin <yinxu...@gmail.com>
Authored: Fri Nov 13 13:14:25 2015 -0800
Committer: Xiangrui Meng <m...@databricks.com>
Committed: Fri Nov 13 13:14:25 2015 -0800

----------------------------------------------------------------------
 docs/_plugins/include_example.rb | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/912b9436/docs/_plugins/include_example.rb
----------------------------------------------------------------------
diff --git a/docs/_plugins/include_example.rb b/docs/_plugins/include_example.rb
index 6ee63a5..549f81f 100644
--- a/docs/_plugins/include_example.rb
+++ b/docs/_plugins/include_example.rb
@@ -28,7 +28,7 @@ module Jekyll
  
     def render(context)
       site = context.registers[:site]
-      config_dir = (site.config['code_dir'] || 
'../examples/src/main').sub(/^\//,'')
+      config_dir = '../examples/src/main'
       @code_dir = File.join(site.source, config_dir)
 
       clean_markup = @markup.strip
@@ -38,7 +38,12 @@ module Jekyll
       code = File.open(@file).read.encode("UTF-8")
       code = select_lines(code)
  
-      Pygments.highlight(code, :lexer => @lang)
+      rendered_code = Pygments.highlight(code, :lexer => @lang)
+
+      hint = "<div><small>Find full example code at " \
+        "\"examples/src/main/#{clean_markup}\" in the Spark 
repo.</small></div>"
+
+      rendered_code + hint
     end
  
     # Trim the code block so as to have the same indention, regardless of 
their positions in the


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

Reply via email to