Class: Metanorma::Html::Renderers::PubidRenderer
- Inherits:
-
Object
- Object
- Metanorma::Html::Renderers::PubidRenderer
- Defined in:
- lib/metanorma/html/renderers/pubid_renderer.rb
Instance Method Summary collapse
-
#initialize(coordinator) ⇒ PubidRenderer
constructor
A new instance of PubidRenderer.
- #parse_pubid(docidentifier_string) ⇒ Object
- #pubid_to_html(identifier) ⇒ Object
Constructor Details
#initialize(coordinator) ⇒ PubidRenderer
Returns a new instance of PubidRenderer.
7 8 9 |
# File 'lib/metanorma/html/renderers/pubid_renderer.rb', line 7 def initialize(coordinator) @coordinator = coordinator end |
Instance Method Details
#parse_pubid(docidentifier_string) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/metanorma/html/renderers/pubid_renderer.rb', line 11 def parse_pubid(docidentifier_string) return nil if docidentifier_string.nil? || docidentifier_string.strip.empty? flavor_module = resolve_pubid_module return nil unless flavor_module flavor_module.parse(docidentifier_string) rescue StandardError nil end |
#pubid_to_html(identifier) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/metanorma/html/renderers/pubid_renderer.rb', line 22 def pubid_to_html(identifier) return nil unless identifier @coordinator.render_liquid("_pubid_identifier.html.liquid", { "publisher" => identifier.publisher ? escape_html(identifier.publisher) : nil, "number" => identifier.number ? escape_html(identifier.number.to_s) : nil, "date" => identifier.date ? escape_html(identifier.date.to_s) : nil, }) end |