Add bin and edit workflow
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s

This commit is contained in:
2026-09-16 13:11:16 -06:00
parent c8ac4fcae5
commit 4cee170d66
17576 changed files with 895740 additions and 2 deletions
@@ -0,0 +1,36 @@
require 'jekyll_plugin_support'
require_relative 'jekyll_download_link/version'
module JekyllPluginDownloadLinkName
PLUGIN_NAME = 'download_link'.freeze
end
# Generates an href to a file for the user to download from the site.
# Also shows the file size in a human-readable format.
class DownloadLink < JekyllSupport::JekyllTagNoArgParsing
include JekyllDownloadLinkVersion
def self.as_size(string)
units = %w[B KB MB GB TB]
size, unit = units.reduce(string.to_f) do |(fsize, _), utype|
fsize > 512 ? [fsize / 1024, utype] : (break [fsize, utype])
end
fmt_str = "#{size > 9 || size.modulo(1) < 0.1 ? '%d' : '%.1f'} %s"
format(fmt_str, size, unit)
end
def render_impl
@filename = @argument_string.delete('"').delete("'").strip
source = @config['source']
file_fq = File.join(source, @filename)
abort "Error: '#{file_fq}' not found. See the link tag in" unless File.exist?(file_fq)
size_str = self.class.as_size(File.size(file_fq))
"<a href='/#{@filename}'><code>#{@filename}</code></a> (#{size_str})"
end
JekyllSupport::JekyllPluginHelper.register(self, JekyllPluginDownloadLinkName::PLUGIN_NAME)
end