模块 RDoc::Parser::ChangeLog::Git

Git 提交日志的扩展

公共实例方法

create_entries(entries) 点击以切换源代码

返回给定 entriesChangeLog 条目的列表,作为 RDoc::Parser::ChangeLog::Git::LogEntry 列表。

# File rdoc/parser/changelog.rb, line 262
def create_entries entries
  # git log entries have no strictly itemized style like the old
  # style, just assume Markdown.
  entries.map do |commit, entry|
    LogEntry.new(@base_url, commit, *entry)
  end
end
parse_entries() 点击以切换源代码

解析 Git 提交日志中的条目

# File rdoc/parser/changelog.rb, line 235
def parse_entries
  entries = []

  @content.scan(/^commit\s+(\h{20})\h*\n((?:.+\n)*)\n((?: {4}.*\n+)*)/) do
    entry_name, header, entry_body = $1, $2, $3.gsub(/^ {4}/, '')
    # header = header.scan(/^ *(\S+?): +(.*)/).to_h
    # date = header["CommitDate"] || header["Date"]
    date = header[/^ *(?:Author)?Date: +(.*)/, 1]
    author = header[/^ *Author: +(.*)/, 1]
    begin
      time = parse_date(header[/^ *CommitDate: +(.*)/, 1] || date)
      @time_cache[entry_name] = time
      author.sub!(/\s*<(.*)>/, '')
      email = $1
      entries << [entry_name, [author, email, date, entry_body]]
    rescue ArgumentError
    end
  end

  entries
end
parse_info(info) 点击以切换源代码

解析辅助信息。当前,“base-url” 用于展开引用是有效的。

# File rdoc/parser/changelog.rb, line 227
def parse_info(info)
  /^\s*base-url\s*=\s*(.*\S)/ =~ info
  @base_url = $1
end