diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-24 21:53:46 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-24 21:53:46 +0100 |
commit | 639fece16245dac8c24277cc1ce2f1321f683920 (patch) | |
tree | e51960ee0aec339051fda39e72b4ef7693aaf6f0 /_plugins/authors.rb | |
parent | 126fa877f904a894e43c423fe19427e9221e36d1 (diff) |
clean up ruby code
Diffstat (limited to '_plugins/authors.rb')
-rw-r--r-- | _plugins/authors.rb | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/_plugins/authors.rb b/_plugins/authors.rb deleted file mode 100644 index a2e0a53..0000000 --- a/_plugins/authors.rb +++ /dev/null @@ -1,38 +0,0 @@ -require 'set' - -module Jekyll - class FormatAuthors < Liquid::Tag - def initialize(tag_name, input, tokens) - super - @args = input.split(" ").map { |arg| arg.strip() } - end - - def transform_authors(author_meta, git_authors) - authors = Set[] - for substitute in author_meta do - for name in substitute['git'] do - if git_authors.include?(name) - authors.add(substitute['name']) - end - end - end - return authors.to_a() - end - - def join_names(authors) - return "nobody?" if authors.length == 0 - return "#{authors[0]}" if authors.length == 1 - return "#{authors[0..-2].join(", ")} and #{authors[-1]}" - end - - def render(context) - author_meta = context[@args[0]] - git_authors = context[@args[1]] - authors = transform_authors(author_meta, git_authors) - return join_names(authors) - end - end -end - -Liquid::Template.register_tag('fmt_authors', Jekyll::FormatAuthors) - |