<commit_before>module RevealCK
  #
  # Public: A SlideBuilder knows how to build the index.html file (the
  # core slides) within a reveal.js presentation.
  #
  class SlideBuilder < Builder

    attr_reader :user_slides, :reveal_slides

    attr_reader :tasks

    attr_reader :config

    def initialize(args)
      @user_slides = args[:user_slides]
      @reveal_slides = args[:reveal_slides]
      @config = args[:config]
    end

    private

    def register_tasks

      @tasks = []

      add_task "Slicing out reveal.js default slides",
               lambda {
                 line_nums = {
                   default_slides: {
                     first: 38, # Line where I see <div class="slides">
                     last: 346  # Closing <div>
                   }
                 }
                 default_slides = line_nums[:default_slides][:first]..line_nums[:default_slides][:last]
                 FileSlicer.remove! reveal_slides, default_slides
               }

      add_task "Splicing in slides from #{user_slides}",
               lambda {
                 FileSplicer.insert! user_slides, into: reveal_slides, after: '<div class="slides">'
               }

      old_title = 'reveal.js - The HTML Presentation Framework'
      new_title = config.title
      add_task "Replacing the <title>",
               lambda {
                 FileStringReplacer.replace! reveal_slides, old: old_title, new: config.title
               }

      old_author = 'name="author" content="<NAME>"'
      new_author = 'name="author" content="' + config.author + '"'
      add_task "Replacing the <meta name='author'>",
               lambda {
                 FileStringReplacer.replace! reveal_slides, old: old_author, new: new_author
               }

      old_theme = 'href="css/theme/default.css" id="theme"'
      new_theme = 'href="css/theme/' + config.theme + '.css" id="theme"'
      add_task 'Replacing the core theme',
               lambda {
                 FileStringReplacer.replace! reveal_slides, old: old_theme, new: new_theme
               }
    end

  end
end<commit_msg>[cane, reek] Tweaks for clarity<commit_after>module RevealCK
  #
  # Public: A SlideBuilder knows how to build the index.html file (the
  # core slides) within a reveal.js presentation.
  #
  class SlideBuilder < Builder

    attr_reader :user_slides, :reveal_slides

    attr_reader :tasks

    attr_reader :config

    def initialize(args)
      @user_slides = args[:user_slides]
      @reveal_slides = args[:reveal_slides]
      @config = args[:config]
    end

    private

    def register_tasks

      @tasks = []

      add_task "Slicing out reveal.js default slides",
               lambda {
                 begin_line_num = 38 # Line where I see <div class="slides">
                 end_line_num = 346 # Closing <div>
                 default_slides = begin_line_num..end_line_num
                 FileSlicer.remove! reveal_slides, default_slides
               }

      add_task "Splicing in slides from #{user_slides}",
               lambda {
                 FileSplicer.insert!(user_slides,
                                     into: reveal_slides,
                                     after: '<div class="slides">')
               }

      old_title = 'reveal.js - The HTML Presentation Framework'
      new_title = config.title
      add_task "Replacing the <title>",
               lambda {
                 FileStringReplacer.replace!(reveal_slides,
                                             old: old_title,
                                             new: new_title)
               }

      old_author = 'name="author" content="<NAME>"'
      new_author = 'name="author" content="' + config.author + '"'
      add_task "Replacing the <meta name='author'>",
               lambda {
                 FileStringReplacer.replace!(reveal_slides,
                                             old: old_author,
                                             new: new_author)
               }

      old_theme = 'href="css/theme/default.css" id="theme"'
      new_theme = 'href="css/theme/' + config.theme + '.css" id="theme"'
      add_task 'Replacing the core theme',
               lambda {
                 FileStringReplacer.replace!(reveal_slides,
                                             old: old_theme,
                                             new: new_theme)
               }
    end

  end
end
{'fraction_non_alphanumeric': 0.09058052857465552, 'fraction_numerical': 0.00225886604924328, 'mean_word_length': 1.6108490566037736, 'pattern_counts': {'":': 0, '<': 17, '<?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': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2465111', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1188, 'n_words': 283}