<commit_before>#
#
# Author:  Michael 'entropie' Trommer <<EMAIL>>
#


require 'rubygems'
require "net/http"

begin
  require "rspec/core/rake_task"
rescue LoadError
end

require "cgi"
require "date"

require "lib/oy"

require "rake/maintenance.rb"
include OY

OY.path = "/Users/mit/Source/oytest"

task :todo_to_page do
  def mk_class(line)
    csscls =
      case line[/\{(.{1})\}/, 1]
      when "*": :todo_done
      when "-": :todo_canceled
      else
        :todo_default
      end
    %Q[(#{csscls})]
  end

  contents = File.readlines("TODO.howm")
  title = "h1. %s\n\n" % contents.shift.delete("=").strip
  str = "#{title}Generated at <i>#{Time.now}</i> from <em>TODO.howm</em>\n\n\n"
  contents.reject!{|line| line.strip.empty? or line =~ /^<<</}


  last = 0
  contents.each do |line|
    prefixs = line.scan(/^\s+/).first.size rescue 0
    listr = "*#{mk_class(line)} %s"

    line = line.gsub(/(\{.{1}\}\s+)/, '').strip

    if prefixs == 2 and last == 0
      str << "*#{listr}\n" % line
    elsif last == 2 and prefixs == 0
      str << "\n" % line<commit_msg>ruby 1.9 does not like "when: foo"<commit_after>#
#
# Author:  Michael 'entropie' Trommer <<EMAIL>>
#


require 'rubygems'
require "net/http"

begin
  require "rspec/core/rake_task"
rescue LoadError
end

require "cgi"
require "date"

require "lib/oy"

require "rake/maintenance.rb"
include OY

OY.path = "/Users/mit/Source/oytest"

task :todo_to_page do
  def mk_class(line)
    csscls =
      case line[/\{(.{1})\}/, 1]
      when "*" then :todo_done
      when "-" then :todo_canceled
      else
        :todo_default
      end
    %Q[(#{csscls})]
  end

  contents = File.readlines("TODO.howm")
  title = "h1. %s\n\n" % contents.shift.delete("=").strip
  str = "#{title}Generated at <i>#{Time.now}</i> from <em>TODO.howm</em>\n\n\n"
  contents.reject!{|line| line.strip.empty? or line =~ /^<<</}


  last = 0
  contents.each do |line|
    prefixs = line.scan(/^\s+/).first.size rescue 0
    listr = "*#{mk_class(line)} %s"

    line = line.gsub(/(\{.{1}\}\s+)/, '').strip

    if prefixs == 2 and last == 0
      str << "*#{listr}\n" % line
    elsif last == 2 and prefixs == 0
      str << "\n" % line
{'fraction_non_alphanumeric': 0.19624025676295279, 'fraction_numerical': 0.010087116001834021, 'mean_word_length': 2.7881944444444446, 'pattern_counts': {'":': 2, '<': 29, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2516661', 'n_tokens_mistral': 898, 'n_tokens_neox': 869, 'n_words': 197}