Class: Pubid::Bsi::Renderer

Inherits:
Renderers::Base show all
Defined in:
lib/pubid/bsi/renderer.rb

Overview

Human-readable renderer for BSI identifiers.

Produces strings like:

"BS 4592-0:2006+A1:2012"
"BSI Flex 220 v1.0:2024"
"NA+A1:2012 to BS EN 1090-2:2018"

The renderer is registered as the :human format in the BSI format registry and invoked via render(format: :human).

For wrapper types (Consolidated, NationalAnnex, ExpertCommentary, etc.) the renderer composes child identifiers. For simple identifiers it dispatches to type-specific rendering methods.

Constant Summary

Constants inherited from Renderers::Base

Renderers::Base::SEMANTIC_SPLIT, Renderers::Base::TYPED_STAGE_CSS

Instance Method Summary collapse

Methods inherited from Renderers::Base

#initialize, render

Constructor Details

This class inherits a constructor from Pubid::Renderers::Base

Instance Method Details

#render(context: nil, **opts) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/pubid/bsi/renderer.rb', line 19

def render(context: nil, **opts)
  @context = context
  id = @id

  case id
  when Identifiers::AddendumDocument
    render_addendum_document(id, opts)
  when Identifiers::AdoptedEuropeanNorm
    render_adopted_european_norm(id)
  when Identifiers::AdoptedInternationalStandard
    render_adopted_international_standard(id)
  when Identifiers::AerospaceStandard
    render_aerospace_standard(id)
  when Identifiers::Amendment
    render_amendment(id)
  when Identifiers::BritishIndustrialPractice
    render_british_industrial_practice(id)
  when Identifiers::BundledIdentifier
    render_bundled_identifier(id)
  when Identifiers::CommitteeDocument
    render_committee_document(id)
  when Identifiers::ConsolidatedIdentifier
    render_consolidated_identifier(id, opts)
  when Identifiers::Corrigendum
    render_corrigendum(id)
  when Identifiers::DetailedSpecification
    render_detailed_specification(id)
  when Identifiers::Disc
    render_disc(id)
  when Identifiers::DraftDocument
    render_draft_document(id)
  when Identifiers::ElectronicBook
    render_electronic_book(id)
  when Identifiers::ExpertCommentary
    render_expert_commentary(id)
  when Identifiers::ExplanatorySupplement
    render_explanatory_supplement(id)
  when Identifiers::Flex
    render_flex(id)
  when Identifiers::Handbook
    render_handbook(id)
  when Identifiers::Index
    render_index(id)
  when Identifiers::Method
    render_method(id)
  when Identifiers::NationalAnnex
    render_national_annex(id)
  when Identifiers::PracticeGuide
    render_practice_guide(id)
  when Identifiers::PubliclyAvailableSpecification
    render_publicly_available_specification(id)
  when Identifiers::PublishedDocument
    render_published_document(id)
  when Identifiers::Section
    render_section(id)
  when Identifiers::Set
    render_set(id)
  when Identifiers::StandaloneAmendment
    render_standalone_amendment(id)
  when Identifiers::SupplementDocument
    render_supplement_document(id)
  when Identifiers::SupplementaryIndex
    render_supplementary_index(id)
  when Identifiers::TechnicalSpecification
    render_technical_specification(id)
  when Identifiers::TestMethod
    render_test_method(id)
  when Identifiers::ValueAddedPublication
    render_value_added_publication(id, opts)
  when SingleIdentifier
    render_single_identifier(id)
  else
    id.to_s
  end
end