transition complete
* word count * categories in nav-bar * next / prev item * robots.txt (including sitemap) * many minor tweaksmaster
parent
a186dacd2c
commit
1b781a23f6
30
Rules
30
Rules
|
@ -61,10 +61,6 @@ compile '/feed/' do
|
||||||
filter :erb
|
filter :erb
|
||||||
end
|
end
|
||||||
|
|
||||||
compile '/htaccess/' do
|
|
||||||
filter :erb
|
|
||||||
end
|
|
||||||
|
|
||||||
compile '*' do
|
compile '*' do
|
||||||
if item.binary?
|
if item.binary?
|
||||||
# don't filter binary items
|
# don't filter binary items
|
||||||
|
@ -87,17 +83,21 @@ compile '*' do
|
||||||
filter :colorize_syntax, :default_colorizer => :pygmentize
|
filter :colorize_syntax, :default_colorizer => :pygmentize
|
||||||
when "org" # org-mode pages
|
when "org" # org-mode pages
|
||||||
filter :org
|
filter :org
|
||||||
|
when "erb" # general erb files
|
||||||
|
filter :erb
|
||||||
end
|
end
|
||||||
|
|
||||||
# layout
|
# layout
|
||||||
if @site.blog?
|
unless @item[:is_hidden]
|
||||||
layout 'blog'
|
if @site.blog?
|
||||||
else
|
layout 'blog'
|
||||||
layout 'default'
|
else
|
||||||
end
|
layout 'default'
|
||||||
|
end
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
filter :tidy
|
filter :tidy
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,6 +109,14 @@ route '/htaccess/' do
|
||||||
'/.htaccess'
|
'/.htaccess'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
route '/robots/' do
|
||||||
|
'/robots.txt'
|
||||||
|
end
|
||||||
|
|
||||||
|
route '/sitemap/' do
|
||||||
|
'/sitemap.xml'
|
||||||
|
end
|
||||||
|
|
||||||
route '/styles/*' do
|
route '/styles/*' do
|
||||||
route_with_new_extension "css"
|
route_with_new_extension "css"
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,9 +5,7 @@ description 'Opens last page in Emacs.'
|
||||||
module Nanoc::CLI::Commands
|
module Nanoc::CLI::Commands
|
||||||
class Last < ::Nanoc::CLI::CommandRunner
|
class Last < ::Nanoc::CLI::CommandRunner
|
||||||
def run
|
def run
|
||||||
page = Dir['content_daily/log/*.mkd'].map do |l|
|
page = daily_logs.last
|
||||||
[l.match(/\/(\d+).mkd$/)[1].to_i, l]
|
|
||||||
end.sort.last[1]
|
|
||||||
puts "editing: #{page}..."
|
puts "editing: #{page}..."
|
||||||
system "emacs-gui #{page}"
|
system "emacs-gui #{page}"
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,28 +7,15 @@ required :s, :sites, 'sites'
|
||||||
module Nanoc::CLI::Commands
|
module Nanoc::CLI::Commands
|
||||||
class References < ::Nanoc::CLI::CommandRunner
|
class References < ::Nanoc::CLI::CommandRunner
|
||||||
|
|
||||||
# load data from site
|
|
||||||
def load_site(site=nil)
|
|
||||||
self.require_site
|
|
||||||
@current_site = self.site
|
|
||||||
|
|
||||||
# load site-specific config
|
|
||||||
@current_site.extended_build_config('.', site) unless site.nil?
|
|
||||||
|
|
||||||
# load site data (including plugins)
|
|
||||||
@current_site.load
|
|
||||||
|
|
||||||
# find relevant items
|
|
||||||
@current_site.find_printed_items
|
|
||||||
end
|
|
||||||
|
|
||||||
# collect links in site
|
# collect links in site
|
||||||
def extract_links site=nil
|
def extract_links site=nil
|
||||||
|
current_site = load_site site
|
||||||
|
|
||||||
shared = site.nil?
|
shared = site.nil?
|
||||||
|
|
||||||
page_links = ["<!-- (auto-generated) internal links for #{shared ? "shared content" : "site: #{site}"} -->"]
|
page_links = ["<!-- (auto-generated) internal links for #{shared ? "shared content" : "site: #{site}"} -->"]
|
||||||
|
|
||||||
@current_site.printed_items.each do |i|
|
current_site.printed_items.each do |i|
|
||||||
# don't include shared content with sites
|
# don't include shared content with sites
|
||||||
unless shared
|
unless shared
|
||||||
next if i.shared?
|
next if i.shared?
|
||||||
|
@ -57,8 +44,6 @@ module Nanoc::CLI::Commands
|
||||||
puts "loading: #{site}"
|
puts "loading: #{site}"
|
||||||
end
|
end
|
||||||
|
|
||||||
load_site site
|
|
||||||
|
|
||||||
page_links = extract_links site
|
page_links = extract_links site
|
||||||
puts "#links: #{page_links.size}"
|
puts "#links: #{page_links.size}"
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ site_cmds = [
|
||||||
'watch',
|
'watch',
|
||||||
]
|
]
|
||||||
|
|
||||||
# load site-specific config
|
# site-specific config
|
||||||
module ::Nanoc
|
module ::Nanoc
|
||||||
class Site
|
class Site
|
||||||
def extended_build_config(dir_or_config_hash, site)
|
def extended_build_config(dir_or_config_hash, site)
|
||||||
|
@ -50,6 +50,56 @@ module ::Nanoc
|
||||||
end
|
end
|
||||||
|
|
||||||
@config[:watcher][:dirs_to_watch] << "content_#{site}"
|
@config[:watcher][:dirs_to_watch] << "content_#{site}"
|
||||||
|
|
||||||
|
@config[:base_url] = self.url
|
||||||
|
end
|
||||||
|
|
||||||
|
def main_site?
|
||||||
|
$site == "muflax"
|
||||||
|
end
|
||||||
|
|
||||||
|
def blog?
|
||||||
|
!main_site? # everything is a blog except for the main site
|
||||||
|
end
|
||||||
|
|
||||||
|
def disqus_site
|
||||||
|
# TODO merge them all?
|
||||||
|
# site -> disqus shortname
|
||||||
|
case $site
|
||||||
|
when "muflax"
|
||||||
|
"muflax"
|
||||||
|
when "sutra"
|
||||||
|
"muflaxsutra"
|
||||||
|
when "daily"
|
||||||
|
"dailymuflax"
|
||||||
|
when "blog"
|
||||||
|
"muflaxblog"
|
||||||
|
else # put 'em on the main site
|
||||||
|
"muflax"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def url
|
||||||
|
"http://#{main_site? ? "" : "#{$site}."}muflax.com"
|
||||||
|
end
|
||||||
|
|
||||||
|
def disqus_url item
|
||||||
|
url + item.identifier
|
||||||
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
case $site
|
||||||
|
when "muflax"
|
||||||
|
"lies and wonderland"
|
||||||
|
when "sutra"
|
||||||
|
"Blogchen"
|
||||||
|
when "daily"
|
||||||
|
"muflax becomes a saint"
|
||||||
|
when "blog"
|
||||||
|
"muflax' mindstream"
|
||||||
|
else # placeholder
|
||||||
|
"muflaxia"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,6 +142,29 @@ module Nanoc::CLI
|
||||||
def sites_arg sites
|
def sites_arg sites
|
||||||
sites.nil? ? all_sites : sites.split(",")
|
sites.nil? ? all_sites : sites.split(",")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# load data from site
|
||||||
|
def load_site site=nil
|
||||||
|
self.require_site
|
||||||
|
current_site = self.site
|
||||||
|
|
||||||
|
# load site-specific config
|
||||||
|
current_site.extended_build_config('.', site) unless site.nil?
|
||||||
|
|
||||||
|
# load site data (including plugins)
|
||||||
|
current_site.load
|
||||||
|
|
||||||
|
current_site
|
||||||
|
end
|
||||||
|
|
||||||
|
def daily_logs
|
||||||
|
dir = "content_daily/log"
|
||||||
|
pattern = /\/(\d+).mkd$/
|
||||||
|
|
||||||
|
Dir["#{dir}/*.mkd"].select{|l| l.match(pattern)}.sort_by do |l|
|
||||||
|
l.match(pattern)[1].to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
usage 'wc'
|
||||||
|
summary 'word count of logs'
|
||||||
|
description 'Prints word count of log entries for Beeminder logging.'
|
||||||
|
|
||||||
|
module Nanoc::CLI::Commands
|
||||||
|
class WordCount < ::Nanoc::CLI::CommandRunner
|
||||||
|
def run
|
||||||
|
daily_logs.each do |log|
|
||||||
|
data = File.read(log)
|
||||||
|
pieces = data.split(/^(-{5}|-{3})\s*$/)
|
||||||
|
next if pieces.size < 4
|
||||||
|
|
||||||
|
content = pieces[4..-1].join.strip
|
||||||
|
words = content.scan(/( \[.+?\]\[.*?\][[:punct:]]* | <%=?.+?%> | \S+ )/x)
|
||||||
|
|
||||||
|
puts "#{log} -> #{words.size}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
runner Nanoc::CLI::Commands::WordCount
|
|
@ -1,13 +1,11 @@
|
||||||
---
|
---
|
||||||
title: All Posts
|
title: All Posts By Category
|
||||||
non_cognitive: true
|
non_cognitive: true
|
||||||
no_comments: true
|
no_comments: true
|
||||||
---
|
---
|
||||||
|
|
||||||
All posts from the [blog][].
|
All posts by category.
|
||||||
|
|
||||||
<% @site.categories(false).each do |cat| %>
|
<% @site.categories(false).each do |cat| %>
|
||||||
<%= category cat %>
|
<%= category cat %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
title: All Posts By Date
|
||||||
|
non_cognitive: true
|
||||||
|
no_comments: true
|
||||||
|
---
|
||||||
|
|
||||||
|
All posts by date.
|
||||||
|
|
||||||
|
<% @site.items_by_date.reverse.each do |item| %>
|
||||||
|
<%= render 'list-item', :item => item %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
is_hidden: true
|
||||||
|
non_cognitive: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# stay in the box, clippy
|
||||||
|
User-agent: ufai
|
||||||
|
Disallow: /release
|
||||||
|
|
||||||
|
# crawlers
|
||||||
|
User-agent: *
|
||||||
|
Disallow: /pigs/
|
||||||
|
Disallow: /stuff/
|
||||||
|
Sitemap: <%= @site.url %>/sitemap.xml
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
is_hidden: true
|
||||||
|
non_cognitive: true
|
||||||
|
---
|
||||||
|
|
||||||
|
<%= xml_sitemap :items => @site.printed_items %>
|
|
@ -42,16 +42,14 @@ div#main {
|
||||||
margin-bottom: 3em;
|
margin-bottom: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#title {
|
h1.title {
|
||||||
h1 {
|
background: $crumb-bg;
|
||||||
background: $crumb-bg;
|
color: $crumb-fg;
|
||||||
color: $crumb-fg;
|
line-height: 1.3em;
|
||||||
line-height: 1.3em;
|
font-size: 1.7em;
|
||||||
font-size: 1.7em;
|
font-weight: normal;
|
||||||
font-weight: normal;
|
margin-top: 0;
|
||||||
margin-top: 0;
|
text-align: center;
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a:link.title, a:hover.title, a:visited.title, a:active.title {
|
a:link.title, a:hover.title, a:visited.title, a:active.title {
|
||||||
|
@ -84,6 +82,13 @@ div#nav {
|
||||||
float: left;
|
float: left;
|
||||||
width: $right-col - $margin;
|
width: $right-col - $margin;
|
||||||
margin-left: $margin;
|
margin-left: $margin;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
h2, h3, h4, h5, h6 {
|
||||||
|
font-weight: normal;
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* toc */
|
/* toc */
|
||||||
|
@ -96,7 +101,10 @@ div#toc {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
text-align: left;
|
}
|
||||||
|
|
||||||
|
div#cat-nav {
|
||||||
|
line-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#crumb {
|
div#crumb {
|
||||||
|
@ -117,9 +125,8 @@ div#crumb {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.nextprev {
|
div#next_prev {
|
||||||
border-top: 10px solid $h1;
|
border-top: 10px solid $h1;
|
||||||
text-align: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
div.footnotes {
|
div.footnotes {
|
||||||
|
@ -234,7 +241,7 @@ div.figure {
|
||||||
h1 {
|
h1 {
|
||||||
background: $h2;
|
background: $h2;
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 1.7em;
|
font-size: 1.5em;
|
||||||
line-height: 1.3;
|
line-height: 1.3;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ alt_titles: [about dlog]
|
||||||
date: 2012-04-12
|
date: 2012-04-12
|
||||||
techne: :done
|
techne: :done
|
||||||
episteme: :believed
|
episteme: :believed
|
||||||
|
non_cognitive: true
|
||||||
---
|
---
|
||||||
|
|
||||||
I like talking about ideas. I like logging stuff. Writing this blog has vastly increased my thinking output. (Which is good, and unexpected.) I see people use daily logs of what they did and these people kick my ass when it comes to achievements, even though for each individual day, they don't do more than I can. It's just the pure, raw consistency. They still do the same shit 6 months from now and by then, they utterly outperform me.
|
I like talking about ideas. I like logging stuff. Writing this blog has vastly increased my thinking output. (Which is good, and unexpected.) I see people use daily logs of what they did and these people kick my ass when it comes to achievements, even though for each individual day, they don't do more than I can. It's just the pure, raw consistency. They still do the same shit 6 months from now and by then, they utterly outperform me.
|
||||||
|
|
|
@ -7,7 +7,7 @@ no_comments: true
|
||||||
|
|
||||||
Because death doesn't conquer itself, you know.
|
Because death doesn't conquer itself, you know.
|
||||||
|
|
||||||
([More details what this is about.][about] See the [main site][main] or [blog][] for real content. There's also an [RSS feed][RSS].)
|
[More details what this is about.][about] See the [main site][main] or [blog][] for real content. There's also an [RSS feed][RSS].
|
||||||
|
|
||||||
Latest entry:
|
Latest entry:
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ title: FAQ
|
||||||
date: 2012-04-15
|
date: 2012-04-15
|
||||||
techne: :done
|
techne: :done
|
||||||
episteme: :believed
|
episteme: :believed
|
||||||
|
non_cognitive: true
|
||||||
---
|
---
|
||||||
|
|
||||||
- Q: What's the tl;dr?
|
- Q: What's the tl;dr?
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<div id="allposts">
|
||||||
|
<a href=''>all posts by category</a>
|
||||||
|
<a href=''>all posts by date</a>
|
||||||
|
</div>
|
|
@ -3,6 +3,7 @@
|
||||||
<% render 'main',
|
<% render 'main',
|
||||||
:navbar => true,
|
:navbar => true,
|
||||||
:search => true,
|
:search => true,
|
||||||
|
:categories => true,
|
||||||
:breadcrumbs => true do %>
|
:breadcrumbs => true do %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,3 +1,23 @@
|
||||||
<div id="cat-nav">
|
<div id="cat-nav">
|
||||||
<%= @item.toc %>
|
<h2>Categories</h2>
|
||||||
|
<ul>
|
||||||
|
<% @site.categories.each do |cat| %>
|
||||||
|
<li><%= cat.link true %></li>
|
||||||
|
|
||||||
|
<% if @item.category == cat %>
|
||||||
|
<ul>
|
||||||
|
<% @item.category.members.each do |i| %>
|
||||||
|
<%= render 'list-item', :item => i, :episteme => false %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>All Posts</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href='/categories/'>All Posts By Category</a></li>
|
||||||
|
<li><a href='/date/'>All Posts By Date</a></li>
|
||||||
|
<li><a href='/rss.xml'>RSS feed</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,24 +1,14 @@
|
||||||
<!-- print all items in a category, nicely formatted -->
|
<!-- print all items in a category, nicely formatted -->
|
||||||
|
|
||||||
<!-- find category index -->
|
<!-- find category index -->
|
||||||
|
|
||||||
<% cat = @site.category @category %>
|
<% cat = @site.category @category %>
|
||||||
|
|
||||||
<!-- header -->
|
<!-- header -->
|
||||||
|
<h1><%= cat.link %></h1>
|
||||||
# [<%= cat.item[:title] %>][]
|
|
||||||
|
|
||||||
<!-- print items in nice list -->
|
<!-- print items in nice list -->
|
||||||
|
<ul class="table">
|
||||||
<% cat.members.sort_by{|i| i[:date]}.reverse.each do |i|
|
<% cat.members.sort_by{|i| i[:date]}.reverse.each do |i| %>
|
||||||
techne = "<span class='techne_#{i[:techne]}'>#{i[:date]}</span>"
|
<%= render 'list-item', :item => i, :episteme => true %>
|
||||||
status = "(#{episteme_cat i[:episteme]}) (#{techne})"
|
<% end %>
|
||||||
%>
|
</ul>
|
||||||
|
|
||||||
{:.table}
|
|
||||||
- <span class='align_left'>[<%= i[:title]%>][]</span>
|
|
||||||
<span class='align_right'><%= status %></span>
|
|
||||||
|
|
||||||
<div style='clear: both'></div>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<%= render 'next-prev', :item => @item %>
|
<%= render 'next-prev', :item => @item %>
|
||||||
|
|
||||||
<%= render 'comments' %>
|
<%= render 'comments', :item => @item %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
<% if @item.epistemic? %>
|
<% if @item.epistemic? %>
|
||||||
<div id="episteme">
|
<div id="episteme">
|
||||||
<p><span class="align_left">
|
<p><span class="align_left">
|
||||||
Last modified: <%= @item[:date] %> (<%= techne @item[:techne] %>).
|
Last modified: <%= @item[:date] %> (<%= techne_title @item[:techne] %>).
|
||||||
</span>
|
</span>
|
||||||
<span class="align_right">
|
<span class="align_right">
|
||||||
Epistemic state:
|
Epistemic state:
|
||||||
<a class='episteme' href='/episteme/'>
|
<a class='episteme' href='/episteme/'>
|
||||||
<%= episteme @item[:episteme] %></a>.
|
<%= episteme_title @item[:episteme] %></a>.
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<li>
|
||||||
|
<span class='align_left'>
|
||||||
|
<a href="<%= @item.identifier %>">
|
||||||
|
<%= @item[:title]%>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<% if @episteme %>
|
||||||
|
<span class='align_right'>
|
||||||
|
<%= "(#{episteme_cat @item[:episteme]}) (<span class='techne_#{@item[:techne]}'>#{@item[:date]}</span>)" %>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div style='clear: both'></div>
|
||||||
|
</li>
|
|
@ -23,6 +23,8 @@
|
||||||
<!-- navigation sidebar -->
|
<!-- navigation sidebar -->
|
||||||
<div id="nav">
|
<div id="nav">
|
||||||
|
|
||||||
|
<h1 class="title">Navigation</h1>
|
||||||
|
|
||||||
<% if @search %>
|
<% if @search %>
|
||||||
<%= google_search %>
|
<%= google_search %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -32,7 +34,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @categories %>
|
<% if @categories %>
|
||||||
<%= render 'cat-nav' %>
|
<%= render 'cat-nav', :item => @item %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,26 @@
|
||||||
<div id="next-prev">
|
<% if @item.article? %>
|
||||||
<p><span class="align_left">
|
<div id="next_prev">
|
||||||
<a class='nextprev' href='<%= @item.path %>'>
|
<p>
|
||||||
‹ <%= @item[:title] %>
|
<% items = @site.items_by_date @category
|
||||||
</a>
|
index = items.index(@item)
|
||||||
</span>
|
next_item = items[index + 1]
|
||||||
<span class="align_right">
|
prev_item = index > 0 ? items[index - 1] : nil %>
|
||||||
<a class='nextprev' href='<%= @item.path %>'>
|
|
||||||
<%= @item[:title] %> ›
|
<% unless prev_item.nil? %>
|
||||||
</a>
|
<span class="align_left">
|
||||||
</span>
|
<a class='next_prev' href='<%= prev_item.path %>'>
|
||||||
</p>
|
‹ <%= prev_item[:title] %>
|
||||||
</div>
|
</a>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% unless next_item.nil? %>
|
||||||
|
<span class="align_right">
|
||||||
|
<a class='next_prev' href='<%= next_item.path %>'>
|
||||||
|
<%= next_item[:title] %> ›
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
# Helper functions for site-building.
|
# Helper functions for site-building.
|
||||||
|
|
||||||
include Nanoc::Helpers::Rendering
|
include Nanoc::Helpers::Rendering
|
||||||
|
include Nanoc::Helpers::XMLSitemap
|
||||||
|
|
||||||
class Nanoc::Item
|
class Nanoc::Item
|
||||||
|
attr_accessor :category
|
||||||
|
|
||||||
def add_content content
|
def add_content content
|
||||||
@raw_content += "\n\n#{content}"
|
@raw_content += "\n\n#{content}"
|
||||||
end
|
end
|
||||||
|
@ -32,7 +35,7 @@ class Nanoc::Item
|
||||||
not self[:is_category] and not draft? and cognitive?
|
not self[:is_category] and not draft? and cognitive?
|
||||||
end
|
end
|
||||||
|
|
||||||
def category
|
def category_slug
|
||||||
if m = self.identifier.match(%r{^\/(?<cat>.+?)/})
|
if m = self.identifier.match(%r{^\/(?<cat>.+?)/})
|
||||||
m[:cat]
|
m[:cat]
|
||||||
else
|
else
|
||||||
|
@ -46,8 +49,10 @@ class Category
|
||||||
|
|
||||||
def initialize item, members=[]
|
def initialize item, members=[]
|
||||||
@item = item
|
@item = item
|
||||||
@slug = item.category
|
@slug = @item.category_slug
|
||||||
@members = members
|
@members = members
|
||||||
|
|
||||||
|
@members.each {|i| i.category = self}
|
||||||
end
|
end
|
||||||
|
|
||||||
def includes? item
|
def includes? item
|
||||||
|
@ -61,6 +66,17 @@ class Category
|
||||||
@members.reject{|i| i.draft?}
|
@members.reject{|i| i.draft?}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
@item[:title]
|
||||||
|
end
|
||||||
|
|
||||||
|
def link count=false
|
||||||
|
desc = title
|
||||||
|
desc += " (#{@members.size})" if count
|
||||||
|
|
||||||
|
"<a href='#{@item.identifier}'>#{desc}</a>"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Nanoc::Site
|
class Nanoc::Site
|
||||||
|
@ -97,7 +113,7 @@ class Nanoc::Site
|
||||||
def find_categories
|
def find_categories
|
||||||
# find categories
|
# find categories
|
||||||
cats = @printed_items.select {|i| i[:is_category]}.map do |c|
|
cats = @printed_items.select {|i| i[:is_category]}.map do |c|
|
||||||
members = @printed_items.select{|i| not i[:is_category] and i.category == c.category}
|
members = @printed_items.select{|i| not i[:is_category] and i.category_slug == c.category_slug}
|
||||||
Category.new(c, members)
|
Category.new(c, members)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -110,7 +126,7 @@ class Nanoc::Site
|
||||||
end
|
end
|
||||||
|
|
||||||
# sort by title
|
# sort by title
|
||||||
@categories = cats.sort_by {|c| c[:cat].item[:title]}
|
@categories = cats.sort_by {|c| c[:cat].title}
|
||||||
end
|
end
|
||||||
|
|
||||||
def categories all=true
|
def categories all=true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Helper functions for epistemic states.
|
# Helper functions for epistemic states.
|
||||||
|
|
||||||
def techne status
|
def techne_title status
|
||||||
case status
|
case status
|
||||||
when :rough
|
when :rough
|
||||||
"needs revisiting"
|
"needs revisiting"
|
||||||
|
@ -13,7 +13,7 @@ def techne status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def episteme status
|
def episteme_title status
|
||||||
case status
|
case status
|
||||||
when :broken
|
when :broken
|
||||||
"semi-believed"
|
"semi-believed"
|
||||||
|
@ -25,7 +25,7 @@ def episteme status
|
||||||
end
|
end
|
||||||
|
|
||||||
def episteme_cat status
|
def episteme_cat status
|
||||||
"[#{episteme status}][Epistemic State]{:.episteme}"
|
"<a class='episteme' href='/episteme/'>#{episteme_title status}</a>"
|
||||||
end
|
end
|
||||||
|
|
||||||
class Nanoc::Item
|
class Nanoc::Item
|
||||||
|
|
52
lib/sites.rb
52
lib/sites.rb
|
@ -1,52 +0,0 @@
|
||||||
module Nanoc
|
|
||||||
class Site
|
|
||||||
def main_site?
|
|
||||||
$site == "muflax"
|
|
||||||
end
|
|
||||||
|
|
||||||
def blog?
|
|
||||||
!main_site? # everything is a blog except for the main site
|
|
||||||
end
|
|
||||||
|
|
||||||
def disqus_site
|
|
||||||
# TODO merge them all?
|
|
||||||
# site -> disqus shortname
|
|
||||||
case $site
|
|
||||||
when "muflax"
|
|
||||||
"muflax"
|
|
||||||
when "sutra"
|
|
||||||
"muflaxsutra"
|
|
||||||
when "daily"
|
|
||||||
"dailymuflax"
|
|
||||||
when "blog"
|
|
||||||
"muflaxblog"
|
|
||||||
else # put 'em on the main site
|
|
||||||
"muflax"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def url
|
|
||||||
"http://#{main_site? ? "" : "#{$site}."}muflax.com"
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def disqus_url item
|
|
||||||
url + item.identifier
|
|
||||||
end
|
|
||||||
|
|
||||||
def title
|
|
||||||
case $site
|
|
||||||
when "muflax"
|
|
||||||
"lies and wonderland"
|
|
||||||
when "sutra"
|
|
||||||
"Blogchen"
|
|
||||||
when "daily"
|
|
||||||
"muflax becomes a saint"
|
|
||||||
when "blog"
|
|
||||||
"muflax' mindstream"
|
|
||||||
else # placeholder
|
|
||||||
"muflaxia"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -11,7 +11,7 @@ class Nanoc::Item
|
||||||
max_levels = 3
|
max_levels = 3
|
||||||
|
|
||||||
# begin toc
|
# begin toc
|
||||||
res = '<h1>Content</h1>'
|
res = '<h2>Content</h2>'
|
||||||
|
|
||||||
# iterate through the body, find headers and build toc as we go along
|
# iterate through the body, find headers and build toc as we go along
|
||||||
level = 0
|
level = 0
|
||||||
|
|
Loading…
Reference in New Issue