summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Davis <ryand@zenspider.com>2009-06-22 18:52:57 -0800
committerRyan Davis <ryand@zenspider.com>2009-06-22 18:52:57 -0800
commit1813cdcedbfbcac3dae62a4c9a5a588fa8948831 (patch)
tree66c05da7d381042af73dab7c4aab7bbc02edcb37
parentd87a2b5389bed122a797af9e0e9224d11cded6c4 (diff)
downloadhoe-1813cdcedbfbcac3dae62a4c9a5a588fa8948831.tar.gz
+ History intuition extended for markdown. drnic/jbarnette
[git-p4: depot-paths = "//src/hoe/dev/": change = 5137]
-rw-r--r--lib/hoe.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/hoe.rb b/lib/hoe.rb
index 9944e1b..69689d4 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -437,12 +437,13 @@ class Hoe
# Intuit values from the readme and history files.
def intuit_values
- readme = File.read_utf(readme_file).split(/^(=+ .*)$/)[1..-1] rescue ''
+ header_re = /^((?:=+|#+) .*)$/
+ readme = File.read_utf(readme_file).split(header_re)[1..-1] rescue ''
+
unless readme.empty? then
- sections = readme.map { |s|
- s =~ /^=/ ? s.strip.downcase.chomp(':').split.last : s.strip
- }
- sections = Hash[*sections]
+ sections = Hash[*readme.map { |s|
+ s =~ /^[=#]/ ? s.strip.downcase.chomp(':').split.last : s.strip
+ }]
desc = sections.values_at(*description_sections).join("\n\n")
summ = desc.split(/\.\s+/).first(summary_sentences).join(". ")
@@ -455,7 +456,7 @@ class Hoe
self.changes ||= begin
h = File.read_utf(history_file)
- h.split(/^(===.*)/)[1..2].join.strip
+ h.split(/^(={2,}|\#{2,})/)[1..2].join.strip
rescue
missing history_file
''