1
0
Fork 0
mirror of https://github.com/fmap/muflax65ngodyewp.onion synced 2024-06-26 10:26:48 +02:00
This commit is contained in:
muflax 2011-09-04 20:28:53 +02:00
parent ea0a0dbb16
commit e829f2d7b6
5 changed files with 73 additions and 84 deletions

View file

@ -111,15 +111,6 @@ ul {
padding-left: 1em;
}
/* colors for techne states */
span.techne_done {
color: green;
}
span.techne_rough {
color: red;
}
em {
color: #562D6F;
font-style: italic;

View file

@ -30,5 +30,3 @@ end %>
<div style='clear: both'></div>
<% end %>
<!-- <div class='category_item'> -->

View file

@ -21,80 +21,7 @@ def category name
render "category", :category => name
end
def techne status
case status
when :rough
"needs revisiting"
when :incomplete
"work in progress"
when :done
"finished"
else
status.to_s
end
end
def episteme_cat status
s = case status
when :broken
"partly believed"
when :discredited
"not believed"
else
status.to_s
end
"[#{s}][Epistemic State]{:.episteme}"
end
# only articles that actually get printed
def printed_items
@items.select { |i| not i[:is_hidden] and not i.binary? }
end
# build rss feed
def rss_feed
require "rss/maker"
version = "2.0"
# find changelog
log = @items.find{|i| i.identifier.match %r{/changelog/}}
content = RSS::Maker.make(version) do |rss|
rss.channel.title = "Lies and Wonderland"
rss.channel.link = "http://muflax.com"
rss.channel.author = "mail@muflax.com"
rss.channel.description = "Lies and Wonderland"
rss.channel.date = log.mtime
rss.items.do_sort = true # sort items by date
changes(log).each do |change|
i = rss.items.new_item
i.title = "muflax hath written unto you..."
i.link = "http://muflax.com/changelog/"
i.date = Time.parse(change[:date])
i.description = change[:description]
end
end
content
end
# return changes based on changelog
def changes log
require 'nokogiri'
changes = []
# parse log
html_log = Nokogiri::HTML(log.compiled_content)
html_log.css("ul#changelog").each do |ul|
ul.css("li").each do |li|
change = {}
change[:description] = li.children.to_s.strip
change[:date] = li.content[%r{\d{4}/\d{2}/\d{2}}]
changes << change
end
end
changes
end

26
lib/episteme.rb Normal file
View file

@ -0,0 +1,26 @@
# Helper functions for epistemic states.
def techne status
case status
when :rough
"needs revisiting"
when :incomplete
"work in progress"
when :done
"finished"
else
status.to_s
end
end
def episteme_cat status
s = case status
when :broken
"partly believed"
when :discredited
"not believed"
else
status.to_s
end
"[#{s}][Epistemic State]{:.episteme}"
end

47
lib/rss.rb Normal file
View file

@ -0,0 +1,47 @@
# build rss feed
def rss_feed
require "rss/maker"
version = "2.0"
# find changelog
log = @items.find{|i| i.identifier.match %r{/changelog/}}
content = RSS::Maker.make(version) do |rss|
rss.channel.title = "Lies and Wonderland"
rss.channel.link = "http://muflax.com"
rss.channel.author = "mail@muflax.com"
rss.channel.description = "Lies and Wonderland"
rss.channel.date = log.mtime
rss.items.do_sort = true # sort items by date
changes(log).each do |change|
i = rss.items.new_item
i.title = "muflax hath written unto you..."
i.link = "http://muflax.com/changelog/"
i.date = Time.parse(change[:date])
i.description = change[:description]
end
end
content
end
# return changes based on changelog
def changes log
require 'nokogiri'
changes = []
# parse log
html_log = Nokogiri::HTML(log.compiled_content)
html_log.css("ul#changelog").each do |ul|
ul.css("li").each do |li|
change = {}
change[:description] = li.children.to_s.strip
change[:date] = li.content[%r{\d{4}/\d{2}/\d{2}}]
changes << change
end
end
changes
end