# File lib/asciidoctor/path_resolver.rb, line 339
  def web_path(target, start = nil)
    target = posixfy(target)
    start = posixfy(start)

    unless is_web_root?(target) || start.empty?
      target = "#{start}#{SLASH}#{target}"
    end

    target_segments, target_root, _ = partition_path(target, true)
    resolved_segments = target_segments.inject([]) do |accum, segment|
      if segment == DOT_DOT
        if accum.empty?
          accum.push segment unless target_root && target_root != DOT
        elsif accum[-1] == DOT_DOT
          accum.push segment
        else
          accum.pop
        end
      else
        accum.push segment
      end
      accum
    end

    join_path resolved_segments, target_root
  end