PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/bin/extract-news.rb

https://bitbucket.org/shlomif_rsip/perl-begin
Ruby | 24 lines | 23 code | 1 blank | 0 comment | 3 complexity | 19a96ab219cd31a43ca2a6c2dddc6b05 MD5 | raw file
  1. date=ARGV.shift
  2. $s = ''
  3. extract1 = false
  4. extract2 = false
  5. finish = false
  6. IO.foreach('src/news/index.html.wml') do |l|
  7. if finish
  8. nil # do nothing.
  9. elsif (l =~ /#{date}/)
  10. extract1 = true
  11. elsif extract2 then
  12. if (l =~ /^<h2/)
  13. finish = true
  14. else
  15. $s += l.gsub(/\$\(ROOT\)/, 'http://perl-begin.org')
  16. end
  17. elsif extract1 then
  18. if (l =~ /<\/h2/)
  19. extract2 = true
  20. end
  21. end
  22. end
  23. print $s