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
eac_tools-0.37.2 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.37.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.37.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.36.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.36.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.35.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.34.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.33.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
avm-eac_latex_base0-0.2.1 lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.32.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.31.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.31.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.30.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.29.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.28.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.27.2 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.27.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
avm-eac_latex_base0-0.2.0 lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.27.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.26.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb