Module: RDoc::Parser::ChangeLog::Git
- Defined in:
- lib/rdoc/parser/changelog.rb
Overview
The extension for Git commit log
Defined Under Namespace
Classes: LogEntry
Instance Method Summary collapse
-
#create_entries(entries) ⇒ Object
Returns a list of ChangeLog entries as RDoc::Parser::ChangeLog::Git::LogEntry list for the given
entries
. -
#parse_entries ⇒ Object
Parses the entries in the Git commit logs.
-
#parse_info(info) ⇒ Object
Parses auxiliary info.
Instance Method Details
#create_entries(entries) ⇒ Object
Returns a list of ChangeLog entries as RDoc::Parser::ChangeLog::Git::LogEntry list for the given entries
.
262 263 264 265 266 267 268 |
# File 'lib/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 ⇒ Object
Parses the entries in the Git commit logs
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/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] = header[/^ *Author: +(.*)/, 1] begin time = parse_date(header[/^ *CommitDate: +(.*)/, 1] || date) @time_cache[entry_name] = time .sub!(/\s*<(.*)>/, '') email = $1 entries << [entry_name, [, email, date, entry_body]] rescue ArgumentError end end entries end |
#parse_info(info) ⇒ Object
Parses auxiliary info. Currentry ‘base-url` to expand references is effective.
227 228 229 230 |
# File 'lib/rdoc/parser/changelog.rb', line 227 def parse_info(info) /^\s*base-url\s*=\s*(.*\S)/ =~ info @base_url = $1 end |