Sha256: 89a8d3bb5e714d5727d7bb2993cc978c2700d5dba9ac855c97f7731a97e83f5a
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require "relaton_bib/localized_string" module RelatonBib # Formatted string class FormattedString < LocalizedString FORMATS = %w[text/plain text/html application/docbook+xml application/tei+xml text/x-asciidoc text/markdown application/x-isodoc+xml].freeze # @return [String] attr_reader :format # @param content [String] # @param language [String] language code Iso639 # @param script [String] script code Iso15924 # @param format [String] the content type def initialize(content:, language: nil, script: nil, format: "text/plain") # if format && !FORMATS.include?(format) # raise ArgumentError, %{Format "#{format}" is invalid.} # end super(content, language, script) @format = format end # @param builder [Nokogiri::XML::Builder] def to_xml(builder) builder.parent["format"] = format if format super end # @return [Hash] def to_hash hash = super hash[:format] = format if format hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relaton-bib-0.3.4 | lib/relaton_bib/formatted_string.rb |