docme 1.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f937e0374ef8498700bd680c1895f9e9eaff5c0
4
- data.tar.gz: c3647e0e0881d8a99f72d3c6b689b4d84676e105
3
+ metadata.gz: 83eee48aa7acdbaf189f9df3b5c78df89a543d88
4
+ data.tar.gz: cd2c845d5fb70b9f6c28600764bfdea5c106053f
5
5
  SHA512:
6
- metadata.gz: 1faf499b853da46983cde779be3374880c1f41ed3a842bf182156ece7580f30200e36f5c2461991dafc247137baae8446b83efe9ac95ea49fa581a68c5d6f2c1
7
- data.tar.gz: f4ddcbec7c780fb8029d3e17d52432759c89dab47a659f75e80664f0f2de7cd09b49ded7ad329519d15e0d70fa13079e90ac48a15aabcb94a976c7385d7cdfb2
6
+ metadata.gz: 98f6b0d9b6048296ef03bc810c8d015b37ef24fe5ae9703129ac97be2c8fc53480287d6a80b330200fcd027be6ee281046b8be00ae95dd4f70f668072e2ea046
7
+ data.tar.gz: 76fad443ec0745288ba63843d573f3e1932e087fa7a9cd94d1209a7ba7c32070e54c9c69a59cc058cbf34663ef5424afb1eca1e45305317eeb4807bd0f3730e1
data/bin/docme CHANGED
@@ -1,71 +1,23 @@
1
1
  #!/usr/bin/env ruby
2
+ # encoding: UTF-8
2
3
 
3
4
  require 'docme'
4
5
  require 'docme/utils'
5
6
  require 'fileutils'
6
7
 
7
- files = Array.new
8
- path = ARGV[0]
9
-
10
-
11
- puts "\n ***Begining docme magix***"
12
-
13
- #create the directory where the site will be stored
14
- if !File::directory?("docme_site")
15
- puts "+Setting up docme's living arrangements."
16
- Dir.mkdir("docme_site")
17
- puts "Woohoo! docme has a home!"
18
- end
19
-
20
- #if a directory was provided
21
- if File.directory?(path)
22
- #foreach file in the path specified
23
- Dir.foreach(path) do |file|
24
- next if file == '.' || file == '..'
25
-
26
- next if file.rindex('.', 0)
27
-
28
- #if there is a sub directory
29
- if File.directory?(path+"/"+file)
30
- #for each file in the sub directory
31
- Dir.foreach(path + "/"+ file) do |f|
32
- next if f == '.' || f == '..'
33
-
34
- next if f.rindex('.', 0)
35
-
36
- next if File.directory?(path+"/"+file+"/"+f)
37
-
38
- page = Docme.jsParse(path+"/"+file+"/"+f)
39
-
40
- #add page to docme dir
41
- if page != nil
42
- FileUtils.mv(page, "docme_site/"+page)
43
- files.push(page)
44
- end
45
-
46
- end
47
- else
48
- page = Docme.jsParse(path+"/"+file)
49
-
50
- if page != nil
51
- FileUtils.mv(page, "docme_site/"+page)
52
- files.push(page)
53
- end
54
- end
55
-
56
- end
57
- else #if a single file was provided
58
- page = Docme.jsParse(path)
59
- FileUtils.mv(page, "docme_site/"+page)
60
- files.push(page)
8
+ if ARGV[0].nil?
9
+ path = Dir.pwd
10
+ puts path
11
+ else
12
+ path = ARGV[0]
61
13
  end
62
14
 
63
- renderIndex(files)
15
+ puts "\n ***Begining docme magix***"
64
16
 
65
- #add page to docme dir
66
- FileUtils.mv("index.html", "docme_site/index.html")
17
+ docmeer = Docme.new(path)
18
+ docmeer.scan_docs
19
+ docmeer.render_docs
20
+ docmeer.render_index
67
21
 
68
- puts "\nFiles generated by docme:"
69
- puts files
70
22
  puts "\n ***Finished docme magic!***"
71
23
  puts "\n You can find your docs inside the `docme_site` folder. \n Hint: look for index.html\n\n"
data/lib/docme.rb CHANGED
@@ -1,4 +1,5 @@
1
- # docme
1
+ # encoding: UTF-8
2
+ # class Docme
2
3
 
3
4
  require 'docme/utils'
4
5
  require 'erb'
@@ -6,120 +7,54 @@ require 'fileutils'
6
7
 
7
8
  class Docme
8
9
 
9
- def self.jsParse(file)
10
+ def initialize(path)
11
+ @path = path
12
+ @pages = []
10
13
 
11
- #SETUP
12
- #raise exception if no file provided, file does not exsist, the file is not readable, or the file has no content
13
- if file== nil || !File.file?(file) || !File.exists?(file)
14
- raise "Please provide a path to the file you wish to docme."
15
- end
14
+ make_home
15
+ end
16
+
17
+ def make_home
18
+ # create the directory where the site will be stored
19
+ return true if File.directory?('docme_site')
20
+ puts "+ Setting up docme's living arrangements."
21
+ Dir.mkdir('docme_site')
22
+ puts ' - Woohoo! docme has a home!'
23
+ end
24
+
25
+ def scan_docs
26
+ # if a directory was provided
27
+ if File.directory?(@path)
28
+
29
+ @pages.concat parse_directory(@path)
30
+
31
+ else # if a single file was provided
16
32
 
17
- #GLOBALS
18
- sourceFile = File.open(file).read
19
- file = cleanFilename(file)
20
- items = Hash.new
21
- collective = Array.new
22
- block_content = Hash.new
23
- block_attr = nil
24
- block_flag = 0
25
- multi_line = ""
26
- isDocme = 0
27
-
28
-
29
- #PARSING
30
- sourceFile.each_line do |line|
31
-
32
- stripLine = line.lstrip
33
-
34
-
35
- #if this is the begining of a comment block then start a new function doc
36
- if stripLine.rindex("/*", 1) == 0
37
- next
38
- end
39
-
40
- #if this is the end of a comment block then there is nothing to do
41
- if stripLine.rindex("*/", 1) == 0 && isDocme == 1
42
- #end the function section of the erb file
43
- collective.push(items)
44
- isDocme = 0
45
- items = Hash.new
46
- next
47
- end
48
-
49
- #if line begins with '+' then we are defining an attribute
50
- if stripLine.rindex("+",0) == 0
51
-
52
- isDocme = 1
53
- parts = stripLine.split(":")
54
-
55
- #parts[0] == the attribute name
56
- attribute = cleanAttribute(parts[0])
57
- attribute = attribute.upcase
58
-
59
- content = cleanContent(parts[1])
60
-
61
- #if the content begins with '{' then we have a regular block
62
- if content.rindex("{{",0) == 0
63
- #go to the next line and look for '-', set block flag
64
- #add the attribute to the doc
65
- block_flag = 1
66
- block_attr = attribute
67
- next
68
- end
69
-
70
- #add content to the doc
71
- items.store(attribute, content)
72
- next
73
- end
74
-
75
- #if line begins with a '-' then we are in a block, if we are in a block but there are no sub attributes then do a multi-line
76
- if stripLine.rindex("-",0) == 0 && isDocme == 1
77
- parts = stripLine.split(":")
78
-
79
- #parts[0] == the attribute name
80
- attribute = cleanAttribute(parts[0])
81
- attribute = attribute.upcase
82
-
83
- content = cleanContent(parts[1])
84
-
85
- #if !var and !code, then process as regular attributes
86
- #put the attribute name
87
- #put the content
88
- block_content.store(attribute, content)
89
- next
90
- end
91
-
92
- if block_flag == 1 && stripLine.rindex("}}",0) != 0 && isDocme == 1
93
- line = cleanCode(line)
94
- multi_line.concat(line)
95
- next
96
- end
97
-
98
- #if the block flag is set and we reach the end of a block, then we reached the end of a regular block, unset flag
99
- if block_flag == 1 && stripLine.rindex("}}",0) == 0 && isDocme ==1
100
- block_flag = 0
101
-
102
- if multi_line.length > 0
103
- items.store(block_attr, multi_line)
104
- else
105
- items.store(block_attr, block_content)
106
- end
107
-
108
- multi_line = ""
109
- block_attr = nil
110
- block_content = Hash.new
111
- next
112
- end
33
+ @pages.push(parse_file(@path))
113
34
 
114
35
  end
36
+ end
115
37
 
116
- #RENDER SITE
117
- if collective.length > 0
118
- page = renderSite(file,collective)
119
- return page
38
+ def render_docs
39
+ puts '+ docme generated the following pages: '
40
+ @pages.each do |page_object|
41
+ page_object.render_site(@pages)
42
+ puts ' - ' + page_object.name
120
43
  end
44
+ end
45
+
46
+ def render_index
47
+
48
+ template = File.read(File.join(File.dirname(__FILE__), 'templates/index.erb'))
121
49
 
122
- return nil
50
+ renderer = ERB.new(template)
123
51
 
52
+ File.open('index.html', 'w+') do |f|
53
+ f.write(renderer.result(binding))
54
+ end
55
+
56
+ # add page to docme dir
57
+ FileUtils.mv('index.html', 'docme_site/index.html')
124
58
  end
59
+
125
60
  end
@@ -0,0 +1,98 @@
1
+ # encoding: UTF-8
2
+ # class Block
3
+
4
+ require 'docme/utils'
5
+
6
+ class Block
7
+
8
+ attr_reader :attributes
9
+ attr_reader :is_empty
10
+
11
+ def initialize(block)
12
+ @attributes = {}
13
+ @is_empty = true
14
+
15
+ parse_block(block)
16
+ end
17
+
18
+ def parse_block(block)
19
+
20
+ is_docme = 0
21
+ block_flag = 0
22
+ block_attr = ''
23
+ multi_line = ''
24
+ block_content = {}
25
+
26
+ # each element in the block represents a line
27
+ block.each do |line|
28
+ strip_line = line.lstrip
29
+
30
+ # if line begins with '+' then we are defining an attribute
31
+ if strip_line.rindex('+', 0) == 0
32
+
33
+ is_docme = 1
34
+ parts = strip_line.split(':')
35
+
36
+ # parts[0] == the attribute name
37
+ attribute = clean_attribute(parts[0])
38
+
39
+ content = clean_content(parts[1])
40
+
41
+ # if the content begins with '{' then we have a regular block
42
+ if content.rindex('{{', 0) == 0
43
+ # go to the next line and look for '-', set block flag
44
+ # add the attribute to the doc
45
+ block_flag = 1
46
+ block_attr = attribute
47
+ next
48
+ end
49
+
50
+ # add content to the doc
51
+ @attributes.store(attribute, content)
52
+ next
53
+ end
54
+
55
+ # if line begins with a '-' then we are in a block, if we are in a block but there are no sub attributes then do a multi-line
56
+ if strip_line.rindex('-', 0) == 0 && is_docme == 1
57
+ parts = strip_line.split(':')
58
+
59
+ # parts[0] == the attribute name
60
+ attribute = clean_attribute(parts[0])
61
+
62
+ content = clean_content(parts[1])
63
+
64
+ # if !var and !code, then process as regular attributes
65
+ # put the attribute name
66
+ # put the content
67
+ block_content.store(attribute, content)
68
+ next
69
+ end
70
+
71
+ if block_flag == 1 && strip_line.rindex('}}', 0) != 0 && is_docme == 1
72
+ line = clean_code(line)
73
+ multi_line.concat(line)
74
+ next
75
+ end
76
+
77
+ # if the block flag is set and we reach the end of a block, then we reached the end of a regular block, unset flag
78
+ if block_flag == 1 && strip_line.rindex('}}', 0) == 0 && is_docme == 1
79
+ block_flag = 0
80
+
81
+ if multi_line.length > 0
82
+ @attributes.store(block_attr, multi_line)
83
+ else
84
+ @attributes.store(block_attr, block_content)
85
+ end
86
+
87
+ multi_line = ''
88
+ block_attr = nil
89
+ block_content = {}
90
+ next
91
+ end
92
+
93
+ end
94
+
95
+ @is_empty = @attributes.empty?
96
+ end
97
+
98
+ end
data/lib/docme/page.rb ADDED
@@ -0,0 +1,68 @@
1
+ # encoding: UTF-8
2
+ # class Page
3
+
4
+ require 'docme/utils'
5
+ require 'erb'
6
+ require 'fileutils'
7
+
8
+ require_relative 'block.rb'
9
+
10
+ class Page
11
+
12
+ attr_reader :name
13
+ attr_reader :blocks
14
+ attr_reader :is_empty
15
+
16
+ @source_file = ''
17
+
18
+ def initialize(file)
19
+ @name = clean_filename(file)
20
+ @source_file = File.open(file).read
21
+ @blocks = []
22
+ @is_empty = true
23
+ end
24
+
25
+ def parse_blocks
26
+ block = []
27
+
28
+ @source_file.each_line do |line|
29
+ strip_line = line.lstrip
30
+
31
+ # if this is the begining of a comment block then start a new function doc
32
+ next if strip_line.rindex('/*', 1) == 0
33
+
34
+ # if this is the end of a comment block then there is nothing to do
35
+ if strip_line.rindex('*/', 1) == 0
36
+ # pass the block off to be processed, the returned object will be stored in the blocks array
37
+ temp_block = Block.new(block)
38
+ @blocks.push(temp_block) unless temp_block.is_empty == true
39
+ block = []
40
+ next
41
+ end
42
+
43
+ block.push(line)
44
+ end
45
+
46
+ @is_empty = @blocks.empty?
47
+ end
48
+
49
+ def render_site(index)
50
+ @index = []
51
+
52
+ index.each do |page|
53
+ @index.push(page.name)
54
+ end
55
+
56
+ # puts content
57
+ renderer = ERB.new(File.read(File.join(File.dirname(__FILE__), '../templates/page.erb'))
58
+ )
59
+
60
+ page = @name + '.html'
61
+
62
+ File.open(page, 'w+') do |f|
63
+ f.write(renderer.result(binding))
64
+ end
65
+
66
+ FileUtils.mv(page, 'docme_site/' + page)
67
+ end
68
+ end
data/lib/docme/utils.rb CHANGED
@@ -1,200 +1,93 @@
1
- #docme utils
1
+ # encoding: UTF-8
2
+ # docme utils
2
3
 
4
+ require 'docme/page'
3
5
 
4
-
5
- def cleanAttribute(attr)
6
- attr = attr.delete("+[")
7
- attr = attr.delete("]")
8
- attr = attr.delete("-")
9
- return attr
6
+ def clean_attribute(attr)
7
+ attr = attr.delete('+[')
8
+ attr = attr.delete(']')
9
+ attr = attr.delete('-')
10
+ attr = attr.upcase
11
+ attr
10
12
  end
11
13
 
12
- def cleanCode(line)
13
- line.gsub!("<", "&lt;")
14
- line.gsub!(">", "&gt;")
14
+ def clean_code(line)
15
+ line.gsub!('<', '&lt;')
16
+ line.gsub!('>', '&gt;')
15
17
 
16
- return line
18
+ line
17
19
  end
18
20
 
19
- def cleanContent(line)
21
+ def clean_content(line)
20
22
  line = line.lstrip
21
- line.chop!
22
- return line
23
+ line = line.rstrip
24
+
25
+ line
23
26
  end
24
27
 
25
- def cleanFilename(file)
28
+ def clean_filename(file)
26
29
  file = File.basename(file)
27
- file = file.split(".")
30
+ file = file.split('.')
28
31
  file = file[0]
29
- return file
32
+
33
+ file
30
34
  end
31
35
 
32
- def renderIndex(pages)
33
- #puts pages
36
+ def unsupported_extension(file)
37
+ parse = true
38
+
39
+ unsupported_extensions = ['.gem', '.jar', '.gemspec', '.zip', '.tar', '.gz', '.tar.gz', '.jpeg', '.jpg', '.png', '.exe']
34
40
 
35
- @pages = pages
41
+ parse = false unless unsupported_extensions.include?(File.extname(file)) || (File.executable?(file) && !Dir.exist?(file)) || (File.executable_real?(file) && !Dir.exist?(file))
36
42
 
37
- template = '<!DOCTYPE html>
38
- <html>
43
+ parse
44
+ end
39
45
 
40
- <style type="text/css">
41
- #wrapper{
42
- width: 70%;
43
- padding-left: 30%;
44
- font-size:2em;
45
- }
46
- </style>
46
+ def unsupported_encoding(file)
47
+ parse = true
47
48
 
48
- <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" media="screen">
49
+ parse = false unless file.encoding.name != 'UTF-8'
49
50
 
50
- <body>
51
- <div id="wrapper">
52
- <div class="list-group">
53
- <% for @page in @pages %>
51
+ parse
52
+ end
54
53
 
55
- <% @name = cleanFilename(@page) %>
56
- <a href="<%= @page %>" class="list-group-item list-group-item-info"><%= @name %></a>
54
+ def parse_directory(path)
57
55
 
58
- <% end %>
59
- </div>
60
- </div>
61
- </body>
56
+ files_array = []
62
57
 
63
- </html>'
58
+ # for each file in the sub directory
59
+ Dir.foreach(path) do |f|
64
60
 
65
- renderer = ERB.new(template)
61
+ next if f == '.' || f == '..' || f.rindex('.', 0) || unsupported_encoding(f) || unsupported_extension(f)
66
62
 
67
- File.open("index.html", "w+") do |f|
68
- f.write(renderer.result(binding))
69
- end
63
+ # if another directory then go inside
64
+ if File.directory?(path + '/' + f)
70
65
 
71
- return "index.html"
66
+ files_array.concat parse_directory(path + '/' + f)
72
67
 
73
- end
68
+ else # else parse normally
74
69
 
75
- def renderSite(file, content)
76
-
77
- @collective = content
78
- @filename = file
79
-
80
- #puts content
81
-
82
- template = '<!DOCTYPE html>
83
- <html>
84
-
85
- <head>
86
- <meta name="viewport" content="width=device-width, initial-scale=1">
87
-
88
- <style type="text/css">
89
- body{
90
- }
91
- #panels-wrapper{
92
- width: 80%;
93
- float: left;
94
- padding-left: 10%;
95
- }
96
- #side-panel{
97
- width: 10%;
98
- float: left;
99
- padding-left: 10px;
100
- }
101
- pre-scrollable{
102
- overflow-x: scroll;
103
- white-space: nowrap;
104
- }
105
-
106
- p.code{
107
- border:1px solid #000000;
108
- overflow-x:scroll;
109
- white-space: pre;
110
- font-family:monospace,monospace;
111
- font-size:1em;
112
- background-color:#f5f5f5;
113
- padding:2em;
114
- }
115
-
116
- </style>
117
- </head>
118
-
119
- <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" media="screen">
120
-
121
-
122
- <body>
123
- <nav class="navbar navbar-default navbar-static-top" role="navigation">
124
- <div class="container">
125
- <div class="collapse navbar-collapse">
126
- <ul class="nav navbar-nav">
127
- <li><a class="navbar-brand" href="#"><%= @filename%></a></li>
128
- </ul>
129
- </div>
130
- </div>
131
- </nav>
132
- <div id="side-panel" class="panel panel-default">
133
- <a href="index.html" class="list-group-item list-group-item-info">INDEX</a>
134
- </div>
135
- <div id="panels-wrapper">
136
- <% for @borg in @collective %>
137
- <div class="panel panel-primary">
138
- <% for @attribute in @borg %>
139
- <% if @attribute[0] == "TITLE" %>
140
- <div class="panel-heading" id="<%= @attribute[1]%>">
141
- <h2 class="panel-title"><%= @attribute[1] %></h2>
142
- </div>
143
- <div class="panel-body">
144
- <% end %>
145
- <% if @attribute[0] == "CODE" %>
146
- <h4>CODE</h4>
147
- <p class="code"><%= @attribute[1] %></p>
148
- <% end %>
149
- <% if @attribute[0] != "TITLE" && @attribute[0] != "CODE" %>
150
- <% if @attribute[1].class == Hash %>
151
- <% if @attribute[0] == "ANCHOR" %>
152
- <h4><%= @attribute[0] %></h4>
153
- <table class="table">
154
- <% for @item in @attribute[1]%>
155
- <tr>
156
- <th><%= @item[0] %></th>
157
- <td><a href="<%= @item[1] %>"><%= @item[1] %></a></td>
158
- </tr>
159
- <% end %>
160
- </table>
161
- <% else %>
162
- <h4><%= @attribute[0] %></h4>
163
- <table class="table">
164
- <% for @item in @attribute[1]%>
165
- <tr>
166
- <th><%= @item[0] %></th>
167
- <td><%= @item[1] %></td>
168
- </tr>
169
- <% end %>
170
- </table>
171
- <% end %>
172
- <% end %>
173
- <% if @attribute[0] != "CODE" && @attribute[0] != "TITLE" && @attribute[1].class != Hash%>
174
- <h4><%= @attribute[0]%></h4>
175
- <p><%= @attribute[1] %></p>
176
- <% end %>
177
- <% end %>
178
- <% end %>
179
- </div>
180
- </div>
181
- <% end %>
182
- </div>
183
-
184
- <script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
185
- </body>
186
-
187
- </html>'
188
-
189
- renderer = ERB.new(template)
190
-
191
- page = @filename + ".html"
192
-
193
- File.open(page, "w+") do |f|
194
- f.write(renderer.result(binding))
70
+ temp_page = parse_file(path + '/' + f)
71
+ files_array.push(temp_page) unless temp_page.nil? || temp_page.is_empty == true
72
+
73
+ end
195
74
  end
196
75
 
197
- return page
76
+ files_array
198
77
 
199
78
  end
200
79
 
80
+ def parse_file(file)
81
+
82
+ if File.file?(file) && File.exist?(file) && !file.rindex('.', 0) && !unsupported_encoding(file) && !unsupported_extension(file)
83
+
84
+ page = Page.new(file)
85
+ page.parse_blocks
86
+
87
+ page
88
+
89
+ else
90
+ nil
91
+ end
92
+
93
+ end
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <style type="text/css">
5
+ #wrapper{
6
+ width: 70%;
7
+ padding-left: 30%;
8
+ font-size:2em;
9
+ }
10
+ </style>
11
+
12
+ <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" media="screen">
13
+
14
+ <body>
15
+ <div id="wrapper">
16
+ <div class="list-group">
17
+ <% for @page in @pages %>
18
+ <a href="<%= @page.name %>.html" class="list-group-item list-group-item-info"><%= @page.name %></a>
19
+
20
+ <% end %>
21
+ </div>
22
+ </div>
23
+ </body>
24
+
25
+ </html>
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+
7
+ <style type="text/css">
8
+ body{
9
+ }
10
+ #panels-wrapper{
11
+ width: 80%;
12
+ float: left;
13
+ padding-left: 10%;
14
+ }
15
+ #side-panel{
16
+ width: 15%;
17
+ float: left;
18
+ padding-left: 10px;
19
+ }
20
+ pre-scrollable{
21
+ overflow-x: scroll;
22
+ white-space: nowrap;
23
+ }
24
+
25
+ p.code{
26
+ border:1px solid #000000;
27
+ overflow-x:scroll;
28
+ white-space: pre;
29
+ font-family:monospace,monospace;
30
+ font-size:1em;
31
+ background-color:#f5f5f5;
32
+ padding:2em;
33
+ }
34
+
35
+ </style>
36
+ </head>
37
+
38
+ <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" media="screen">
39
+
40
+
41
+ <body>
42
+ <nav class="navbar navbar-default navbar-static-top" role="navigation">
43
+ <div class="container">
44
+ <div class="collapse navbar-collapse">
45
+ <ul class="nav navbar-nav">
46
+ <li><a class="navbar-brand" href="#"><%= @name%></a></li>
47
+ </ul>
48
+ </div>
49
+ </div>
50
+ </nav>
51
+ <div id="side-panel" class="panel panel-default">
52
+ <a href="index.html" class="list-group-item list-group-item-info">INDEX</a>
53
+ <% for @page in @index %>
54
+ <a class="list-group-item list-group-item-info" href="<%= @page %>.html"><%= @page %></a>
55
+ <% end %>
56
+ </div>
57
+ <div id="panels-wrapper">
58
+ <% for @block in @blocks %>
59
+ <div class="panel panel-primary">
60
+ <% @attributes = @block.attributes %>
61
+ <% for @attribute in @attributes %>
62
+ <% if @attribute[0] == "TITLE" %>
63
+ <div class="panel-heading" id="<%= @attribute[1]%>">
64
+ <h2 class="panel-title"><%= @attribute[1] %></h2>
65
+ </div>
66
+ <div class="panel-body">
67
+ <% end %>
68
+ <% if @attribute[0] == "CODE" %>
69
+ <h4>CODE</h4>
70
+ <p class="code"><%= @attribute[1] %></p>
71
+ <% end %>
72
+ <% if @attribute[0] != "TITLE" && @attribute[0] != "CODE" %>
73
+ <% if @attribute[1].class == Hash %>
74
+ <% if @attribute[0] == "ANCHOR" %>
75
+ <h4><%= @attribute[0] %></h4>
76
+ <table class="table">
77
+ <% for @item in @attribute[1]%>
78
+ <tr>
79
+ <th><%= @item[0] %></th>
80
+ <td><a href="<%= @item[1] %>"><%= @item[1] %></a></td>
81
+ </tr>
82
+ <% end %>
83
+ </table>
84
+ <% else %>
85
+ <h4><%= @attribute[0] %></h4>
86
+ <table class="table">
87
+ <% for @item in @attribute[1]%>
88
+ <tr>
89
+ <th><%= @item[0] %></th>
90
+ <td><%= @item[1] %></td>
91
+ </tr>
92
+ <% end %>
93
+ </table>
94
+ <% end %>
95
+ <% end %>
96
+ <% if @attribute[0] != "CODE" && @attribute[0] != "TITLE" && @attribute[1].class != Hash%>
97
+ <h4><%= @attribute[0]%></h4>
98
+ <p><%= @attribute[1] %></p>
99
+ <% end %>
100
+ <% end %>
101
+ <% end %>
102
+ </div>
103
+ </div>
104
+ <% end %>
105
+ </div>
106
+
107
+ <script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
108
+ </body>
109
+
110
+ </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bailey Belvis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-10 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem to support easy documentation for any file that recognizes `/*
14
14
  */` as a code block. This gem lets you easily parse multiple files in a directory
@@ -22,7 +22,11 @@ extra_rdoc_files: []
22
22
  files:
23
23
  - bin/docme
24
24
  - lib/docme.rb
25
+ - lib/docme/block.rb
26
+ - lib/docme/page.rb
25
27
  - lib/docme/utils.rb
28
+ - lib/templates/index.erb
29
+ - lib/templates/page.erb
26
30
  homepage: https://github.com/philosowaffle/docme
27
31
  licenses:
28
32
  - Mozilla Public License