Class: LNCS::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/lncs/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#manifestObject

Returns the value of attribute manifest.



5
6
7
# File 'lib/lncs/section.rb', line 5

def manifest
  @manifest
end

#proceedingsObject

Returns the value of attribute proceedings.



5
6
7
# File 'lib/lncs/section.rb', line 5

def proceedings
  @proceedings
end

Instance Method Details

#copy_to(dst) ⇒ Object



21
22
23
# File 'lib/lncs/section.rb', line 21

def copy_to(dst)
  papers.each { |paper| paper.copy_to("#{dst}/#{paper.id}") }
end

#generate_body_to(dst, volume_number, start_page) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/lncs/section.rb', line 29

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

#generate_titles_to(dst, start_page) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/lncs/section.rb', line 38

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

#paper_data_for_manifest(existing_data) ⇒ Object



25
26
27
# File 'lib/lncs/section.rb', line 25

def paper_data_for_manifest(existing_data)
  papers.reduce({}) { |data, paper| data.merge(paper.data_for_manifest(existing_data)) }
end

#papersObject



7
8
9
10
11
12
13
14
15
# File 'lib/lncs/section.rb', line 7

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)
      p.proceedings = proceedings
    end
  end
end

#reportObject



55
56
57
58
# File 'lib/lncs/section.rb', line 55

def report
  puts title
  papers.each { |paper| puts "#{"%03d" % paper.id} -- #{paper.page_count}pgs #{paper.type}" }
end

#titleObject



17
18
19
# File 'lib/lncs/section.rb', line 17

def title
  manifest["title"]
end