Rules 860 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env ruby
  2. compile '/**/*.html' do
  3. layout '/default.*'
  4. filter :erb
  5. end
  6. # This is an example rule that matches Markdown (.md) files, and filters them
  7. # using the :kramdown filter. It is commented out by default, because kramdown
  8. # is not bundled with Nanoc or Ruby.
  9. #
  10. compile '/*.md' do
  11. filter :kramdown
  12. layout '/page.*'
  13. filter :rm_last_nl
  14. end
  15. route '/*.{html,md}' do
  16. if item.identifier =~ '/index.*'
  17. '/index.html'
  18. else
  19. item.identifier.without_ext + '/index.html'
  20. end
  21. end
  22. ignore '/**/#*#'
  23. ignore '/**/*~'
  24. route '/posts/*' do
  25. y,m,d,slug = /([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\.]+)*/.match(item.identifier).captures
  26. "/#{y}/#{m}/#{d}/#{slug}/index.html"
  27. end
  28. compile '/posts/*' do
  29. filter :kramdown
  30. layout '/post.html'
  31. filter :rm_last_nl
  32. end
  33. compile '/**/*' do
  34. write item.identifier.to_s
  35. end
  36. layout '/**/*', :erb