Class: RDoc::Parser::ChangeLog::Git::LogEntry
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Struct
|
|
|
Instance Chain:
self,
Struct
|
|
| Inherits: |
Struct
|
| Defined in: | lib/rdoc/parser/changelog.rb |
Constant Summary
-
HEADING_LEVEL =
# File 'lib/rdoc/parser/changelog.rb', line 2723
Class Method Summary
Instance Attribute Summary
Instance Method Summary
Constructor Details
.new(base, commit, author, email, date, contents) ⇒ LogEntry
# File 'lib/rdoc/parser/changelog.rb', line 274
def initialize(base, commit, , email, date, contents) case contents when String if base&.match(%r[\A([^:/]:/[^/]/)[^/]/[^/]+/]) repo, host = $&, $1 contents = contents.dup # base: https://github.com/ruby/ruby/ # Fix #15791 -> Fix [#15791](https://github.com/ruby/ruby/pull/15791) # GH-15791 -> [GH-15791](https://github.com/ruby/ruby/pull/15791) # (#15791) -> ([#15791](https://github.com/ruby/ruby/pull/15791)) contents.gsub!(/\b(?:(?i:fix(?:e[sd])?) )\K\#(\d\b)|\bGH-(\d)\b|\(\K\#(\d)(?=\))/) do "[#{$&}](#{repo}pull/#{$1 || $2 || $3})" end # repo#PR, repo@HASH # ruby/ruby#15791 -> [ruby/ruby#15791](https://github.com/ruby/ruby/pull/15791) # ruby/ruby@a8a989b6 -> [ruby/ruby@a8a989b6](https://github.com/ruby/ruby/commit/a8a989b6) # ref in branckets is not extended # [ruby/net-imap#543][ruby/ruby#15791] -> [ruby/net-imap#543][ruby/ruby#15791] contents.gsub!(%r[(?<![-\w#/@]|\]\[)([-\w]/[-\w])(?:@(\h{8,40})|\#(\d+))(?![-\w#/@]|\]\[)]) do path = defined?($2) ? "commit/#{$2}" : "pull/#{$3}" "[#{$&}](#{host}#{$1}/#{path})" end end contents = RDoc::Markdown.parse(contents).parts.each do |body| case body when RDoc::Markup::Heading body.level += HEADING_LEVEL + 1 end end case first = contents[0] when RDoc::Markup::Paragraph contents[0] = RDoc::Markup::Heading.new(HEADING_LEVEL + 1, first.text) end end super end
Instance Attribute Details
#author (rw)
[ GitHub ]#base (rw)
[ GitHub ]#commit (rw)
[ GitHub ]#contents (rw)
[ GitHub ]#date (rw)
[ GitHub ]#email (rw)
[ GitHub ]Instance Method Details
#accept(visitor)
[ GitHub ]# File 'lib/rdoc/parser/changelog.rb', line 343
def accept(visitor) visitor.accept_heading self begin if visitor.respond_to?(:code_object=) code_object = visitor.code_object visitor.code_object = self end contents.each do |body| body.accept visitor end ensure if visitor.respond_to?(:code_object) visitor.code_object = code_object end end end
#aref
[ GitHub ]# File 'lib/rdoc/parser/changelog.rb', line 316
def aref commit end
#label(context = nil)
[ GitHub ]# File 'lib/rdoc/parser/changelog.rb', line 324
def label(context = nil) aref end
#legacy_aref
[ GitHub ]# File 'lib/rdoc/parser/changelog.rb', line 320
def legacy_aref "label-#{commit}" end
#legacy_label(context = nil)
[ GitHub ]# File 'lib/rdoc/parser/changelog.rb', line 328
def legacy_label(context = nil) legacy_aref end
#level
[ GitHub ]# File 'lib/rdoc/parser/changelog.rb', line 312
def level HEADING_LEVEL end
#pretty_print(q)
This method is for internal use only.
[ GitHub ]
# File 'lib/rdoc/parser/changelog.rb', line 360
def pretty_print(q) # :nodoc: q.group(2, '[log_entry: ', ']') do q.text commit q.text ',' q.breakable q.group(2, '[date: ', ']') { q.text date } q.text ',' q.breakable q.group(2, '[author: ', ']') { q.text } q.text ',' q.breakable q.group(2, '[email: ', ']') { q.text email } q.text ',' q.breakable q.pp contents end end