From 7e49db5ddefe8c515b5f3931a5c701efaac33d91 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Fri, 16 Dec 2022 17:45:03 -0600 Subject: change structure for new pyssg version --- .../static/fork-awesome/src/doc/_plugins/sri_hash.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 live/static/fork-awesome/src/doc/_plugins/sri_hash.rb (limited to 'live/static/fork-awesome/src/doc/_plugins/sri_hash.rb') diff --git a/live/static/fork-awesome/src/doc/_plugins/sri_hash.rb b/live/static/fork-awesome/src/doc/_plugins/sri_hash.rb new file mode 100644 index 0000000..63e0242 --- /dev/null +++ b/live/static/fork-awesome/src/doc/_plugins/sri_hash.rb @@ -0,0 +1,20 @@ +## +# Generate an SRI hash for a given file + +require 'digest' + +module Jekyll + class GetSriHash < Liquid::Tag + def initialize(tag_name, text, tokens) + super + @filename = text.strip + end + + def render(context) + sha256 = Digest::SHA256.file(@filename) + "sha256-#{sha256.base64digest}" + end + end +end + +Liquid::Template.register_tag('sri_hash', Jekyll::GetSriHash) -- cgit v1.2.3-54-g00ecf