<commit_before># Copyright (c) 2008-2021 <NAME>, <NAME>, <NAME>,
#                         <NAME>
#               2002-2007 <NAME>
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
#

require 'review/builder'
require 'review/htmlutils'
require 'review/template'
require 'review/textutils'
require 'review/webtocprinter'
require 'tmpdir'
require 'open3'

module ReVIEW
  class HTMLBuilder < Builder
    include TextUtils
    include HTMLUtils

    [:ref].each do |e|
      Compiler.definline(e)
    end
    Compiler.defblock(:planning, 0..1)
    Compiler.defblock(:best, 0..1)
    Compiler.defblock(:security, 0..1)
    Compiler.defblock(:point, 0..1)
    Compiler.defblock(:shoot, 0..1)

    def pre_paragraph
      '<p>'
    end

    def post_paragraph
      '</p>'
    end

    def extname
      ".#{@book.config['htmlext']}"
    end

    def builder_init_file
      super
      @noindent = nil
      @ol_num = nil
      @chapter.book.image_types = %w[.png .jpg .jpeg .gif .svg]
      @column = 0
      @nonum_counter = 0
      @first_line_num = nil
      @body_ext = nil
      @toc = nil
      @javascripts = []
      @section_level = 0
      @section_stack = []
      if @book.config.maker
        if @book.config[@book.config.maker] && @book.config[@book.config.maker]['use_section']
          @use_section = true
        end
      elsif @book.config['epubmaker'] && @book.config['epubmaker']['use_section']
        # for review-compile
        @use_section = true
      end
    end
    private :builder_init_file

    def layoutfile
      if @book.config.maker == 'webmaker'
        htmldir = 'web/html'
        localfilename = 'layout-web.html.erb'
      else
        htmldir = 'html'
        localfilename = 'layout.html.erb'
      end
      if @book.htmlversion == 5
        htmlfilename = File.join(htmldir, 'layout-html5.html.erb')
      else
        htmlfilename = File.join(htmldir, 'layout-xhtml1.html.erb')
      end

      layout_file = File.join(@book.basedir, 'layouts', localfilename)
      if !File.exist?(layout_file) && File.exist?(File.join(@book.basedir, 'layouts', 'layout.erb'))
        raise ReVIEW::ConfigError, 'layout.erb is obsoleted. Please use layout.html.erb.'
      end<commit_msg>remove unused @section_level<commit_after># Copyright (c) 2008-2021 <NAME>, <NAME>, <NAME>,
#                         <NAME>
#               2002-2007 <NAME>
#
# This program is free software.
# You can distribute or modify this program under the terms of
# the GNU LGPL, Lesser General Public License version 2.1.
#

require 'review/builder'
require 'review/htmlutils'
require 'review/template'
require 'review/textutils'
require 'review/webtocprinter'
require 'tmpdir'
require 'open3'

module ReVIEW
  class HTMLBuilder < Builder
    include TextUtils
    include HTMLUtils

    [:ref].each do |e|
      Compiler.definline(e)
    end
    Compiler.defblock(:planning, 0..1)
    Compiler.defblock(:best, 0..1)
    Compiler.defblock(:security, 0..1)
    Compiler.defblock(:point, 0..1)
    Compiler.defblock(:shoot, 0..1)

    def pre_paragraph
      '<p>'
    end

    def post_paragraph
      '</p>'
    end

    def extname
      ".#{@book.config['htmlext']}"
    end

    def builder_init_file
      super
      @noindent = nil
      @ol_num = nil
      @chapter.book.image_types = %w[.png .jpg .jpeg .gif .svg]
      @column = 0
      @nonum_counter = 0
      @first_line_num = nil
      @body_ext = nil
      @toc = nil
      @javascripts = []
      @section_stack = []
      if @book.config.maker
        if @book.config[@book.config.maker] && @book.config[@book.config.maker]['use_section']
          @use_section = true
        end
      elsif @book.config['epubmaker'] && @book.config['epubmaker']['use_section']
        # for review-compile
        @use_section = true
      end
    end
    private :builder_init_file

    def layoutfile
      if @book.config.maker == 'webmaker'
        htmldir = 'web/html'
        localfilename = 'layout-web.html.erb'
      else
        htmldir = 'html'
        localfilename = 'layout.html.erb'
      end
      if @book.htmlversion == 5
        htmlfilename = File.join(htmldir, 'layout-html5.html.erb')
      else
        htmlfilename = File.join(htmldir, 'layout-xhtml1.html.erb')
      end

      layout_file = File.join(@book.basedir, 'layouts', localfilename)
      if !File.exist?(layout_file) && File.exist?(File.join(@book.basedir, 'layouts', 'layout.erb'))
        raise ReVIEW::ConfigError, 'layout.erb is obsoleted. Please use layout.html.erb.'
      end
{'fraction_non_alphanumeric': 0.12618636755823986, 'fraction_numerical': 0.014883520276100086, 'mean_word_length': 2.434814814814815, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '2851657', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1501, 'n_words': 349}