Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-13015][MLlib][DOC] Replace example code in mllib-data-types.md using include_example #14006

Closed
wants to merge 12 commits into from
8 changes: 4 additions & 4 deletions docs/_plugins/include_example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@ def select_lines(code)
.select { |l, i| l.include? "$example off#{@snippet_label}$" }
.map { |l, i| i }

raise "Start indices amount is not equal to end indices amount, see #{@file}." \
raise "Start indices amount is not equal to end indices amount, see #{@file}, #{@snippet_label}." \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer

... see #{@file} [labeled=#{@snippet_label}].

Otherwise the label itself might be mistaken for a file path.

unless startIndices.size == endIndices.size

raise "No code is selected by include_example, see #{@file}." \
raise "No code is selected by include_example, see #{@file}, #{@snippet_label}." \
if startIndices.size == 0

# Select and join code blocks together, with a space line between each of two continuous
# blocks.
lastIndex = -1
result = ""
startIndices.zip(endIndices).each do |start, endline|
raise "Overlapping between two example code blocks are not allowed, see #{@file}." \
raise "Overlapping between two example code blocks are not allowed, see #{@file}, #{@snippet_label}." \
if start <= lastIndex
raise "$example on$ should not be in the same line with $example off$, see #{@file}." \
raise "$example on$ should not be in the same line with $example off$, see #{@file}, #{@snippet_label}." \
if start == endline
lastIndex = endline
range = Range.new(start + 1, endline - 1)
Expand Down
Loading