Skip to content

Instantly share code, notes, and snippets.

@steckel
Created May 1, 2012 21:06
Show Gist options
  • Save steckel/2571397 to your computer and use it in GitHub Desktop.
Save steckel/2571397 to your computer and use it in GitHub Desktop.
Files for testing URL encoding "issue" with Middleman
<a class="{{name}}" href="%7B%7Bpath%7D%7D">{{name}}</a>
###
# Slim
###
require 'slim'
# Slim::Engine.set_default_options :pretty => false
# Slim::Engine.set_default_options :shortcut => {'@' => 'role', '#' => 'id', '.' => 'class'}
# Slim::Engine.set_default_options :sections => true
###
# Compass
###
# Susy grids in Compass
# First: gem install compass-susy-plugin
# require 'susy'
# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end
###
# Blog settings
###
activate :blog
set :blog_permalink, "wiki/:category/:title.html"
set :blog_layout_engine, "slim"
set :blog_summary_separator, /(READMORE)/
#
# set :blog_permalink, "/blog/:year/:month/:day/:title.html"
# set :blog_sources, "blog/:year-:month-:day-:title.html"
# set :blog_taglink, "/blog/category/:tag.html"
# set :blog_layout, "article"
# set :blog_summary_separator, /(<!--more-->)/
# set :blog_summary_length, nil
# set :blog_year_link, "/blog/:year.html"
# set :blog_month_link, "/blog/:year/:month.html"
# set :blog_day_link, "/blog/:year/:month/:day.html"
# # set :blog_default_extension, ".markdown"
#
# set :blog_tag_template, "blog/tag.html"
# set :blog_calendar_template, "blog/calendar.html"
#
# page "/blog/feed.xml", :layout => false
# activate :blog
#
# # set :blog_permalink, ":year/:month/:day/:title.html"
# # set :blog_sources, ":year-:month-:day-:title.html"
# # set :blog_taglink, "tags/:tag.html"
# # set :blog_layout, "layout"
# # set :blog_summary_separator, /(READMORE)/
# # set :blog_summary_length, 250
# # set :blog_year_link, ":year.html"
# # set :blog_month_link, ":year/:month.html"
# # set :blog_day_link, ":year/:month/:day.html"
# # set :blog_default_extension, ".md"
#
# set :blog_permalink, "blog/:category/:title.html"
# set :blog_tag_template, "tag.html"
# set :blog_calendar_template, "calendar.html"
#
# page "/feed.xml", :layout => false
###
# Markdown
###
set :md, :layout_engine => :slim
# First: gem install rack-codehighlighter
require 'rack/codehighlighter'
use Rack::Codehighlighter,
:pygments_api,
:element => "pre>code",
:pattern => /\A```([-_+\w]+)\s*\n/,
:markdown => true
# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes
###
# Page command
###
# Per-page layout changes:
#
# With no layout
page "/components/*", :layout => false
# With alternative layout
page "/wiki/*", :layout => "/_layouts/wiki-layout", :layout_engine => 'slim'
page "/pages/*", :layout => "/_layouts/pages-layout", :layout_engine => 'slim'
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end
page "/test/doc.md", :layout => "/test/layout"
# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
# @which_fake_page = "Rendering a fake page with a variable"
# end
###
# Helpers
###
# Methods defined in the helpers block are available in templates
helpers do
def nav_active(page)
# @page_id == page ? {:class => "Active"} : {}
puts 'hello', page, @page_id
# @page_id == page ? {class="selected"} : {}
end
end
# Change the CSS directory
# set :css_dir, "alternative_css_directory"
# Change the JS directory
set :js_dir, "app"
# Change the images directory
# set :images_dir, "alternative_image_directory"
# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
# activate :minify_css
# Minify Javascript on build
# activate :minify_javascript
# Enable cache buster
# activate :cache_buster
# Use relative URLs
# activate :relative_assets
# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher
# Or use a different image path
# set :http_path, "/Content/images/"
end
<a class="{{name}}" href="{{path}}">{{name}}</a>
<a href='{{path}}' class="{{name}}">{{name}}</a>
%a{:href => "{{path}}", :class => "{{name}}"} {{name}}
a href='{{path}}' class="{{name}}" {{name}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment