Sha256: 2a6b4df7cb54522145e643143769eccd5a557eb2ed8fbac9173220d722240595
Contents?: true
Size: 497 Bytes
Versions: 3
Compression:
Stored size: 497 Bytes
Contents
# frozen_string_literal: true module Exclaim module Implementations PARAGRAPH_COMPONENT = ->(config, env, &render_child) do sentences = config['sentences'] || config['$paragraph'] rendered_sentences = sentences.map do |sentence| result = render_child.call(sentence, env) result.end_with?('.') ? result : "#{result}." end "<p>#{rendered_sentences.join(' ')}</p>" end PARAGRAPH_COMPONENT.define_singleton_method(:component?) { true } end end
Version data entries
3 entries across 3 versions & 1 rubygems