class RDoc::Parser::ChangeLog::Git::LogEntry
Attributes
Public Class Methods
# File lib/rdoc/parser/changelog.rb, line 274 def initialize(base, commit, author, 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
Calls superclass method
Public Instance Methods
Source
# 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
Source
# File lib/rdoc/parser/changelog.rb, line 324 def label(context = nil) aref end
Source
# File lib/rdoc/parser/changelog.rb, line 320 def legacy_aref "label-#{commit}" end
Source
# File lib/rdoc/parser/changelog.rb, line 328 def legacy_label(context = nil) legacy_aref end
Source
# File lib/rdoc/parser/changelog.rb, line 332 def text case base when nil "#{date}" when /%s/ "{#{date}}[#{base % commit}]" else "{#{date}}[#{base}#{commit}]" end + " {#{author}}[mailto:#{email}]" end