42 lines
1.5 KiB
Ruby
42 lines
1.5 KiB
Ruby
#!/usr/bin/env ruby
|
|
|
|
require 'shellwords'
|
|
|
|
# https://stackoverflow.com/a/1732454
|
|
def strip_tags(text)
|
|
text.gsub(/<\/?[^>]*>/, '').strip
|
|
end
|
|
|
|
ITEMS=<<~EOI
|
|
<li>22 May 2025 · Answered the <a href="quiz.html">Rubenerd Blog Quiz 2025</a></li>
|
|
<li>25 Apr 2025 · Renamed the site from Wes' Nonsense Website to Wes' Retro Site.</li>
|
|
<li>24 Apr 2025 · Thanks to <a href="https://noelle.dev/">Noelle Leigh</a>
|
|
for contributing <a href="https://forge.wezm.net/wezm/home.wezm.net/pulls/1">a patch</a>
|
|
to reduce reflow by adding dimensions to all the images.</li>
|
|
<li>21 Apr 2025 · Published <a href="https://www.wezm.net/v2/posts/2025/website-fit-for-1999/">a post about building this site</a>.</li>
|
|
<li>20 Apr 2025 · Added Sunshine Coast page and site map.</li>
|
|
<li>19 Apr 2025 · Added live energy stats.</li>
|
|
<li>16 Apr 2025 · Added pineapple growing page.</li>
|
|
EOI
|
|
|
|
ITEMS.strip.split("</li>").each do |li|
|
|
li.sub!(/^<li>/, '')
|
|
date, description = li.split(' · ')
|
|
date = "#{date.strip} 09:00:00"
|
|
description.strip!
|
|
|
|
uuid = `uuidgen --time`.strip
|
|
pub_date = `date -j -R -f "%d %b %Y %H:%M:%S" #{date.shellescape}`.strip
|
|
title = strip_tags(description).sub(/\.$/, '')
|
|
|
|
puts <<~ITEM
|
|
<item>
|
|
<guid isPermaLink="false">#{uuid}</guid>
|
|
<pubDate>#{pub_date}</pubDate>
|
|
<link>http://home.wezm.net/~wmoore/##{uuid}</link>
|
|
<title>#{title}</title>
|
|
<description><![CDATA[#{description}]]></description>
|
|
</item>
|
|
ITEM
|
|
end
|
|
|