Class: Pubid::Xsf::Renderer

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

Overview

Human-readable renderer for XSF identifiers.

Produces strings like "XEP 0001". With with_publisher: false it emits just the bare number ("0001").

Registered as the :human format in the XSF format registry and invoked via render(format: :human).

Constant Summary collapse

PUBLISHER =
"XEP"

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



15
16
17
18
19
20
# File 'lib/pubid/xsf/renderer.rb', line 15

def render(context: nil, **opts)
  id = @id
  return id.number.to_s if id.with_publisher == false

  "#{PUBLISHER} #{id.number}"
end