hanna-nouveau 0.3.0 → 0.4.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6c8a2e662bfa7585fb1fd1f3837824c02c11d9e
4
- data.tar.gz: be3233cfa1bbd708256b2f5c6b425db3d7721b5b
3
+ metadata.gz: d5ced1825c89f3942fad828e81c77faf431779eb
4
+ data.tar.gz: 699b6b1f76859328db25deefc220714d00aca96b
5
5
  SHA512:
6
- metadata.gz: 3203e0cd922812a11db23f2c55c656c29ef0424b59d6a1838d8effca6b8986355ba85eaedecb664b90df2a13fb5f4b6f1889f79ce66b777901eae25f7f677ad1
7
- data.tar.gz: 90ba1c6e40cbf9fdf31aef304e8b7eb4f30c4ddaa0812c4fddf0afada907a36f4848d434e27a1e1def9a72c218246f4598fa51f0df29bbe11a39ed2ea08077fe
6
+ metadata.gz: e1a6d6a77b822e044d6840bf2d21334617d77a2a3e17bc88e16f87f8168bbb15f104dbf34a194097dd6a0fe673bfd32126c265be81ec54b4919abd4e70d8fa2c
7
+ data.tar.gz: f832b5ab9f42e516627b5fdb6e8008a8732fc234a0891431a9cd445ef937bdfaefef6732b205a746d47590ae26d3e0cfb99d9b0c6c576cfdfb732212c0957756
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
1
  source "http://rubygems.org"
2
2
  gem 'rdoc', "~> 4.0"
3
3
  gem 'haml', "= 3.0.25"
4
+ gem 'parser'
@@ -79,3 +79,17 @@ library}[http://github.com/rdbi/rdbi/tree/master/Rakefile]:
79
79
  rdoc.rdoc_files.include('README*')
80
80
  rdoc.rdoc_files.include('lib/**/*.rb')
81
81
  end
82
+
83
+ == Modifications to RDoc
84
+
85
+ Hanna makes some small modifications to RDoc to generate more
86
+ friendly documentation. First, a real parser is used for all
87
+ verbatim sections, and any verbatim section that is valid ruby
88
+ code will be highlighted. This is different than the RDoc
89
+ default, which is to use a simple regexp with both false
90
+ positives and false negatives.
91
+
92
+ Second, label lists are marked using a table instead of a
93
+ description list, since it is very difficult to get visually
94
+ appealing styling for description lists without cutting
95
+ corners (like using fixed widths).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -16,6 +16,45 @@ require 'haml'
16
16
  require 'sass'
17
17
  require 'rdoc/rdoc'
18
18
  require 'rdoc/generator'
19
+ require 'parser/current'
20
+
21
+ class RDoc::Markup::ToHtml
22
+ LIST_TYPE_TO_HTML[:LABEL] = ['<table class="rdoc-list label-list"><tbody>', '</tbody></table>']
23
+ LIST_TYPE_TO_HTML[:NOTE] = ['<table class="rdoc-list note-list"><tbody>', '</tbody></table>']
24
+
25
+ def list_item_start(list_item, list_type)
26
+ case list_type
27
+ when :BULLET, :LALPHA, :NUMBER, :UALPHA then
28
+ "<li>"
29
+ when :LABEL, :NOTE then
30
+ "<tr><td class='label'>#{Array(list_item.label).map{|label| to_html(label)}.join("<br />")}</td><td>"
31
+ else
32
+ raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
33
+ end
34
+ end
35
+
36
+ def list_end_for(list_type)
37
+ case list_type
38
+ when :BULLET, :LALPHA, :NUMBER, :UALPHA then
39
+ "</li>"
40
+ when :LABEL, :NOTE then
41
+ "</td></tr>"
42
+ else
43
+ raise RDoc::Error, "Invalid list type: #{list_type.inspect}"
44
+ end
45
+ end
46
+
47
+ def parseable? text
48
+ parser = Parser::CurrentRuby.new
49
+ parser.diagnostics.consumer = lambda{|d|}
50
+ buffer = Parser::Source::Buffer.new('(string)')
51
+ buffer.source = text
52
+ parser.parse(buffer)
53
+ true
54
+ rescue
55
+ false
56
+ end
57
+ end
19
58
 
20
59
  class RDoc::Generator::Hanna
21
60
  STYLE = 'styles.sass'
@@ -258,6 +258,18 @@ div.header
258
258
  list-style: decimal
259
259
  li
260
260
  white-space: normal
261
+ table.rdoc-list
262
+ border-collapse: collapse
263
+ border-spacing: 0
264
+ tr
265
+ background-color: white
266
+ &:nth-child(2n)
267
+ background-color: #f8f8f8
268
+ td.label
269
+ font-weight: bold
270
+ td
271
+ border: 1px solid #ddd
272
+ padding: 6px 13px
261
273
 
262
274
  #method-list
263
275
  position: absolute
@@ -318,7 +330,7 @@ div.header
318
330
  color: #eeeeee
319
331
  background: $light_link
320
332
 
321
- #content .method .source pre
333
+ #content .method .source pre, #content pre.ruby, #methods .method .description pre.ruby
322
334
  background: #262626
323
335
  color: #ffdead
324
336
  margin: 1em
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanna-nouveau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-06-18 00:00:00.000000000 Z
14
+ date: 2014-08-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: haml
@@ -41,6 +41,20 @@ dependencies:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '4.0'
44
+ - !ruby/object:Gem::Dependency
45
+ name: parser
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '2.0'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '2.0'
44
58
  description: ''
45
59
  email: code@jeremyevans.net
46
60
  executables: []