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.25.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.25.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.24.1 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.24.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
avm-eac_latex_base0-0.1.2 lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.23.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.22.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
avm-eac_latex_base0-0.1.1 lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.21.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.20.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.19.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
eac_tools-0.18.0 sub/avm-eac_latex_base0/lib/avm/eac_latex_base0/sources/build/chapters_content.rb
avm-eac_latex_base0-0.1.0 lib/avm/eac_latex_base0/sources/build/chapters_content.rb