From cd53a2fe5fc8baf9750fbd2d9b0b4c855d8694a7 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Mon, 29 Jul 2024 14:21:31 +0200 Subject: rss sorting fixed, rss limited to 25 items, fediring --- climbing.rb | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'climbing.rb') diff --git a/climbing.rb b/climbing.rb index 139925d..c016bfa 100755 --- a/climbing.rb +++ b/climbing.rb @@ -1,25 +1,23 @@ #!/usr/bin/env ruby require_relative 'lib' +climbing = Dir[File.join(MEDIA_DIR, 'climbing', '*')].select { |f| File.directory? f }.sort.reverse html = File.read(File.join(SNIPPETS, 'head.html')) html += nav 'climbing' -Dir[File.join(MEDIA_DIR, 'climbing', '*.txt')].collect do |txt| - lines = File.read(txt).lines.collect { |l| l.chomp } - { date: lines.shift, - text: lines.join('
'), - mp4: txt.sub(MEDIA_DIR, MEDIA_URL).sub('.txt', '.mp4'), - webm: txt.sub(MEDIA_DIR, MEDIA_URL).sub('.txt', '.webm'), - webp: txt.sub(MEDIA_DIR, MEDIA_URL).sub('.txt', '.webp') } -end.sort_by { |m| m[:date] }.reverse.each do |post| - html += '
' - html += "

#{post[:date]}

" - html += "