mirror of https://github.com/licensee/licensee.git
Markdown headings can have trailing hashes
https://daringfireball.net/projects/markdown/syntax#header May as well allow trailing =s as well though https://ruby.github.io/rdoc/RDoc/Markup.html#class-RDoc::Markup-label-Headers doesn't mention, I've seen in the wild and even added to text documents myself when forgetting that I'm not editing mediawiki markup
This commit is contained in:
parent
4f56b83883
commit
04cd733607
|
@ -11,7 +11,7 @@ module Licensee
|
|||
UNDERLINE_REGEX = /\n[-=]+/m
|
||||
CONTENT_REGEX = /^
|
||||
(?: # Header lookbehind
|
||||
[\#=]+\s#{TITLE_REGEX} # Start of hashes or rdoc header
|
||||
[\#=]+\s#{TITLE_REGEX}\s*[\#=]* # Start of hashes or rdoc header
|
||||
|
|
||||
#{TITLE_REGEX}#{UNDERLINE_REGEX} # Start of underlined header
|
||||
)$
|
||||
|
|
|
@ -107,6 +107,14 @@ RSpec.describe Licensee::ProjectFiles::ReadmeFile do
|
|||
end
|
||||
end
|
||||
|
||||
context 'With trailing hashes' do
|
||||
let(:content) { "## License ##\n\nhello world" }
|
||||
|
||||
it 'returns the license' do
|
||||
expect(license).to eql('hello world')
|
||||
end
|
||||
end
|
||||
|
||||
context 'Rdoc' do
|
||||
let(:content) { "== License:\n\nhello world" }
|
||||
|
||||
|
|
Loading…
Reference in New Issue