Sha256: 37432479a813536f168cf848e7dcbdac9c7bf640cf2efaf361e4db233a0c5bd2
Contents?: true
Size: 581 Bytes
Versions: 34
Compression:
Stored size: 581 Bytes
Contents
# frozen_string_literal: true module Cocina module Models module Mapping # Escaps HTML entities as CDATA for MODS since HTML is not permitted in MODS class EscapeHtml # @param [String] data # @param [Nokogiri::XML::Builder] def self.with_cdata(data, builder) tokens = data.split(%r{(</?(?:i|cite)>)}) tokens.map do |token| if /\A<.+>\z/.match? token builder.cdata(token) else builder.text(token) end end end end end end end
Version data entries
34 entries across 34 versions & 1 rubygems