def parse str, lang: :default, shadows: [], sections: nil
      lang = lang.to_sym
      delims = str.safe_delimiters
      str.split(/\R{2,}/).map { |para|
        [*shadows].concat(@shadows).uniq.each { |re|
          para.gsub!(re) { |m| "#{delims.first}#{Base64.encode64 m}#{delims.last}" }
        }
        @yaml.each { |key, values|
          next if sections && ![*sections].include?(key)
          values.each { |k, v|
            if !!v[:re]
              v[lang] = v[:default] if (!v[lang] || v[lang].size.zero?)
              raise MalformedRulesFile.new "Malformed rules file (no subst for #{v})" \
                if !v[lang] || v[lang].size.zero?
              substituted = !!v[:pattern] ?
                  para.gsub!(/#{v[:re]}/) { |m| m.gsub(/#{v[:pattern]}/, v[lang].first) } :
                  para.gsub!(/#{v[:re]}/, v[lang].first)
              # logger.warn "Unsafe substitutions were made to source:\n# ⇒ #{para}"\
              #  if v[:alert] && substituted
              if v[lang].size > 1
                para.gsub!(/#{v[lang].first}/) { |m|
                  prev = $`
                  obsoletes = prev.count(v[lang].join)
                  compliants = values[v[:compliant].to_sym][lang] ||
                               values[v[:compliant].to_sym][:default]
                  obsoletes -= prev.count(compliants.join) \
                    if !!v[:compliant]
                  !!v[:slave] ?
                    obsoletes -= prev.count(v[:original]) + 1 :
                    obsoletes += prev.count(v[:original])

                  v[lang][obsoletes % v[lang].size]
                }
              end
            end
          }
        }
        para
      }.join(%Q(

))
      .gsub(/#{delims.first}(.*?)#{delims.last}/m) { |m|
        Base64.decode64(m).force_encoding('UTF-8')
      }
    end
def parse str, lang: :default, shadows: [], sections: nil
      lang = lang.to_sym
      delims = str.safe_delimiters
      str.split(/\R{2,}/).map { |para|
        [*shadows].concat(@shadows).uniq.each { |re|
          para.gsub!(re) { |m| "#{delims.first}#{Base64.encode64 m}#{delims.last}" }
        }
        @yaml.each { |key, values|
          next if sections && ![*sections].include?(key)
          values.each { |k, v|
            if !!v[:re]
              v[lang] = v[:default] if (!v[lang] || v[lang].size.zero?)
              raise MalformedRulesFile.new "Malformed rules file (no subst for #{v})" \
                if !v[lang] || v[lang].size.zero?
              substituted = !!v[:pattern] ?
                  para.gsub!(/#{v[:re]}/) { |m| m.gsub(/#{v[:pattern]}/, v[lang].first) } :
                  para.gsub!(/#{v[:re]}/, v[lang].first)
              # logger.warn "Unsafe substitutions were made to source:\n# ⇒ #{para}"\
              #  if v[:alert] && substituted
              if v[lang].size > 1
                para.gsub!(/#{v[lang].first}/) { |m|
                  prev = $`
                  obsoletes = prev.count(v[lang].join)
                  compliants = values[v[:compliant].to_sym][lang] ||
                               values[v[:compliant].to_sym][:default]
                  obsoletes -= prev.count(compliants.join) \
                    if !!v[:compliant]
                  !!v[:slave] ?
                    obsoletes -= prev.count(v[:original]) + 1 :
                    obsoletes += prev.count(v[:original])

                  v[lang][obsoletes % v[lang].size]
                }
              end
            end
          }
        }
        para
      }.join(%Q(

))
      .gsub(/#{delims.first}(.*?)#{delims.last}/m) { |m|
        Base64.decode64(m).force_encoding('UTF-8')
      }
    end
Inplace version of string typographying.

 Retrieves the string and changes all the typewriters quotes (doubles
 and sigles), to inches, minutes, seconds, proper quotation signs.

 While the input strings are e.g.

     And God said "Baz heard "Bar" once" , and there was light.
     That's a 6.3" man, he sees sunsets at 10°20'30" E.

 It will produce:

     And God said “Baz heard ‘Bar’ once,” and there was light.
     That’s a 6.3″ man, he sees sunsets at 10°20′30″ E.

 The utility also handles dashes as well.

 @param str [String] the string to be typographyed inplace
 @param lang the language to use rules for