diff --git a/doc-src/content/stylesheets/main.sass b/doc-src/content/stylesheets/main.sass index f8e50822..adbea73a 100644 --- a/doc-src/content/stylesheets/main.sass +++ b/doc-src/content/stylesheets/main.sass @@ -68,6 +68,12 @@ body.reference a.permalink +hover-link +link-colors("inherit", "inherit") + .arg[data-default-value] + color: #666 + &:before + content: "[" + &:after + content: "]" .source-documentation background-color: #eee border: 1px solid #aaa diff --git a/doc-src/layouts/default.haml b/doc-src/layouts/default.haml index a60a4999..6732ad74 100644 --- a/doc-src/layouts/default.haml +++ b/doc-src/layouts/default.haml @@ -25,5 +25,9 @@ e = $(e); e.after(''); }); + $('span.arg[data-default-value]').each(function(i,e){ + e = $(e); + e.attr("title", "Defaults to: " + e.attr("data-default-value")) + }) }); = render "partials/analytics" diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index 7455e0b0..884e47e5 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -135,8 +135,8 @@ def constants(item) constants end -def mixin_signature(mixin) - mixin.sass_signature(:include) +def mixin_signature(mixin, format = :html) + mixin.sass_signature(:include, format) end def example_items diff --git a/doc-src/lib/stylesheets/sass_extensions.rb b/doc-src/lib/stylesheets/sass_extensions.rb index db998da0..6881fd77 100644 --- a/doc-src/lib/stylesheets/sass_extensions.rb +++ b/doc-src/lib/stylesheets/sass_extensions.rb @@ -118,30 +118,36 @@ module Sass "#{sass_signature}\n #{children_to_sass}\n" end - def sass_signature(mode = :definition) + def sass_signature(mode = :definition, format = :text) prefix = case mode when :definition "=" when :include "+" end - "#{prefix}#{name}#{arglist_to_sass}" + "#{prefix}#{name}#{arglist_to_sass(format)}" end private - def arglist_to_sass + def arglist_to_sass(format = :text) if args && args.any? - "(#{args.map{|a| arg_to_sass(a)}.join(", ")})" + "(#{args.map{|a| arg_to_sass(a, format)}.join(", ")})" else "" end end - def arg_to_sass(arg) + def arg_to_sass(arg, format = :text) name, default_value = arg - sass_str = "#{name.inspect}" - if default_value - sass_str << " = " - sass_str << default_value.to_sass + sass_str = "" + if format == :html + ddv = %Q{ data-default-value="#{h(default_value.to_sass)}"} if default_value + sass_str = %Q{#{name.inspect}} + else + sass_str = "#{name.inspect}" + if default_value + sass_str << " = " + sass_str << default_value.to_sass + end end sass_str end