Class: Pubid::Renderers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pubid/renderers/base.rb

Direct Known Subclasses

HumanReadable, MrString, Urn

Constant Summary collapse

SEMANTIC_SPLIT =

Partitions a value into (leading separators, core, trailing separators) so “- : / space , .” stay OUTSIDE the annotation span (v1 parity).

%r{\A([-:/ ,.]*)(.*?)([-:/ ,.]*)\z}m
TYPED_STAGE_CSS =

type_code (a string) → semantic CSS class for the typed-stage token. Anything not listed (and not the default “is”) renders as “doctype”.

{
  "amd" => "amendment",
  "cor" => "corrigendum",
  "add" => "addendum",
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ Base

Returns a new instance of Base.



6
7
8
# File 'lib/pubid/renderers/base.rb', line 6

def initialize(identifier)
  @id = identifier
end

Class Method Details

.render(identifier) ⇒ Object



14
15
16
# File 'lib/pubid/renderers/base.rb', line 14

def self.render(identifier)
  new(identifier).render
end

Instance Method Details

#renderObject

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/pubid/renderers/base.rb', line 10

def render
  raise NotImplementedError, "#{self.class}#render not implemented"
end