Sha256: 630efd8a5cc1c47456a85a01faa3d15f9f87b7a84a2f028d01084c62a0e21c2b
Contents?: true
Size: 896 Bytes
Versions: 1
Compression:
Stored size: 896 Bytes
Contents
require_relative 'processor' require_relative 'concerns/no_content' module SSMD::Processors class BreakProcessor < Processor prepend NoContent def result name, value = attribute "<break #{name}=\"#{value}\"/>" end def text "" end def regex /(?<=\s|\A)\.\.\.(?:(?<comma>c)|(?<sentence>s)|(?<paragraph>p)|(?<s>\d+s)|(?<ms>\d+ms)|(?<num>\d+))?(?=\s|\z)/ end def attribute if ms = (match[:num] || match[:ms]) if ms == "0" ["strength", "none"] else ["time", "#{ms.to_i}ms"] end elsif s = match[:s] ["time", "#{s.to_i}s"] elsif match[:paragraph] ["strength", "x-strong"] elsif match[:sentence] ["strength", "strong"] elsif match[:comma] ["strength", "medium"] else ["strength", "x-strong"] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ssmd-0.7.6 | lib/ssmd/processors/break_processor.rb |