Sha256: 07e230d19a3d274a1b3870087f8f785ca804d438f9bd0ea16b5e5242e1ade3c3

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

require 'lncs/actions'

module LNCS
  class Section
    attr_accessor :manifest, :proceedings
  
    def papers
      manifest["papers"].map do |paper_id|      
        Paper.new.tap do |p|
          p.manifest = proceedings.paper_manifest_for(paper_id)
          p.path = proceedings.paper_path_for(paper_id)
        end
      end
    end
    
    def title
      manifest["title"]
    end
  
    def copy_to(dst)
      papers.each { |paper| paper.copy_to("#{dst}/#{paper.id}") }
    end
  
    def generate_body_to(dst, volume_number, start_page)
      papers.each do |paper|
        padded_start_page = "%04d" % start_page.to_s
        paper.copy_to("#{dst}/#{volume_number}#{padded_start_page}")  
        start_page += paper.page_count
      end
      start_page
    end
  
    def generate_titles_to(dst, start_page)
      titles = []
      papers.each do |paper|
        padded_start_page = "%04d" % start_page.to_s
        titles << "#{dst}/#{padded_start_page}.tex"
        paper.generate_title_to(titles.last, start_page)
        start_page += paper.page_count
      end
      
      actions.append_file("#{dst}/index.tex") do
        "\\addtocmark{#{title}}\n" +
        titles.map {|title| "\\input{#{title}}\n"}.join
      end
    
      start_page
    end
  
    def report
      puts title
      papers.each { |paper| puts "#{"%03d" % paper.id} -- #{paper.page_count}pgs #{paper.type}" }
    end
    
  private
    def actions
      Actions.new
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lncs-0.0.2 lib/lncs/section.rb
lncs-0.0.1 lib/lncs/section.rb