Class: Pubid::Ecma::Renderer
- Inherits:
-
Renderers::Base
- Object
- Renderers::Base
- Pubid::Ecma::Renderer
- Defined in:
- lib/pubid/ecma/renderer.rb
Overview
Human-readable renderer for ECMA identifiers.
Produces strings like:
"ECMA-411" standard
"ECMA-418-1" standard with part
"ECMA TR/101" technical report
"ECMA MEM/1970" memento
With with_publisher: false the leading ECMA token is dropped, yielding
"-411" / "TR/101" / "MEM/1970". The edition is never rendered — it is
separate metadata carried only in to_hash.
Constant Summary collapse
- PUBLISHER =
"ECMA"
Constants inherited from Renderers::Base
Renderers::Base::SEMANTIC_SPLIT, Renderers::Base::TYPED_STAGE_CSS
Instance Method Summary collapse
Methods inherited from Renderers::Base
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 |
# File 'lib/pubid/ecma/renderer.rb', line 19 def render(context: nil, **opts) id = @id # Standard joins the publisher directly ("ECMA-411"); TR/MEM separate it # with a space ("ECMA TR/101"). type_prefix is nil only for standards. sep = id.type_prefix.nil? ? "" : " " core = id.type_prefix.nil? ? standard_core(id) : typed_core(id) with_publisher?(id) ? "#{PUBLISHER}#{sep}#{core}" : core end |