codnar 0.1.74 → 0.1.76
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +8 -0
- data/codnar.html +24 -1
- data/lib/codnar/haddock.rb +8 -0
- data/lib/codnar/version.rb +1 -1
- metadata +5 -5
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
2012-04-13 Oren Ben-Kiki <github-oren@ben-kiki.org>
|
2
|
+
|
3
|
+
* Handle Haddock structured module comments.
|
4
|
+
|
5
|
+
2012-03-25 Oren Ben-Kiki <github-oren@ben-kiki.org>
|
6
|
+
|
7
|
+
* Get rid of more Rake
|
8
|
+
|
1
9
|
2012-03-18 Oren Ben-Kiki <github-oren@ben-kiki.org>
|
2
10
|
|
3
11
|
* Upgrade for latest gems.
|
data/codnar.html
CHANGED
@@ -683,7 +683,7 @@ number of Git commits by running <code>rake version</code>.
|
|
683
683
|
</tr>
|
684
684
|
</table>
|
685
685
|
<pre class='ruby code syntax'>
|
686
|
-
<span class="Type">VERSION</span> = <span class="Special">"</span><span class="Constant">0.1.
|
686
|
+
<span class="Type">VERSION</span> = <span class="Special">"</span><span class="Constant">0.1.76</span><span class="Special">"</span>
|
687
687
|
|
688
688
|
end
|
689
689
|
</pre>
|
@@ -3494,10 +3494,33 @@ run Haddock to generate HTML from it.
|
|
3494
3494
|
<span class="PreProc">def</span> <span class="Constant">self</span>.<span class="Identifier">write_temporary_file</span>(path, haddock)
|
3495
3495
|
<span class="Type">File</span>.open(path + <span class="Special">"</span><span class="Constant">/wrapper.hs</span><span class="Special">"</span>, <span class="Special">"</span><span class="Constant">w</span><span class="Special">"</span>) <span class="Statement">do</span> |<span class="Identifier">file</span>|
|
3496
3496
|
file.write(<span class="Type">HADDOCK_HEADER</span>)
|
3497
|
+
haddock = <span class="Constant">self</span>.patch_module_comments(haddock)
|
3497
3498
|
file.write(<span class="Special">"</span><span class="Constant">-- </span><span class="Special">"</span> + haddock.gsub(<span class="Special">"</span><span class="Special">\n</span><span class="Special">"</span>, <span class="Special">"</span><span class="Special">\n</span><span class="Constant">-- </span><span class="Special">"</span>))
|
3498
3499
|
<span class="Statement">end</span>
|
3499
3500
|
<span class="PreProc">end</span>
|
3500
3501
|
|
3502
|
+
</pre>
|
3503
|
+
<table class='layout'>
|
3504
|
+
<tr>
|
3505
|
+
<td class='indentation'>
|
3506
|
+
<pre> </pre>
|
3507
|
+
</td>
|
3508
|
+
<td class='html'>
|
3509
|
+
<div class='rdoc comment markup'>
|
3510
|
+
<p>
|
3511
|
+
Convert structured module comments to a definition list. TODO: This is
|
3512
|
+
rather flaky.
|
3513
|
+
</p>
|
3514
|
+
</div>
|
3515
|
+
</td>
|
3516
|
+
</tr>
|
3517
|
+
</table>
|
3518
|
+
<pre class='ruby code syntax'>
|
3519
|
+
<span class="PreProc">def</span> <span class="Constant">self</span>.<span class="Identifier">patch_module_comments</span>(haddock)
|
3520
|
+
haddock.sub!(<span class="Special">/</span><span class="Special">^</span><span class="Special">\s</span><span class="Special">*</span><span class="Constant">Module</span><span class="Special">\s</span><span class="Special">*</span><span class="Constant">:</span><span class="Special">\s</span><span class="Special">*</span><span class="Special">\$</span><span class="Special">\s</span><span class="Special">*</span><span class="Constant">header</span><span class="Special">\s</span><span class="Special">*</span><span class="Special">\$</span><span class="Special">\s</span><span class="Special">*</span><span class="Special">$</span><span class="Special">/i</span>, <span class="Special">"</span><span class="Constant">Module</span><span class="Special">"</span>)
|
3521
|
+
<span class="Statement">return</span> haddock.gsub(<span class="Special">/</span><span class="Special">^</span><span class="Special">(</span><span class="Special">\s</span><span class="Special">*</span><span class="Special">)(</span><span class="Constant">Module</span><span class="Special">|</span><span class="Constant">Description</span><span class="Special">|</span><span class="Constant">Copyright</span><span class="Special">|</span><span class="Constant">License</span><span class="Special">|</span><span class="Constant">Maintainer</span><span class="Special">|</span><span class="Constant">Stability</span><span class="Special">|</span><span class="Constant">Portability</span><span class="Special">)(</span><span class="Special">\s</span><span class="Special">*</span><span class="Special">)</span><span class="Constant">:</span><span class="Special">/</span>, <span class="Special">"</span><span class="Special">\n\\</span><span class="Constant">1[@</span><span class="Special">\\</span><span class="Constant">2@]</span><span class="Special">\\</span><span class="Constant">3</span><span class="Special">"</span>)
|
3522
|
+
<span class="PreProc">end</span>
|
3523
|
+
|
3501
3524
|
</pre>
|
3502
3525
|
<table class='layout'>
|
3503
3526
|
<tr>
|
data/lib/codnar/haddock.rb
CHANGED
@@ -45,10 +45,18 @@ module Codnar
|
|
45
45
|
def self.write_temporary_file(path, haddock)
|
46
46
|
File.open(path + "/wrapper.hs", "w") do |file|
|
47
47
|
file.write(HADDOCK_HEADER)
|
48
|
+
haddock = self.patch_module_comments(haddock)
|
48
49
|
file.write("-- " + haddock.gsub("\n", "\n-- "))
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
53
|
+
# Convert structured module comments to a definition list. TODO: This is
|
54
|
+
# rather flaky.
|
55
|
+
def self.patch_module_comments(haddock)
|
56
|
+
haddock.sub!(/^\s*Module\s*:\s*\$\s*header\s*\$\s*$/i, "Module")
|
57
|
+
return haddock.gsub(/^(\s*)(Module|Description|Copyright|License|Maintainer|Stability|Portability)(\s*):/, "\n\\1[@\\2@]\\3")
|
58
|
+
end
|
59
|
+
|
52
60
|
# Run Haddock to convert the wrapper Haskell file into HTML documentation.
|
53
61
|
def self.run_haddock(path)
|
54
62
|
system("cd #{path} && haddock --html wrapper.hs > haddock.out 2>&1")
|
data/lib/codnar/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codnar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 131
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 76
|
10
|
+
version: 0.1.76
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Oren Ben-Kiki
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-04-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: andand
|
@@ -323,7 +323,7 @@ licenses: []
|
|
323
323
|
post_install_message:
|
324
324
|
rdoc_options:
|
325
325
|
- --title
|
326
|
-
- Code Narrator 0.1.
|
326
|
+
- Code Narrator 0.1.76
|
327
327
|
- --main
|
328
328
|
- README.rdoc
|
329
329
|
- --line-numbers
|