Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* some breathing space for the sidebar.

* The main headings for the articles also get repeated in the ToC.
 Fixed it by removing the first element of the array. The RDoc ToC
generator does not have a method to deselect headings based on their
type as of now.

* HTML links are not parsed. Removed the redundant "top" links since
* they are auto-generated by the RDoc ToC parser.
  • Loading branch information...
commit 4f4d2ce9feeba1e89eaf66df43cfbd7f308f7757 1 parent 3a2d442
@kgrz kgrz authored
Showing with 31 additions and 30 deletions.
  1. +8 −3 app.rb
  2. +23 −27 models/mongo.md
View
11 app.rb
@@ -58,7 +58,7 @@
md = File.read("#{params[:topic]}/#{params[:article]}.md")
formatter = RDoc::Markup::ToTableOfContents.new
- @toc = RDoc::Markdown.parse(md).accept(formatter)
+ @toc = RDoc::Markdown.parse(md).accept(formatter)[1..-1]
markdown :"#{params[:topic]}/#{params[:article]}"
end
@@ -106,7 +106,7 @@
- @menu.each do |me|
option value="/p/#{me}?#article"
#{me.capitalize.sub('_', ' ')}
- - if @toc
+ - if @toc && (@toc.count > 1)
h2 Chapters
ol
- @toc.each do |toc|
@@ -219,6 +219,10 @@
width: 275px
height: 40px
+li
+ p
+ margin: 0
+
#content
float:left
width: 70%
@@ -234,9 +238,10 @@
color: #8F8F8F
#sidebar
- width: 30%
+ width: 25%
float: right
margin-top: 30px
+ padding: 0 20px
code, pre, tt
font-family: 'Monaco', 'Menlo', consolas, inconsolata, monospace
View
50 models/mongo.md
@@ -1,24 +1,16 @@
-# Mongo
+# MongoDB
-- [MongoMapper](#mongomapper)
-- [Mongoid](#mongoid)
-- [Candy](#candy)
-- [Mongomatic](#mongomatic)
-- [MongoODM](#mongo_odm)
There are many ORMs out there for Mongo (or _ODMs_ in this case).
This page will go over just a few.
-Require the Mongo gem in your app:
-```ruby
-require 'rubygems'
-require 'sinatra'
-require 'mongo'
-```
+###Mongo
+
+[Looking for the official driver?](http://recipes.sinatrarb.com/p/databases/mongo?#article)
-<a name='mongomapper' />
-###[MongoMapper][mongomapper]###
+
+###MongoMapper
```ruby
require 'mongomapper'
@@ -42,10 +34,10 @@ get '/' do
haml :links
end
```
-<span style='font-size: smaller'>([top](#top))</span>
-<a name='mongoid' />
-###[Mongoid][mongoid]###
+
+###Mongoid
+
```ruby
require 'mongoid'
@@ -69,10 +61,8 @@ get '/' do
haml :links
end
```
-<span style='font-size: smaller'>([top](#top))</span>
-<a name='candy' />
-###[Candy][candy]###
+###Candy
```ruby
require 'candy'
@@ -103,10 +93,9 @@ get '/' do
haml :links
end
```
-<span style='font-size: smaller'>([top](#top))</span>
-<a name='mongomatic' />
-###[Mongomatic][mongomatic]###
+
+###Mongomatic
```ruby
require 'mongomatic'
@@ -137,10 +126,9 @@ def validate
self.errors.add "address.zip", "blank" if (self["address"] || {})["zip"].blank?
end
```
-<span style='font-size: smaller'>([top](#top))</span>
-<a name='mongo_odm' />
-###[MongoODM][mongoodm]###
+
+###MongoODM
```ruby
require 'mongo_odm'
@@ -164,7 +152,15 @@ get '/' do
haml :links
end
```
-<span style='font-size: smaller'>([top](#top))</span>
+
+
+#### GitHub links
+
+* [MongoMapper][mongomapper]
+* [Mongoid][mongoid]
+* [Candy][candy]
+* [Mongomatic][mongomatic]
+* [MongoODM][mongoodm]
[mongomapper]: http://mongomapper.com/
[mongoid]: http://mongoid.org/

8 comments on commit 4f4d2ce

@zzak
Owner

@kgrz can you revert the part on the RDoc ToC? I'm working on this separately.

@kgrz
Owner

Okay :)

@kgrz
Owner

Done.

@zzak
Owner

thanks!

@zzak
Owner

@kgrz What did you mean by:

The RDoc ToC generator does not have a method to deselect headings based on their type as of now.

I sorta like having the ¶ and ↑, but im working on an option to expose RDoc::Options.pipe which, when true, will disable these tags.

@kgrz
Owner

I meant that the RDoc ToC generation class takes an option omit_headings_below but there is no omit_headings_above which, if provided, would've made it possible to skip <h1> tags in the ToC.

@kgrz
Owner

Oh, and the symbols are nice :)

@zzak
Owner

@kgrz When RDoc 4.1.0 is released, we can use Options#output_decoration = false to remove those if we want. See rdoc/rdoc#199

Please sign in to comment.
Something went wrong with that request. Please try again.