Sha256: af524f1d165f46189f645d74b189fac62d9e2727df8f6f9c97fed685c8689523

Contents?: true

Size: 1.21 KB

Versions: 113

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

module Avm
  module EacLatexBase0
    module Sources
      class Build
        class << self
          def chapter_filename(chapter_name)
            "chapter_#{chapter_name}"
          end
        end

        module ChaptersContent
          private

          def chapter
            options[:chapter]
          end

          def chapter_filename(chapter_name)
            ::Avm::EacLatexBase0::Sources::Build.chapter_filename(chapter_name)
          end

          def check_chapter
            return unless chapter
            return if project.chapters.include?(chapter)

            fatal_error("Chapter not found: \"#{chapter}\" (List: #{project.chapters})")
          end

          def include_content
            main_path = source_temp_dir.join('main.tex')
            main_path.write(main_path.read.gsub(CONTENT_VAR, include_chapters_content))
          end

          def include_chapters_content
            r = chapters_content
            r = "\\maketitle\n\n#{r}" if chapter.blank?
            r
          end

          def chapters_content
            project.chapters.map { |c| "\\include{#{chapter_filename(c)}}" }.join("\n")
          end
        end
      end
    end
  end
end

Version data entries

113 entries across 113 versions & 2 rubygems

Version Path
avm-eac_latex_base0-0.3.2 lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.85.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.85.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.84.2 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.84.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.84.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.83.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.82.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.81.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.80.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.79.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.78.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.77.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.77.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.76.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.76.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.75.2 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.75.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.75.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.74.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb