Class: Pubid::Bsi::Renderer::Base

Inherits:
Core::Renderer::Base
  • Object
show all
Defined in:
lib/pubid/bsi/renderer/base.rb

Constant Summary collapse

TYPE =
"".freeze

Instance Method Summary collapse

Instance Method Details

#render_edition(edition, _opts, _params) ⇒ Object



27
28
29
# File 'lib/pubid/bsi/renderer/base.rb', line 27

def render_edition(edition, _opts, _params)
  " v#{edition}"
end

#render_identifier(params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pubid/bsi/renderer/base.rb', line 5

def render_identifier(params)
  suffix = "%{year}%{supplement}%{tracked_changes}%{translation}%{pdf}" % params
  unless params[:adopted].to_s.empty?
    # ignore year for adopted document if already defined for base document
    unless params[:year].empty?
      params[:adopted].year = nil
      # ignore year for adopted identifier assigned to adopted identifier
      if params[:adopted].respond_to?(:adopted) && params[:adopted].adopted
        params[:adopted].adopted.year = nil
      end
    end

    return "%{publisher} %{adopted}#{suffix}" % params
  end

  "%{publisher} %{number}%{part}#{suffix}" % params
end

#render_month(month, _opts, _params) ⇒ Object



23
24
25
# File 'lib/pubid/bsi/renderer/base.rb', line 23

def render_month(month, _opts, _params)
  "-#{month}"
end

#render_pdf(pdf, _opts, _params) ⇒ Object



43
44
45
# File 'lib/pubid/bsi/renderer/base.rb', line 43

def render_pdf(pdf, _opts, _params)
  " PDF" if pdf
end

#render_supplement(supplement, _opts, _params) ⇒ Object



31
32
33
# File 'lib/pubid/bsi/renderer/base.rb', line 31

def render_supplement(supplement, _opts, _params)
  supplement.to_s
end

#render_tracked_changes(tracked_changes, _opts, _params) ⇒ Object



35
36
37
# File 'lib/pubid/bsi/renderer/base.rb', line 35

def render_tracked_changes(tracked_changes, _opts, _params)
  " - TC" if tracked_changes
end

#render_translation(translation, _opts, _params) ⇒ Object



39
40
41
# File 'lib/pubid/bsi/renderer/base.rb', line 39

def render_translation(translation, _opts, _params)
  " (#{translation})"
end