[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 <yinxusen@gmail.com>

Closes #9320 from yinxusen/SPARK-11336.
This commit is contained in:
Xusen Yin 2015-11-13 13:14:25 -08:00 committed by Xiangrui Meng
parent 2d2411faa2
commit 912b94363b

View file

@ -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