From 41f1f30e0fc351ab079515a978e7f47d5bb0b975 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 17 Mar 2010 08:42:40 -0700 Subject: [PATCH] Don't use a table for constants -- too hard to read. --- doc-src/content/stylesheets/main.sass | 28 +++++++++---- .../partials/reference/const_table.haml | 10 +++++ .../layouts/partials/reference/constants.haml | 39 ++++++------------- 3 files changed, 41 insertions(+), 36 deletions(-) create mode 100644 doc-src/layouts/partials/reference/const_table.haml diff --git a/doc-src/content/stylesheets/main.sass b/doc-src/content/stylesheets/main.sass index c88199d2..a25a004d 100644 --- a/doc-src/content/stylesheets/main.sass +++ b/doc-src/content/stylesheets/main.sass @@ -52,19 +52,31 @@ table.datagrid // Reference body.reference - h3.mixin - background-color: #eee - border: 1px solid #aaa - padding: 0.75em - margin-bottom: 0 - a.permalink - +hover-link - +link-colors("inherit", "inherit") + h3 + &.mixin, &.constant + font-family: Monaco, courier + font-weight: 200 + +text-shadow + background-color: #eee + border: 1px solid #aaa + padding: 0.75em + margin-bottom: 0 + a.permalink + +hover-link + +link-colors("inherit", "inherit") .source-documentation background-color: #eee border: 1px solid #aaa border-top-width: 0 padding: 0.75em + dl.source-documentation + margin-top: 0 + dt + font-weight: bold + float: left + margin-right: 15px + dt:not(:first-child) + margin-top: 1em a.view-source float: right margin: 1.25em diff --git a/doc-src/layouts/partials/reference/const_table.haml b/doc-src/layouts/partials/reference/const_table.haml new file mode 100644 index 00000000..6a1d7651 --- /dev/null +++ b/doc-src/layouts/partials/reference/const_table.haml @@ -0,0 +1,10 @@ +- constants.each do |constant_def| + - const_id = constant_def.name.gsub(/_/,'-') + %h3.constant{:id=>"const-#{const_id}"} + %a.permalink{:href => "#const-#{const_id}"}= "!"+constant_def.name + %dl.constant-details.source-documentation + %dt Value + %dd= constant_def.expr.to_sass(:html) + - if constant_def.comment + %dt Description + %dd= format_doc constant_def.comment diff --git a/doc-src/layouts/partials/reference/constants.haml b/doc-src/layouts/partials/reference/constants.haml index 644b69ff..fbd8acbd 100644 --- a/doc-src/layouts/partials/reference/constants.haml +++ b/doc-src/layouts/partials/reference/constants.haml @@ -1,29 +1,12 @@ - if (constant_defs = constants(@item)).any? - %h2 Constants - - show_description = constant_defs.detect{|d| d.comment } && true - - cycle 'even', 'odd' do |row_classes| - - cycle 'even', 'odd' do |col_classes| - %table.constants{:cellspacing => "0", :cellpadding=>"0", :border => "0"} - %thead - %tr{:class => row_classes.next} - %th{:class => col_classes.next} Constant - %th{:class => col_classes.next} Value - - if show_description - %th{:class => col_classes.next} Description - %th{:class => col_classes.next} Configurable? - - col_classes.reset! - - constant_defs.each do |constant_def| - %tr{:class => row_classes.next} - %td{:class => col_classes.next} - %code= "!"+constant_def.name - %td{:class => col_classes.next} - %code= constant_def.expr.to_sass(:html) - - if show_description - %td{:class => col_classes.next} - - if constant_def.comment - = format_doc constant_def.comment - - else -   - %td{:class => col_classes.next} - %code= constant_def.guarded ? "Y" : "N" - - col_classes.reset! + - variables = constant_defs.select{|d| d.guarded } + - constants = constant_defs.reject{|d| d.guarded } + - if variables.any? + %h2 + Configurable Variables + %a(href="/docs/tutorials/configurable-variables/" class="help") help + = render "partials/reference/const_table", :constants => variables + + - if constants.any? + %h2 Constants + = render "partials/reference/const_table", :constants => constants \ No newline at end of file