Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/_plugins/include_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@

module Jekyll
class IncludeExampleTag < Liquid::Tag

def initialize(tag_name, markup, tokens)
@markup = markup
super
end

def render(context)
site = context.registers[:site]
config_dir = '../examples/src/main'
Expand All @@ -37,15 +37,15 @@ def render(context)

code = File.open(@file).read.encode("UTF-8")
code = select_lines(code)

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
# code file.
def trim_codeblock(lines)
Expand Down