mook 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,10 +6,8 @@ module Mook
6
6
 
7
7
  def initialize(opts)
8
8
  super(opts)
9
- @toc = ""
10
9
  @toc_id = 0
11
- @toc_last_level = 0
12
- @toc_closed = false
10
+ @toc = []
13
11
  end
14
12
 
15
13
  def block_code(code, language)
@@ -33,30 +31,14 @@ module Mook
33
31
  id = if tag then tag else "toc_#{@toc_id}" end
34
32
 
35
33
  link = "<a href=\"##{id}\">#{text}</a>"
36
-
37
- if @toc_last_level <= 0
38
- @toc << "<li>#{link}"
39
- else
40
- if @toc_last_level == header_level
41
- @toc << "</li><li>#{link}"
42
- elsif @toc_last_level < header_level
43
- @toc << "<ul><li>#{link}"
44
- else
45
- @toc << "</ul><li>#{link}"
46
- end
47
- end
48
-
49
- @toc_last_level = header_level
34
+
35
+ @toc << "#{" " * (header_level - 1)}* #{link}"
50
36
 
51
37
  "<a name=\"#{id}\"></a><h#{header_level}>#{text}</h#{header_level}>"
52
38
  end
53
39
 
54
40
  def toc
55
- unless @toc_closed
56
- @toc = "<ul>#{@toc}</li></ul>"
57
- @toc_closed = true
58
- end
59
- @toc
41
+ @toc.join("\n")
60
42
  end
61
43
  end
62
44
  end
@@ -20,7 +20,7 @@ module Mook
20
20
  md = Redcarpet::Markdown.new(renderer, MARKDOWN_OPTIONS)
21
21
 
22
22
  page.content = md.render(page.markdown)
23
- page.toc = renderer.toc
23
+ page.toc = md.render(renderer.toc)
24
24
 
25
25
  template = ERB.new(File.read(File.join("templates", page.template)))
26
26
  model = Model.new(@site, page)
@@ -1,3 +1,3 @@
1
1
  module Mook
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mook
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Coda Hale
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-04 00:00:00 -08:00
18
+ date: 2012-02-07 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency