From b8b9f153f791559623f4ffe52dd5a34fd6efee0c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Fri, 22 Jan 2010 18:16:25 -0800 Subject: [PATCH] Markdown formatting support for source documentation. --- doc-src/content/reference/blueprint.haml | 4 +-- doc-src/content/stylesheets/main.sass | 12 ++++++++ doc-src/lib/stylesheets.rb | 5 ++++ .../blueprint/stylesheets/_blueprint.sass | 29 +++++++++++-------- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/doc-src/content/reference/blueprint.haml b/doc-src/content/reference/blueprint.haml index 5c2238ea..555128be 100644 --- a/doc-src/content/reference/blueprint.haml +++ b/doc-src/content/reference/blueprint.haml @@ -15,6 +15,6 @@ %h2 Mixins - mixins(@item).each do |mixin| - %h3= mixin_signature mixin + %h3.mixin= mixin_signature mixin - %pre= mixin.comment + .source-documentation= format_doc(mixin.comment) diff --git a/doc-src/content/stylesheets/main.sass b/doc-src/content/stylesheets/main.sass index 8c7c2738..93b5a650 100644 --- a/doc-src/content/stylesheets/main.sass +++ b/doc-src/content/stylesheets/main.sass @@ -13,4 +13,16 @@ body #sidebar +column(6) +pull(24, true) + +body.reference + h3.mixin + background-color: #eee + border: 3px solid #aaa + padding: 0.75em + margin-bottom: 0 + .source-documentation + background-color: #eee + border: 3px solid #aaa + border-top-width: 0 + padding: 0.75em \ No newline at end of file diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index c5298421..9c4eb6d4 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -1,3 +1,4 @@ +require 'rdiscount' def stylesheets_dir(framework) Compass::Frameworks[framework].stylesheets_directory @@ -61,3 +62,7 @@ def mixin_signature(mixin) signature end +def format_doc(docstring) + RDiscount.new(docstring).to_html +end + diff --git a/frameworks/blueprint/stylesheets/_blueprint.sass b/frameworks/blueprint/stylesheets/_blueprint.sass index bd336ece..c8f9449c 100644 --- a/frameworks/blueprint/stylesheets/_blueprint.sass +++ b/frameworks/blueprint/stylesheets/_blueprint.sass @@ -8,18 +8,23 @@ @import blueprint/print.sass @import blueprint/ie.sass -// Usage examples: -// As a top-level mixin, apply to any page that includes the stylesheet: -// +blueprint -// Scoped by a presentational class: -// body.blueprint -// +blueprint(true) -// Scoped by semantic selectors: -// body#page-1, body#page-2, body.a-special-page-type -// +blueprint(true) -// Deprecated: -// You can pass the body selector as the first argument when used as a top-level mixin -// +blueprint("body#page-1, body#page-2, body.a-special-page-type") +// + ### Usage examples: + + As a top-level mixin, apply to any page that includes the stylesheet: + +blueprint + + Scoped by a presentational class: + body.blueprint + +blueprint(true) + + Scoped by semantic selectors: + body#page-1, body#page-2, body.a-special-page-type + +blueprint(true) + + #### Deprecated: + You use to be able to pass the body selector as the first argument when used as a top-level mixin + +blueprint("body#page-1, body#page-2, body.a-special-page-type") =blueprint(!body_selector = "body") @if not (!body_selector == "body" or !body_selector == true) @debug "[DEPRECATED] To specify a the selector \"#{!body_selector}\" to +blueprint, pass true as the first argument and mix it into #{!body_selector}."