sinatra-cqdocs 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+ require 'sinatra/base'
2
+
3
+ module Sinatra
4
+ module CqDocs
5
+
6
+ module Helpers
7
+
8
+ def get_view_as_string(filename)
9
+ view = File.join(settings.cqdocs_view_path, filename)
10
+ layout = File.join(settings.cqdocs_view_path, 'layouts/sample_markup.haml')
11
+ data = ""
12
+ f = File.open(view, "r")
13
+ f.each_line do |line|
14
+ data += line
15
+ end
16
+ return data
17
+ return layout
18
+ end
19
+
20
+ def render_sample_code options={}, &block
21
+ block = capture_haml(&block)
22
+ capture_haml do
23
+ haml_tag :section, :id => classify(options[:name]) do
24
+ haml_tag :div, :class => "page-header" do
25
+ haml_tag :h1, options[:name]
26
+ end
27
+ haml_tag :h2, "Example"
28
+ haml_tag :p, options[:description]
29
+ haml_tag :div, block, :class => "bs-docs-example"
30
+ haml_tag :h2, "Markup"
31
+ haml_tag :pre, html_escape(block), :class => "prettyprint linenums"
32
+ end
33
+ end
34
+ end
35
+
36
+ def classify string
37
+ result = string.downcase
38
+ result = result.gsub(/([\W_]+)/, '-')
39
+ result = result.gsub(/-\z/, '')
40
+ end
41
+ end
42
+
43
+ def self.registered(app)
44
+ app.helpers NiftyDocs::Helpers
45
+
46
+ unless defined?(settings.template_engine)
47
+ app.set :template_engine, :haml
48
+ end
49
+
50
+ app.set :cqdocs_view_path, File.expand_path('../views/', __FILE__)
51
+
52
+ app.get "/body_components.html" do
53
+ view_location = File.expand_path('../views', __FILE__)
54
+ send settings.template_engine, get_view_as_string("body_components.#{settings.template_engine}"), :layout => :"layouts/sample_markup", :views => view_location
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,94 @@
1
+ .container
2
+
3
+ .row
4
+ .span3.bs-docs-sidebar
5
+ %ul.nav.nav-list.bs-docs-sidenav.affix
6
+ %li
7
+ %a{:href => "##{classify("2 Col Hero")}"} 2 Col Hero
8
+ %li
9
+ %a{:href => "##{classify("2 Col Resources")}"} 2 Col Resources
10
+ %li
11
+ %a{:href => "##{classify("2 Col Vertical Tabs")}"} 2 Col Vertical Tabs
12
+ %li
13
+ %a{:href => "##{classify("3 Col Category")}"} 3 Col Category
14
+ %li
15
+ %a{:href => "##{classify("Generic Module")}"} Generic Module
16
+ %li
17
+ %a{:href => "##{classify("Generic Module (Hero)")}"} Generic Module (Hero)
18
+ %li
19
+ %a{:href => "##{classify("Generic Module (Two-Links)")}"} Generic Module (Two-Links)
20
+
21
+ .span9
22
+ = render_sample_code :name => "2 Col Hero", :description => "This is a 2/3 1/3 colum layout, that is generally used at the top of the page" do
23
+ = col(2, "hero") do
24
+ = cell do
25
+ %p Nostrud veniam ex, locavore cardigan sriracha neutra laboris whatever brooklyn. Squid 90's qui mixtape, mlkshk aliquip reprehenderit ethical gluten-free irony street art tempor. Consequat bicycle rights velit nostrud pariatur, fixie duis. Dolor brunch DIY swag sartorial minim, kale chips lo-fi. Pickled lo-fi quinoa brunch magna, put a bird on it ad blue bottle polaroid terry richardson mcsweeney's mlkshk bushwick 8-bit eiusmod. Farm-to-table ethical master cleanse squid, synth nesciunt excepteur. Selvage street art consequat, disrupt cillum est ennui shoreditch whatever.
26
+ = cell do
27
+ %p squid. Ennui keffiyeh whatever kogi irure typewriter ex selfies wolf aesthetic twee cupidatat ethical. Synth salvia chambray, duis shoreditch 8-bit fap laborum tonx PBR.
28
+
29
+ = render_sample_code :name => "2 Col Resources" do
30
+ = col(2, "resources") do
31
+ = cell do
32
+ %p Nostrud veniam ex, locavore cardigan sriracha neutra laboris whatever brooklyn. Squid 90's qui mixtape, mlkshk aliquip reprehenderit ethical gluten-free irony street art tempor. Consequat bicycle rights velit nostrud pariatur, fixie duis. Dolor brunch DIY swag sartorial minim, kale chips lo-fi. Pickled lo-fi quinoa brunch magna, put a bird on it ad blue bottle polaroid terry richardson mcsweeney's mlkshk bushwick 8-bit eiusmod. Farm-to-table ethical master cleanse squid, synth nesciunt excepteur. Selvage street art consequat, disrupt cillum est ennui shoreditch whatever.
33
+ = cell do
34
+ %p squid. Ennui keffiyeh whatever kogi irure typewriter ex selfies wolf aesthetic twee cupidatat ethical. Synth salvia chambray, duis shoreditch 8-bit fap laborum tonx PBR.
35
+
36
+ = render_sample_code :name => "2 Col Vertical Tabs" do
37
+ = col(2, "vertical-tabs") do
38
+ = cell do
39
+ %p Nostrud veniam ex, locavore cardigan sriracha neutra laboris whatever brooklyn. Squid 90's qui mixtape.
40
+ = cell do
41
+ %p Ennui keffiyeh whatever kogi irure typewriter ex selfies wolf aesthetic twee cupidatat ethical. Synth salvia chambray, duis shoreditch 8-bit fap laborum tonx PBR.
42
+
43
+ = render_sample_code :name => "3 Col Category" do
44
+ = col(3, "category") do
45
+ = cell do
46
+ %p Nostrud veniam ex, locavore cardigan sriracha neutra laboris whatever brooklyn. Squid 90's qui mixtape, mlkshk aliquip reprehenderit ethical gluten-free irony street art tempor. Consequat bicycle rights velit nostrud pariatur, fixie duis. Dolor brunch DIY swag sartorial minim, kale chips lo-fi. Pickled lo-fi quinoa brunch magna, put a bird on it ad blue bottle polaroid terry richardson mcsweeney's mlkshk bushwick 8-bit eiusmod. Farm-to-table ethical master cleanse squid, synth nesciunt excepteur. Selvage street art consequat, disrupt cillum est ennui shoreditch whatever.
47
+ = cell do
48
+ %p squid. Ennui keffiyeh whatever kogi irure typewriter ex selfies wolf aesthetic twee cupidatat ethical. Synth salvia chambray, duis shoreditch 8-bit fap laborum tonx PBR.
49
+ = cell do
50
+ %p Nostrud veniam ex, locavore cardigan sriracha neutra laboris whatever brooklyn. Squid 90's qui mixtape, mlkshk aliquip reprehenderit ethical gluten-free irony street art tempor. Consequat bicycle rights velit nostrud pariatur, fixie duis. Dolor brunch DIY swag sartorial minim, kale chips lo-fi. Pickled lo-fi quinoa brunch magna, put a bird on it ad blue bottle polaroid terry richardson mcsweeney's mlkshk bushwick 8-bit eiusmod. Farm-to-table ethical master cleanse squid, synth nesciunt excepteur. Selvage street art consequat, disrupt cillum est ennui shoreditch whatever.
51
+ = cell do
52
+ %p squid. Ennui keffiyeh whatever kogi irure typewriter ex selfies wolf aesthetic twee cupidatat ethical. Synth salvia chambray, duis shoreditch 8-bit fap laborum tonx PBR.
53
+
54
+ %h2 Core Components
55
+
56
+ = render_sample_code :name => "Generic Module" do
57
+ = generic_module do
58
+ %h1 Title
59
+ %img{:src => "fpo/feature-img-img-2.png"}/
60
+ %p Nostrud veniam ex, locavore cardigan sriracha neutra laboris whatever brooklyn. Squid 90's qui mixtape, mlkshk aliquip reprehenderit ethical gluten-free irony street art tempor. Consequat bicycle rights velit nostrud pariatur, fixie duis. Dolor brunch DIY swag sartorial minim, kale chips lo-fi. Pickled lo-fi quinoa brunch magna, put a bird on it ad blue bottle polaroid terry richardson mcsweeney's mlkshk bushwick 8-bit eiusmod. Farm-to-table ethical master cleanse squid, synth nesciunt excepteur. Selvage street art consequat, disrupt cillum est ennui shoreditch whatever.
61
+ %p Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat.
62
+ %a.more{:href => "#"} Learn More
63
+ %a.view-all{:href => "#"} View All
64
+
65
+ = render_sample_code :name => "Generic Module (Hero)" do
66
+ = generic_module(:display_as => "hero" )do
67
+ %h1 Title
68
+ %img{:src => "fpo/feature-img-img-2.png"}/
69
+ %p Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat.
70
+ %p Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat.
71
+ %a.more{:href => "#"} Learn More
72
+ %a.view-all{:href => "#"} View All
73
+
74
+ = render_sample_code :name => "Generic Module (Two-Links)" do
75
+ = generic_module(:display_as => "two-links") do
76
+ %h1 Title
77
+ %img{:src => "fpo/feature-img-img-2.png"}/
78
+ %p Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat.
79
+ %p Mibh este euismod tincidunt aliquam erat volutpat. Mibh este euismod tincidunt aliquam erat volutpat.
80
+ %a.more{:href => "#"} Learn More
81
+ %a.view-all{:href => "#"} View All
82
+
83
+ = render_sample_code :name => "Horizontal Tabs" do
84
+ = tabs data["sample_horizontal_tab_list"], :active => 'overview', :direction => "horizontal"
85
+
86
+ = render_sample_code :name => "Vertical Tabs", :description => "This vertical tabs style occupies the entire width of it\'s parent div. It is gnerally used with the Vertical Tabs col system." do
87
+ = tabs data["sample_vertical_tab_list"], :active => 'antivirus', :direction => "vertical"
88
+
89
+ %h2 Resource Components
90
+ = render_sample_code :name => "Share Line" do
91
+ = partial "components/share_line", :locals => {:resource => data["resources"][0]}
92
+
93
+ = render_sample_code :name => "Citation Line" do
94
+ = partial "components/citation_line", :locals => {:resource => data["resources"][0]}
@@ -0,0 +1,92 @@
1
+ %html
2
+ %head
3
+ %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-type"}
4
+ %title Index
5
+ %link{:charset => "utf-8", :href => "css/main.css", :media => "screen", :rel => "stylesheet", :type => "text/css"}
6
+ %script{:charset => "utf-8", :src => "js/vendor/jquery.min.js", :type => "text/javascript"}
7
+ %script{:charset => "utf-8", :src => "js/vendor/underscore.min.js", :type => "text/javascript"}
8
+ %script{:charset => "utf-8", :src => "js/vendor/backbone.min.js", :type => "text/javascript"}
9
+ %script{:charset => "utf-8", :src => "js/vendor/shadowbox.js", :type => "text/javascript"}
10
+ %script{:charset => "utf-8", :src => "js/vendor/coverflow.js", :type => "text/javascript"}
11
+ %script{:charset => "utf-8", :src => "js/vendor/bootstrap.min.js", :type => "text/javascript"}
12
+ %script{:charset => "utf-8", :src => "js/SlotMachine.js", :type => "text/javascript"}
13
+ %script{:charset => "utf-8", :src => "js/CoverflowPlayer.js", :type => "text/javascript"}
14
+ %script{:charset => "utf-8", :src => "js/Header.js", :type => "text/javascript"}
15
+ %script{:charset => "utf-8", :src => "js/Footer.js", :type => "text/javascript"}
16
+ %script{:charset => "utf-8", :src => "js/Comments.js", :type => "text/javascript"}
17
+ %script{:charset => "utf-8", :src => "js/main.js", :type => "text/javascript"}
18
+
19
+ :css
20
+
21
+ .bs-docs-sidebar {
22
+ padding-top: 30px;
23
+ }
24
+
25
+ section {
26
+ padding-top: 12px;
27
+ }
28
+
29
+ h1, h2, h3, h4, h5, h6 {
30
+ margin: 10px 0;
31
+ font-family: inherit;
32
+ font-weight: bold;
33
+ line-height: 20px;
34
+ color: inherit;
35
+ text-rendering: optimizelegibility;
36
+ }
37
+
38
+ h1 {
39
+ font-size: 38.5px;
40
+ line-height: 40px;
41
+ }
42
+
43
+ h2 {
44
+ font-size: 22px;
45
+ line-height: 40px;
46
+ }
47
+
48
+ .page-header {
49
+ padding-bottom: 9px;
50
+ margin: 20px 0 30px;
51
+ border-bottom: 1px solid #eeeeee;
52
+ }
53
+ .rendered-markup {
54
+ border: 1px solid orange
55
+ }
56
+ .btn.show-markup {
57
+ float: right;
58
+ margin: 3px 0px;
59
+ padding: 0px 2px;
60
+ font-size: 10px;
61
+ }
62
+ .bs-docs-example {
63
+ position: relative;
64
+ margin: 15px 0;
65
+ padding: 39px 19px 14px;
66
+ background-color: #fff;
67
+ border: 1px solid #ddd;
68
+ -webkit-border-radius: 4px;
69
+ -moz-border-radius: 4px;
70
+ border-radius: 4px;
71
+ }
72
+
73
+ .bs-docs-example:after {
74
+ content: "Example";
75
+ position: absolute;
76
+ top: -1px;
77
+ left: -1px;
78
+ padding: 3px 7px;
79
+ font-size: 12px;
80
+ font-weight: bold;
81
+ background-color: #f5f5f5;
82
+ border: 1px solid #ddd;
83
+ color: #9da0a4;
84
+ -webkit-border-radius: 4px 0 4px 0;
85
+ -moz-border-radius: 4px 0 4px 0;
86
+ border-radius: 4px 0 4px 0;
87
+ }
88
+
89
+ %script{:src => "https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"}
90
+
91
+ %body
92
+ = yield
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-cqdocs
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Leo Herrick
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-03-12 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Can be used to generate set of docs for CQ projects
22
+ email: leoherrick@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/sinatra/cqdocs.rb
31
+ - lib/sinatra/views/body_components.haml
32
+ - lib/sinatra/views/layouts/sample_markup.haml
33
+ has_rdoc: true
34
+ homepage:
35
+ licenses: []
36
+
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.3.6
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: CQ Docs!
63
+ test_files: []
64
+