Sha256: fea150f9bfa3d540dba2b71b5ccc28710db48cd1ee47649cab4d488541d61d93

Contents?: true

Size: 1.07 KB

Versions: 10

Compression:

Stored size: 1.07 KB

Contents

module Evertils
  module Common
    class ENMLElement
      #
      # @since 0.3.3
      def initialize(colour)
        @colour = colour
        @enml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
        @enml += "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">"
      end

      #
      # @since 0.3.3
      def body=(content)
        # at some point between 10/30/2017 and 11/06/2017, adding bgcolor to
        # the root element started throwing EDAM code 11
        # (Content is not allowed in prolog).  Commenting out for now.
        # @enml += "<en-note bgcolor=\"##{@colour.to_s(16)}\">#{content}</en-note>"
        @enml += "<en-note>#{content}</en-note>"
      end

      #
      # @since 0.3.3
      def to_s
        @enml.to_s.encode(Encoding::UTF_8)
      end

      # Required as part of the thrift data conversion
      # @since 0.3.3
      def encoding
        Encoding::UTF_8
      end

      # Required as part of the thrift data conversion
      # @since 0.3.3
      def force_encoding(enc)
        @enml.to_s.encode(enc)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
evertils-common-0.3.18 lib/evertils/common/enmlelement.rb
evertils-common-0.3.17 lib/evertils/common/enmlelement.rb
evertils-common-0.3.16 lib/evertils/common/enmlelement.rb
evertils-common-0.3.15 lib/evertils/common/enmlelement.rb
evertils-common-0.3.14 lib/evertils/common/enmlelement.rb
evertils-common-0.3.13 lib/evertils/common/enmlelement.rb
evertils-common-0.3.12 lib/evertils/common/enmlelement.rb
evertils-common-0.3.11 lib/evertils/common/enmlelement.rb
evertils-common-0.3.10 lib/evertils/common/enmlelement.rb
evertils-common-0.3.9 lib/evertils/common/enmlelement.rb