Sha256: d4f3260846c6e8ca032934c334ef3c3bc4eaaf4a5f1803086f1af5e024e6dc05
Contents?: true
Size: 719 Bytes
Versions: 18
Compression:
Stored size: 719 Bytes
Contents
require_relative 'annotation' module SSMD::Annotations class LanguageAnnotation < Annotation attr_reader :language def self.regex /([a-z]{2}(?:-[A-Z]{2})?)/ end def initialize(language) @language = complete_language language end def wrap(text) "<lang xml:lang=\"#{language}\">#{text}</lang>" end def combine(annotation) self # discard further language annotations end def complete_language(language) if language.size == 2 language_completion_table[language] || "#{language}-#{language.upcase}" else language end end def language_completion_table { "en" => "en-US" } end end end
Version data entries
18 entries across 18 versions & 1 rubygems