convert_href

in jekyll/plugins/markdown_converter.rb [126:151]


      def convert_href(href)
        if href.start_with?('upsource://')
          opts = @options[:upsource]

          
          
          
          
          
          
          
          server = opts[:server]
          repo = opts[:repo]
          revision = if opts[:commit] == 'HEAD' then 'HEAD' else "#{repo}-#{opts[:commit]}" end
          path = href[11..-1]

          raise 'Upsource link must be in the form upsource:///path/to/file.java. Note the 3 slashes!' unless path.start_with?('/')

          
          
          href = 'https://' + server + "/#{opts[:repo]}/file/#{revision}" + path
        end

        href
      end