diff --git a/Rules b/Rules index 3bb6fe9..cc8f1af 100644 --- a/Rules +++ b/Rules @@ -61,10 +61,6 @@ compile '/feed/' do filter :erb end -compile '/htaccess/' do - filter :erb -end - compile '*' do if item.binary? # don't filter binary items @@ -87,17 +83,21 @@ compile '*' do filter :colorize_syntax, :default_colorizer => :pygmentize when "org" # org-mode pages filter :org + when "erb" # general erb files + filter :erb end # layout - if @site.blog? - layout 'blog' - else - layout 'default' - end + unless @item[:is_hidden] + if @site.blog? + layout 'blog' + else + layout 'default' + end - # clean up - filter :tidy + # clean up + filter :tidy + end end end @@ -109,6 +109,14 @@ route '/htaccess/' do '/.htaccess' end +route '/robots/' do + '/robots.txt' +end + +route '/sitemap/' do + '/sitemap.xml' +end + route '/styles/*' do route_with_new_extension "css" end diff --git a/commands/last.rb b/commands/last.rb index b59a66d..fa9293e 100644 --- a/commands/last.rb +++ b/commands/last.rb @@ -5,9 +5,7 @@ description 'Opens last page in Emacs.' module Nanoc::CLI::Commands class Last < ::Nanoc::CLI::CommandRunner def run - page = Dir['content_daily/log/*.mkd'].map do |l| - [l.match(/\/(\d+).mkd$/)[1].to_i, l] - end.sort.last[1] + page = daily_logs.last puts "editing: #{page}..." system "emacs-gui #{page}" end diff --git a/commands/references.rb b/commands/references.rb index bc8f106..71f12e7 100644 --- a/commands/references.rb +++ b/commands/references.rb @@ -7,28 +7,15 @@ required :s, :sites, 'sites' module Nanoc::CLI::Commands 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 def extract_links site=nil + current_site = load_site site + shared = site.nil? page_links = [""] - @current_site.printed_items.each do |i| + current_site.printed_items.each do |i| # don't include shared content with sites unless shared next if i.shared? @@ -57,8 +44,6 @@ module Nanoc::CLI::Commands puts "loading: #{site}" end - load_site site - page_links = extract_links site puts "#links: #{page_links.size}" diff --git a/commands/sites.rb b/commands/sites.rb index 70e6e59..58fecfa 100644 --- a/commands/sites.rb +++ b/commands/sites.rb @@ -12,7 +12,7 @@ site_cmds = [ 'watch', ] -# load site-specific config +# site-specific config module ::Nanoc class Site def extended_build_config(dir_or_config_hash, site) @@ -50,6 +50,56 @@ module ::Nanoc end @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 @@ -92,6 +142,29 @@ module Nanoc::CLI def sites_arg sites sites.nil? ? all_sites : sites.split(",") 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 diff --git a/commands/wc.rb b/commands/wc.rb new file mode 100644 index 0000000..46cf972 --- /dev/null +++ b/commands/wc.rb @@ -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 diff --git a/content_blog/all.mkd b/content/categories.mkd similarity index 70% rename from content_blog/all.mkd rename to content/categories.mkd index 83c0c83..b19c3d2 100644 --- a/content_blog/all.mkd +++ b/content/categories.mkd @@ -1,13 +1,11 @@ --- -title: All Posts +title: All Posts By Category non_cognitive: true no_comments: true --- -All posts from the [blog][]. +All posts by category. <% @site.categories(false).each do |cat| %> <%= category cat %> <% end %> - - diff --git a/content/date.mkd b/content/date.mkd new file mode 100644 index 0000000..c39a2a7 --- /dev/null +++ b/content/date.mkd @@ -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 %> diff --git a/content/robots.erb b/content/robots.erb new file mode 100644 index 0000000..13b3581 --- /dev/null +++ b/content/robots.erb @@ -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 diff --git a/content/sitemap.erb b/content/sitemap.erb new file mode 100644 index 0000000..213f692 --- /dev/null +++ b/content/sitemap.erb @@ -0,0 +1,6 @@ +--- +is_hidden: true +non_cognitive: true +--- + +<%= xml_sitemap :items => @site.printed_items %> diff --git a/content/styles/default.scss b/content/styles/default.scss index f2d4850..5e3359d 100644 --- a/content/styles/default.scss +++ b/content/styles/default.scss @@ -42,16 +42,14 @@ div#main { margin-bottom: 3em; } -div#title { - h1 { - background: $crumb-bg; - color: $crumb-fg; - line-height: 1.3em; - font-size: 1.7em; - font-weight: normal; - margin-top: 0; - text-align: center; - } +h1.title { + background: $crumb-bg; + color: $crumb-fg; + line-height: 1.3em; + font-size: 1.7em; + font-weight: normal; + margin-top: 0; + text-align: center; } a:link.title, a:hover.title, a:visited.title, a:active.title { @@ -84,6 +82,13 @@ div#nav { float: left; width: $right-col - $margin; margin-left: $margin; + text-align: left; + + h2, h3, h4, h5, h6 { + font-weight: normal; + margin-left: 0; + margin-right: 0; + } } /* toc */ @@ -96,7 +101,10 @@ div#toc { font-weight: normal; margin-top: 0; } - text-align: left; +} + +div#cat-nav { + line-height: 1.5em; } div#crumb { @@ -117,9 +125,8 @@ div#crumb { margin: 0 auto; } -div.nextprev { +div#next_prev { border-top: 10px solid $h1; - text-align: center; } div.footnotes { @@ -234,7 +241,7 @@ div.figure { h1 { background: $h2; color: #000; - font-size: 1.7em; + font-size: 1.5em; line-height: 1.3; text-align: center; diff --git a/content_daily/about.mkd b/content_daily/about.mkd index cf1193d..68eaf23 100644 --- a/content_daily/about.mkd +++ b/content_daily/about.mkd @@ -4,6 +4,7 @@ alt_titles: [about dlog] date: 2012-04-12 techne: :done 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. diff --git a/content_daily/index.mkd b/content_daily/index.mkd index 907fb52..460a687 100644 --- a/content_daily/index.mkd +++ b/content_daily/index.mkd @@ -7,7 +7,7 @@ no_comments: true 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: diff --git a/content_sutra/faq.mkd b/content_sutra/faq.mkd index 230650c..a4d488d 100644 --- a/content_sutra/faq.mkd +++ b/content_sutra/faq.mkd @@ -3,6 +3,7 @@ title: FAQ date: 2012-04-15 techne: :done episteme: :believed +non_cognitive: true --- - Q: What's the tl;dr? diff --git a/layouts/all-posts.erb b/layouts/all-posts.erb new file mode 100644 index 0000000..6dde1ad --- /dev/null +++ b/layouts/all-posts.erb @@ -0,0 +1,4 @@ +
diff --git a/layouts/blog.erb b/layouts/blog.erb index 74ae139..84e884d 100644 --- a/layouts/blog.erb +++ b/layouts/blog.erb @@ -3,6 +3,7 @@ <% render 'main', :navbar => true, :search => true, + :categories => true, :breadcrumbs => true do %> <%= yield %> <% end %> diff --git a/layouts/cat-nav.erb b/layouts/cat-nav.erb index eef242f..721db80 100644 --- a/layouts/cat-nav.erb +++ b/layouts/cat-nav.erb @@ -1,3 +1,23 @@ diff --git a/layouts/category.erb b/layouts/category.erb index 90ff82e..c416368 100644 --- a/layouts/category.erb +++ b/layouts/category.erb @@ -1,24 +1,14 @@ - <% cat = @site.category @category %> - -# [<%= cat.item[:title] %>][] +- Last modified: <%= @item[:date] %> (<%= techne @item[:techne] %>). + Last modified: <%= @item[:date] %> (<%= techne_title @item[:techne] %>). Epistemic state: - <%= episteme @item[:episteme] %>. + <%= episteme_title @item[:episteme] %>.
- - ‹ <%= @item[:title] %> - - - - - <%= @item[:title] %> › - - -
-+ <% items = @site.items_by_date @category + index = items.index(@item) + next_item = items[index + 1] + prev_item = index > 0 ? items[index - 1] : nil %> + + <% unless prev_item.nil? %> + + + ‹ <%= prev_item[:title] %> + + + <% end %> + + <% unless next_item.nil? %> + + + <%= next_item[:title] %> › + + + <% end %> +
+