Sha256: 7752fba547bd8c2cee87f2692cc0f74537873a3680cacd59e54f145070dcb8e3

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

require "ncode-syosetu-core"
require "sanitize"

NcodeSyosetu::Model::Episode.class_eval do
  def body_ssml
    Sanitize.
        fragment(body_html, elements: %w(br p div)).
        gsub(%r(<br\s*/?>), "<break/>").
        gsub(%r(<(?:p|div)[^>]*>), '<p>').
        gsub(%r(</(?:p|div)>), '</p>')
  end

  def ssml
    <<-XML
<?xml version="1.0"?>
<speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="ja">
#{body_ssml}
</speak>
    XML
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ncode-syosetu-ssml-0.2.3 lib/ncode-syosetu-ssml.rb
ncode-syosetu-ssml-0.2.2 lib/ncode-syosetu-ssml.rb
ncode-syosetu-ssml-0.2.1 lib/ncode-syosetu-ssml.rb
ncode-syosetu-ssml-0.2.0 lib/ncode-syosetu-ssml.rb