<commit_before>module Middleman
  module Blog
    class Options
      KEYS = [
        :permalink,
        :sources,
        :taglink,
        :layout,
        :summary_separator,
        :summary_length,
        :year_link,
        :month_link,
        :day_link,
        :default_extension,
        :calendar_template,
        :year_template,
        :month_template,
        :day_template,
        :tag_template
      ]
      
      KEYS.each do |name|
        attr_accessor name
      end
      
      def initialize(options={})
        options.each do |k,v|
          self.send(:"#{k}=", v)
        end
      end
    end
    
    class << self
      def registered(app, options_hash={}, &block)
        require 'middleman-blog/blog_data'
        require 'middleman-blog/blog_article'
        
        app.send :include, Helpers
        
        options = Options.new(options_hash)
        yield options if block_given?
        
        options.permalink         ||= "/:year/:month/:day/:title.html"
        options.sources           ||= ":year-:month-:day-:title.html"
        options.taglink           ||= "tags/:tag.html"
        options.layout            ||= "layout"
        options.summary_separator ||= /(READMORE)/
        options.summary_length    ||= 250
        options.year_link         ||= "/:year.html"
        options.month_link        ||= "/:year/:month.html"
        options.day_link          ||= "/:year/:month/:day.html"
        options.default_extension ||= ".markdown"

        # optional: :tag_template
        # optional: :year_template
        # optional: :month_template
        # optional: :day_template
        # Allow one setting to set all the calendar templates
        if options.calendar_template
          options.year_template  ||= options.calendar_template
          options.month_template ||= options.calendar_template
          options.day_template   ||= options.calendar_template
        end

        app.after_configuration do
          # Initialize blog with options
          blog(options)
          <commit_msg>Add a blog.prefix option to make setting all the path options easier<commit_after>module Middleman
  module Blog
    class Options
      KEYS = [
        :prefix,
        :permalink,
        :sources,
        :taglink,
        :layout,
        :summary_separator,
        :summary_length,
        :year_link,
        :month_link,
        :day_link,
        :default_extension,
        :calendar_template,
        :year_template,
        :month_template,
        :day_template,
        :tag_template
      ]
      
      KEYS.each do |name|
        attr_accessor name
      end
      
      def initialize(options={})
        options.each do |k,v|
          self.send(:"#{k}=", v)
        end
      end
    end
    
    class << self
      def registered(app, options_hash={}, &block)
        require 'middleman-blog/blog_data'
        require 'middleman-blog/blog_article'
        
        app.send :include, Helpers
        
        options = Options.new(options_hash)
        yield options if block_given?
        
        options.permalink         ||= "/:year/:month/:day/:title.html"
        options.sources           ||= ":year-:month-:day-:title.html"
        options.taglink           ||= "tags/:tag.html"
        options.layout            ||= "layout"
        options.summary_separator ||= /(READMORE)/
        options.summary_length    ||= 250
        options.year_link         ||= "/:year.html"
        options.month_link        ||= "/:year/:month.html"
        options.day_link          ||= "/:year/:month/:day.html"
        options.default_extension ||= ".markdown"

        # optional: :tag_template
        # optional: :year_template
        # optional: :month_template
        # optional: :day_template
        # Allow one setting to set all the calendar templates
        if options.calendar_template
          options.year_template  ||= options.calendar_template
          options.month_template ||= options.calendar_template
          options.day_template   ||= options.calendar_template
        end

        # If "prefix" option is specified, all other paths are relative to it.
        if options.prefix
          options.prefix = "/#{options.prefix}" unless options.prefix.start_with? '/'
          options.permalink = File.join(options.prefix, options.permalink)
          options.sources = File.join(options.prefix, options.sources)
          options.taglink = File.join(options.prefix, options.taglink)
          options.year_link = File.join(options.prefix, options.year_link)
          options.month_link = File.join(options.prefix, options.month_link)
          options.day_link = File.join(options.prefix, options.day_link)
        end

        app.after_configuration do
          # Initialize blog with options
          blog(options)
          
{'fraction_non_alphanumeric': 0.10306291390728477, 'fraction_numerical': 0.0012417218543046358, 'mean_word_length': 1.8346041055718476, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 3, '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': '6622732', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1344, 'n_words': 269}