commit de61869f8e3937b945e7fee440eaab0f156cccd6 Author: Ariejan de Vroom Date: Fri Mar 22 22:03:45 2013 +0100 Initial nanoc site diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1dfd4b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/.sass-cache +*.log +/output +/tmp \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ffb1b27 --- /dev/null +++ b/Gemfile @@ -0,0 +1,9 @@ +source 'https://rubygems.org' + +gem 'nanoc' +gem 'adsf' +gem 'kramdown' +gem 'sass' +gem 'haml' +gem 'coffee-script' +gem 'typogruby' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..47dc75b --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,38 @@ +GEM + remote: https://rubygems.org/ + specs: + adsf (1.1.1) + rack (>= 1.0.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.6.2) + colored (1.2) + cri (2.3.0) + colored (>= 1.2) + execjs (1.4.0) + multi_json (~> 1.0) + haml (4.0.1) + tilt + kramdown (0.14.2) + multi_json (1.7.1) + nanoc (3.6.1) + cri (~> 2.3) + rack (1.5.2) + rubypants (0.2.0) + sass (3.2.7) + tilt (1.3.6) + typogruby (1.0.15) + rubypants + +PLATFORMS + ruby + +DEPENDENCIES + adsf + coffee-script + haml + kramdown + nanoc + sass + typogruby diff --git a/Rules b/Rules new file mode 100644 index 0000000..18165ac --- /dev/null +++ b/Rules @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby + +SASS_LOAD_PATHS = [ + File.join(`bundle show bourbon`.chomp, *%w[app assets stylesheets]), + File.join(`bundle show rocks`.chomp, *%w[app assets stylesheets]) +] + +compile '/stylesheet/' do + filter :sass, syntax: :scss, load_paths: SASS_LOAD_PATHS +end + +compile '/javascript/' do + filter :coffeescript +end + +compile '/posts/*' do + filter :kramdown, auto_ids: false, coderay_line_numbers: nil, coderay_tab_width: 2 + filter :typogruby + layout 'post' +end + +compile '*' do + unless item.binary? + filter :erb + layout 'default' + end +end + +route '/stylesheet/' do + '/style.css' +end + +route '/javascript/' do + '/script.js' +end + +route '/posts/*' do + y, m, d, slug = /([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)/.match(item.identifier).captures + "/#{y}/#{m}/#{d}/#{slug}/index.html" +end + +route '*' do + if item.binary? + # Write item with identifier /foo/ to /foo.ext + item.identifier.chop + '.' + item[:extension] + else + # Write item with identifier /foo/ to /foo/index.html + item.identifier + 'index.html' + end +end + +layout '*', :erb diff --git a/content/index.md b/content/index.md new file mode 100644 index 0000000..7f8b4c5 --- /dev/null +++ b/content/index.md @@ -0,0 +1,7 @@ +--- +title: Home +--- + +# Nanoc + +An awesome site generator. \ No newline at end of file diff --git a/content/posts/2013-03-22-my-first-post.md b/content/posts/2013-03-22-my-first-post.md new file mode 100644 index 0000000..dde7963 --- /dev/null +++ b/content/posts/2013-03-22-my-first-post.md @@ -0,0 +1,17 @@ +--- +title: "My first post" +created_at: 2013-03-22 +kind: article +tags: [ 'one', 'two' ] +--- + +This is my post. + +* With +* A list + +And some + +> quoted stuff for fun and profit. + +Thanks! \ No newline at end of file diff --git a/content/stylesheet.css b/content/stylesheet.css new file mode 100644 index 0000000..0329a0d --- /dev/null +++ b/content/stylesheet.css @@ -0,0 +1,101 @@ +* { + margin: 0; + padding: 0; + + font-family: Georgia, Palatino, Times, 'Times New Roman', sans-serif; +} + +body { + background: #fff; +} + +a { + text-decoration: none; +} + +a:link, +a:visited { + color: #f30; +} + +a:hover { + color: #f90; +} + +#main { + position: absolute; + + top: 40px; + left: 280px; + + width: 500px; +} + +#main h1 { + font-size: 40px; + font-weight: normal; + + line-height: 40px; + + letter-spacing: -1px; +} + +#main p { + margin: 20px 0; + + font-size: 15px; + + line-height: 20px; +} + +#main ul, #main ol { + margin: 20px; +} + +#main li { + font-size: 15px; + + line-height: 20px; +} + +#main ul li { + list-style-type: square; +} + +#sidebar { + position: absolute; + + top: 40px; + left: 20px; + width: 200px; + + padding: 20px 20px 0 0; + + border-right: 1px solid #ccc; + + text-align: right; +} + +#sidebar h2 { + text-transform: uppercase; + + font-size: 13px; + + color: #333; + + letter-spacing: 1px; + + line-height: 20px; +} + +#sidebar ul { + list-style-type: none; + + margin: 20px 0; +} + +#sidebar li { + font-size: 14px; + + line-height: 20px; +} diff --git a/layouts/default.html b/layouts/default.html new file mode 100644 index 0000000..a49ae06 --- /dev/null +++ b/layouts/default.html @@ -0,0 +1,29 @@ + + + + + A Brand New nanoc Site - <%= @item[:title] %> + + + + + + +
+ <%= yield %> +
+ + + diff --git a/layouts/post.html b/layouts/post.html new file mode 100644 index 0000000..7cc1cbd --- /dev/null +++ b/layouts/post.html @@ -0,0 +1,13 @@ +<% render 'default' do %> +
+

<%= item[:title] %>

+ + + <%= yield %> + +
+<% end %> \ No newline at end of file diff --git a/lib/default.rb b/lib/default.rb new file mode 100644 index 0000000..5553f0a --- /dev/null +++ b/lib/default.rb @@ -0,0 +1,20 @@ +include Nanoc3::Helpers::Blogging +include Nanoc3::Helpers::Tagging +include Nanoc3::Helpers::Rendering +include Nanoc3::Helpers::LinkTo + +module PostHelper + def get_pretty_date(post) + attribute_to_time(post[:created_at]).strftime('%B %-d, %Y') + end + + def get_tags(post) + if post[:tags].nil? || post[:tags].empty? + "(not tagged)" + else + post[:tags].map { |tag| tag.downcase }.sort.join(", ") + end + end +end + +include PostHelper \ No newline at end of file diff --git a/nanoc.yaml b/nanoc.yaml new file mode 100644 index 0000000..1f22d75 --- /dev/null +++ b/nanoc.yaml @@ -0,0 +1,82 @@ +# A list of file extensions that nanoc will consider to be textual rather than +# binary. If an item with an extension not in this list is found, the file +# will be considered as binary. +text_extensions: [ 'coffee', 'css', 'erb', 'haml', 'handlebars', 'hb', 'htm', 'html', 'js', 'less', 'markdown', 'md', 'ms', 'mustache', 'php', 'rb', 'sass', 'scss', 'txt', 'xhtml', 'xml' ] + +# The path to the directory where all generated files will be written to. This +# can be an absolute path starting with a slash, but it can also be path +# relative to the site directory. +output_dir: output + +# A list of index filenames, i.e. names of files that will be served by a web +# server when a directory is requested. Usually, index files are named +# “index.html”, but depending on the web server, this may be something else, +# such as “default.htm”. This list is used by nanoc to generate pretty URLs. +index_filenames: [ 'index.html' ] + +# Whether or not to generate a diff of the compiled content when compiling a +# site. The diff will contain the differences between the compiled content +# before and after the last site compilation. +enable_output_diff: false + +base_url: http://ariejan.net +title: 'ariejan.net' +author_name: 'Ariejan de Vroom' +author_uri: 'http://ariejan.net' + +prune: + # Whether to automatically remove files not managed by nanoc from the output + # directory. For safety reasons, this is turned off by default. + auto_prune: true + + # Which files and directories you want to exclude from pruning. If you version + # your output directory, you should probably exclude VCS directories such as + # .git, .svn etc. + exclude: [ '.git', '.hg', '.svn', 'CVS' ] + +# The data sources where nanoc loads its data from. This is an array of +# hashes; each array element represents a single data source. By default, +# there is only a single data source that reads data from the “content/” and +# “layout/” directories in the site directory. +data_sources: + - + # The type is the identifier of the data source. By default, this will be + # `filesystem_unified`. + type: filesystem_unified + + # The path where items should be mounted (comparable to mount points in + # Unix-like systems). This is “/” by default, meaning that items will have + # “/” prefixed to their identifiers. If the items root were “/en/” + # instead, an item at content/about.html would have an identifier of + # “/en/about/” instead of just “/about/”. + items_root: / + + # The path where layouts should be mounted. The layouts root behaves the + # same as the items root, but applies to layouts rather than items. + layouts_root: / + + # Whether to allow periods in identifiers. When turned off, everything + # past the first period is considered to be the extension, and when + # turned on, only the characters past the last period are considered to + # be the extension. For example, a file named “content/about.html.erb” + # will have the identifier “/about/” when turned off, but when turned on + # it will become “/about.html/” instead. + allow_periods_in_identifiers: false + +# Configuration for the “watch” command, which watches a site for changes and +# recompiles if necessary. +watcher: + # A list of directories to watch for changes. When editing this, make sure + # that the “output/” and “tmp/” directories are _not_ included in this list, + # because recompiling the site will cause these directories to change, which + # will cause the site to be recompiled, which will cause these directories + # to change, which will cause the site to be recompiled again, and so on. + dirs_to_watch: [ 'content', 'layouts', 'lib' ] + + # A list of single files to watch for changes. As mentioned above, don’t put + # any files from the “output/” or “tmp/” directories in here. + files_to_watch: [ 'nanoc.yaml', 'Rules' ] + + # When to send notifications (using Growl or notify-send). + notify_on_compilation_success: true + notify_on_compilation_failure: true