From 0555b2cd77986d916968f1443e375fad005c8d43 Mon Sep 17 00:00:00 2001 From: pdp8 Date: Mon, 4 Mar 2024 23:13:40 +0100 Subject: html.rb separated, Makefile for website generation --- climbing.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 climbing.rb (limited to 'climbing.rb') diff --git a/climbing.rb b/climbing.rb new file mode 100755 index 0000000..6705aba --- /dev/null +++ b/climbing.rb @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby +require_relative 'lib' + +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| + w, h = `ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 #{post[:webm]}`.chomp.split(',') + html += '
' + html += "

#{post[:date]}

" + html += "

+ " + html += post[:text] + html += '

' +end +html += '

 © pdp8 Creative Commons Attribution 4.0 International License' +html += File.read(File.join(SNIPPETS, 'tail.html')) +print_html 'climbing', html -- cgit v1.2.3