parent
cd7187023c
commit
72ed11574b
|
@ -144,7 +144,7 @@ module Msf
|
|||
formatted_pr = []
|
||||
|
||||
pull_requests.each_pair do |number, pr|
|
||||
formatted_pr << "* <a href=\"https://github.com/rapid7/metasploit-framework/pull/#{number}\">##{number}</a> - #{pr[:title]}"
|
||||
formatted_pr << "* [##{number} #{pr[:title]}](https://github.com/rapid7/metasploit-framework/pull/#{number})"
|
||||
end
|
||||
|
||||
formatted_pr * "\n"
|
||||
|
@ -204,7 +204,23 @@ module Msf
|
|||
# @param refs [Array] Module references.
|
||||
# @return [String]
|
||||
def normalize_references(refs)
|
||||
refs.collect { |r| "* <a href=\"#{r}\">#{r}</a>" } * "\n"
|
||||
normalized = ''
|
||||
refs.each do |ref|
|
||||
case ref.ctx_id
|
||||
when 'AKA'
|
||||
normalized << "* *Also known as:* #{ref.ctx_val}"
|
||||
when 'MSB'
|
||||
normalized << "* [#{ref.ctx_val}](#{ref.site})"
|
||||
when 'URL'
|
||||
normalized << "* [#{ref.site}](#{ref.site})"
|
||||
when 'US-CERT-VU'
|
||||
normalized << "* [VU##{ref.ctx_val}](#{ref.site})"
|
||||
else
|
||||
normalized << "* [#{ref.ctx_id}-#{ref.ctx_val}](#{ref.site})"
|
||||
end
|
||||
normalized << "\n"
|
||||
end
|
||||
normalized
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'rex'
|
||||
require 'msf/core/module/reference'
|
||||
require 'msf/util/document_generator'
|
||||
require 'msf/util/document_generator/pull_request_finder'
|
||||
|
||||
|
@ -10,7 +11,7 @@ RSpec.describe Msf::Util::DocumentGenerator::DocumentNormalizer do
|
|||
let(:mod_shortname) { 'ms08_067_netapi' }
|
||||
let(:mod_name) { 'MS08-067' }
|
||||
let(:mod_pull_requests) { good_pull_requests }
|
||||
let(:mod_refs) { ['URL', 'http://example.com'] }
|
||||
let(:mod_refs) { [Msf::Module::SiteReference.new('URL', 'http://example.com')] }
|
||||
let(:mod_platforms) { 'win' }
|
||||
let(:mod_options) { { 'RHOST' => rhost_option } }
|
||||
let(:mod_normal_rank) { 300 }
|
||||
|
@ -111,7 +112,7 @@ RSpec.describe Msf::Util::DocumentGenerator::DocumentNormalizer do
|
|||
describe 'normalize_pull_requests' do
|
||||
context 'when a hash of pull requests are given' do
|
||||
it 'returns HTML links' do
|
||||
expect(subject.send(:normalize_pull_requests, good_pull_requests)).to include('* <a href=')
|
||||
expect(subject.send(:normalize_pull_requests, good_pull_requests)).to include('](https://github.com/')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -159,7 +160,7 @@ RSpec.describe Msf::Util::DocumentGenerator::DocumentNormalizer do
|
|||
describe 'normalize_references' do
|
||||
context 'when an array of references is given' do
|
||||
it 'returns the reference list in HTML' do
|
||||
expect(subject.send(:normalize_references, msf_mod.references)).to include('* <a href=')
|
||||
expect(subject.send(:normalize_references, msf_mod.references)).to include('* [http://')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue