Class: Pubid::Oasis::Renderer

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

Overview

Human-readable renderer for OASIS identifiers.

Renders the verbatim slug (original), prefixed with the "OASIS " publisher token unless id.with_publisher == false. Because rendering is a pure echo of original, the printed form always round-trips exactly.

"OASIS OSLC-CoreShapes-3.0-PS01-Pt8"  (with publisher)
"OSLC-CoreShapes-3.0-PS01-Pt8"        (without)

Constant Summary collapse

PUBLISHER =
"OASIS"

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



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

def render(context: nil, **opts)
  id = @id
  body = id.original.to_s
  with_publisher?(id) ? "#{PUBLISHER} #{body}" : body
end