disowned warning, merged rss feed (first half)

master
muflax 2012-06-22 04:36:46 +02:00
parent 7dea46d36f
commit e12884d3af
9 changed files with 81 additions and 28 deletions

29
TODO
View File

@ -1,19 +1,20 @@
* Todo [9/18]
- [X] switch to creation dates
- [X] hide drafts in categories, but compile them anyway
- [X] better rss feed (automatic items based on dates, changelog)
- [X] better separation of categories
- [ ] "digesting history"
- [X] mind-killer warning
- [X] move to nfs.net (host mail on gmail)
- [ ] better handling of footnotes (parallel column?)
- [X] switch rake to nanoc commands
- [ ] universal RSS
* content [1/8]
- [ ] disclaimer about removed content
- [X] "merged with"
- [X] universal RSS
- [ ] portal
- [ ] rss feeds
- [ ] disown bad sites
- [ ] merge more stuff (experiments etc.)
- [ ] start gospel
- [ ] start let's read for reviews
- [ ] some portal for all sites
* layout [1/5]
- [ ] better handling of footnotes (parallel column?)
- [ ] search bar prettier
- [ ] imply all_sites without -s
- [ ] next_prev for first page float broken
- [X] tidy html in RSS feed for compression
- [X] disown site
- [ ] better merged -> moved
* technical [0/3]
- [ ] imply all_sites without -s
- [ ] fork nanoc, move site config there
- [ ] cache compilation better

43
commands/rss_merge.rb Normal file
View File

@ -0,0 +1,43 @@
usage 'rss-merge'
summary 'merge RSS feeds'
description 'Merges individual RSS feeds into one combined feed.'
module Nanoc::CLI::Commands
class RSSMerge < ::Nanoc::CLI::CommandRunner
def run
require "rss"
version = "2.0"
date = Time.new 0
items = []
# read individual feeds and include them
all_sites.each do |name|
site = load_site name
puts "including #{name}..."
feed = RSS::Parser.parse(File.open("#{site.config[:output_dir]}/rss.xml"))
date = [feed.channel.date, date].max
items.concat feed.items
end
# build merged feed
merged_feed = RSS::Maker.make(version) do |rss|
rss.channel.title = "muflax"
rss.channel.link = "http://muflax.com"
rss.channel.author = "mail@muflax.com"
rss.channel.description = "read ALL the muflax!"
end
merged_feed.items.concat items.sort_by(&:date).reverse.take(10)
# write it
File.open("out/muflax/rss-merged.xml", "w") do |f|
f.write merged_feed
end
system "nanoc compress -s muflax"
end
end
end
runner Nanoc::CLI::Commands::RSSMerge

View File

@ -124,7 +124,7 @@ end
module Nanoc::CLI
class CommandRunner
def all_sites
Dir['content_*'].map{|d| d.gsub(/^content_/, '')}.sort
YAML.load(File.open("sites.yaml"))["sites"].keys.sort
end
# lots of commands use -s now, so simplify its use

View File

@ -9,6 +9,7 @@ $episteme: #c4f3af;
$hover: #057dff;
$quote: #a6a542;
$pre: #fff8d9;
$warning: #d44836;
/* sizes */
$left-col: 45em;
@ -68,9 +69,14 @@ div#episteme {
line-height: 2em;
}
/* mindkiller warning */
div#mindkiller {
/* disowned warning */
div#disowned {
h1 {
background: $warning;
}
background: $episteme;
padding-bottom: 0.1em;
}
/* merged with another article */

9
layouts/disowned.erb Normal file
View File

@ -0,0 +1,9 @@
<% if @item.disowned? %>
<div id="disowned">
<h1>Warning</h1>
<p>This page has been disowned according to the <a href="http://blog.muflax.com/propaganda/condemnation">Condemnation of 2012</a>. The <a href="/contact/">author</a> does not endorse or deny any of the views expressed here, even when it may appear so, and will not discuss them.</p>
<p>The page is preserved for historical and game-theoretic reasons, and because the author likely put a shit-ton of work into it.</p>
</div>
<% end %>

View File

@ -1,5 +0,0 @@
<% if @item.mindkiller? %>
<div id="mindkiller">
<p><strong>Warning</strong>: this page contains mind-killing content. Proceed with caution. The <a href="/contact/">author</a> does not endorse any of the views expressed here, even when they may look convincing. If you feel offended, consider that the author might be trolling you and whether you want to encourage them even further.</p>
</div>
<% end %>

View File

@ -1,4 +1,4 @@
<%= render 'mindkiller' %>
<%= render 'disowned' %>
<%= render 'episteme' %>

View File

@ -33,9 +33,8 @@ class Nanoc::Item
!!self[:episteme]
end
def mindkiller?
topics = %w{history}
!!self[:mindkiller]
def disowned?
!!self[:disowned]
end
def merged?

View File

@ -14,5 +14,5 @@ sites:
letsread:
title: Let\'s Read
disqus_site: muflaxread
gospel:
title: Unchanging Gospel
# gospel:
# title: Unchanging Gospel