Sha256: 5bad26584ab81a5470e02397de535617ec8fdaf5a8e33f62879163f25eaf8a8b

Contents?: true

Size: 1020 Bytes

Versions: 35

Compression:

Stored size: 1020 Bytes

Contents

# ------------------------------------------------------------------------------
# ~/_plugins/xml_prettify.rb
# Liquid filter for J1 Theme to beautify XML code
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023 Juergen Adams
#
# J1 Theme is licensed under the MIT License.
# See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md
# ------------------------------------------------------------------------------
#  NOTE:
#  CustomFilters cannot be used in SAFE mode (e.g not usable for
#  rendering pages with Jekyll on GitHub
#
#  USAGE:
#    {% capture cache_name %}
#
#      liquid code to generate XML output goes here
#
#    {% endcapture %}
#    {{ cache_name | xml_pretty_print }}
# ------------------------------------------------------------------------------
require 'nokogiri'

module Jekyll
  module XmlPrettyPrint
    def xml_pretty_print(input)
      # xml cleanup
      Nokogiri::XML(input).root.to_xml
    end
  end
end

Liquid::Template.register_filter(Jekyll::XmlPrettyPrint)

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
j1-template-2023.0.15 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.14 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.13 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.12 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.11 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.10 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.9 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.8 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.7 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.6 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.5 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.3 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.2 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.1 lib/starter_web/_plugins/filter/xml_prettify.rb
j1-template-2023.0.0 lib/starter_web/_plugins/filter/xml_prettify.rb