Sha256: aa59e4c61327dc9cfa932c5dc9968d76cc673cab7edd784c57e8dc4719d1fd6c
Contents?: true
Size: 797 Bytes
Versions: 3
Compression:
Stored size: 797 Bytes
Contents
require_relative 'processor' module SSMD::Processors class BreakProcessor < Processor def result name, value = attribute "<break #{name}=\"#{value}\"/>" end def regex /(?<=\s)\.\.\.(?:(?<comma>c)|(?<sentence>s)|(?<paragraph>p)|(?<s>\d+s)|(?<ms>\d+ms)|(?<num>\d+))?(?=\s)/ 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ssmd-0.7.0 | lib/ssmd/processors/break_processor.rb |
ssmd-0.6.1 | lib/ssmd/processors/break_processor.rb |
ssmd-0.6.0 | lib/ssmd/processors/break_processor.rb |