Sha256: cc7799d8b24efa52d950c95f43a3856401142ea8b477b5d11788f19b6707390c

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

def init
  super
  @feature = object
  sections.push :feature
  sections.push :scenarios if object.scenarios
end

def background
  @scenario = @feature.background
  @id = "background"
  erb(:scenario)
end

def scenarios
  scenarios = ""

  if @feature.background
    @scenario = @feature.background
    @id = "background"
    scenarios += erb(:scenario)
  end

  @feature.scenarios.each_with_index do |scenario,index|
    @scenario = scenario
    @id = "scenario_#{index}"
    scenarios += erb(:scenario)
  end

  scenarios
end

def highlight_matches(step)
  value = step.value.dup

  if step.definition
    matches = step.value.match(step.definition.regex)

    if matches
      matches[1..-1].reverse.each_with_index do |match,index|
        next if match == nil
        value[matches.begin((matches.size - 1) - index)..(matches.end((matches.size - 1) - index) - 1)] = "<span class='match'>#{h(match)}</span>"
      end
    end
  end

  value
end

def htmlify_with_newlines(text)
  text.split("\n").collect {|c| h(c).gsub(/\s/,'&nbsp;') }.join("<br/>")
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yard-lucid-0.5.0 lib/templates/default/feature/html/setup.rb
yard-lucid-0.4.0 lib/templates/default/feature/html/setup.rb
yard-lucid-0.3.0 lib/templates/default/feature/html/setup.rb
yard-lucid-0.2.0 lib/templates/default/feature/html/setup.rb
yard-lucid-0.1.0 lib/templates/default/feature/html/setup.rb