docubot 0.4 → 0.5
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.
- data/lib/docubot.rb +1 -1
- data/lib/docubot/bundle.rb +14 -17
- data/lib/docubot/link_tree.rb +11 -9
- data/lib/docubot/page.rb +10 -1
- data/lib/docubot/shells/nvphysx/_templates/top.haml +1 -1
- data/lib/docubot/templates/top.haml +2 -2
- data/lib/docubot/writers/chm.rb +31 -22
- data/lib/docubot/writers/html.rb +1 -1
- data/spec/_helper.rb +1 -0
- data/spec/bundle.rb +10 -3
- data/spec/chm.rb +44 -0
- data/spec/page.rb +32 -2
- data/spec/samples/default_topic/Alpha.md +3 -0
- data/spec/samples/default_topic/Zeta.md +3 -0
- data/spec/samples/default_topic/index.txt +2 -0
- data/spec/samples/default_topic_2/Alpha Space.md +3 -0
- data/spec/samples/default_topic_2/Zeta.md +3 -0
- data/spec/samples/default_topic_2/index.txt +2 -0
- data/spec/samples/hierarchy/1/1.1/1.1.1/index.haml +1 -0
- data/spec/samples/hierarchy/1/1.1/1.1.1/page.haml +3 -0
- data/spec/samples/hierarchy/1/1.1/page.haml +3 -0
- data/spec/samples/hierarchy/1/page.haml +3 -0
- data/spec/samples/hierarchy/2/2.1/2.1.1/page.haml +3 -0
- data/spec/samples/hierarchy/2/2.1/index.haml +1 -0
- data/spec/samples/hierarchy/2/2.1/page.haml +3 -0
- data/spec/samples/hierarchy/2/page.haml +3 -0
- data/spec/samples/hierarchy/main.css +1 -0
- data/spec/samples/hierarchy/main.haml +1 -0
- data/spec/samples/hierarchy/toc.md +2 -0
- data/spec/samples/links/one two three.textile +1 -0
- data/spec/samples/links/sub2.md +1 -0
- data/spec/samples/templates/_templates/doubler.haml +1 -1
- data/spec/samples/titles/6.1 More.md b/data/spec/samples/titles/6.1 → More.md +0 -0
- data/spec/toc.rb +22 -0
- metadata +21 -1
data/lib/docubot.rb
CHANGED
data/lib/docubot/bundle.rb
CHANGED
|
@@ -20,7 +20,7 @@ class DocuBot::Bundle
|
|
|
20
20
|
Dir.chdir( @source ) do
|
|
21
21
|
# This might be nil; MetaSection.new is OK with that.
|
|
22
22
|
index_file = Dir[ *DocuBot::Converter.types.map{|t| "index.#{t}"} ][ 0 ]
|
|
23
|
-
@global = DocuBot::MetaSection.new( {}, index_file )
|
|
23
|
+
@global = DocuBot::MetaSection.new( {:title=>'DocuBot Documentation'}, index_file )
|
|
24
24
|
@global.glossary = @glossary
|
|
25
25
|
@global.index = @index
|
|
26
26
|
@global.toc = @toc
|
|
@@ -28,10 +28,12 @@ class DocuBot::Bundle
|
|
|
28
28
|
files_and_folders = Dir[ '**/*' ]
|
|
29
29
|
|
|
30
30
|
# index files are handled by Page.new for a directory; no sections for special folders (but process contents)
|
|
31
|
-
files_and_folders.reject!{ |path| name = File.basename( path ); name =~ /^(?:index\.[^.]
|
|
31
|
+
files_and_folders.reject!{ |path| name = File.basename( path ); name =~ /^(?:index\.[^.]+)$/ }
|
|
32
32
|
|
|
33
33
|
# All files in the _templates directory should be ignored
|
|
34
|
-
files_and_folders.reject!{ |f| f =~
|
|
34
|
+
files_and_folders.reject!{ |f| f =~ /(?:^|\/)_/ }
|
|
35
|
+
files_and_folders.concat Dir[ '_static/**/*' ]
|
|
36
|
+
files_and_folders.concat Dir[ '_glossary/**/*' ]
|
|
35
37
|
|
|
36
38
|
@global.ignore.as_list.each do |glob|
|
|
37
39
|
files_and_folders = files_and_folders - Dir[glob]
|
|
@@ -101,32 +103,27 @@ class DocuBot::Bundle
|
|
|
101
103
|
@file_links = Hash.new{ |h,k| h[k]=[] }
|
|
102
104
|
@broken_links = Hash.new{ |h,k| h[k]=[] }
|
|
103
105
|
|
|
104
|
-
page_by_html_path = {}
|
|
105
|
-
page_by_orig_path = {}
|
|
106
|
-
@pages.each do |page|
|
|
107
|
-
page_by_html_path[page.html_path] = page
|
|
108
|
-
page_by_orig_path[page.file] = page if page.file
|
|
109
|
-
end
|
|
110
|
-
|
|
111
106
|
Dir.chdir( @source ) do
|
|
112
107
|
@pages.each do |page|
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
# TODO: set the xpath to .//a/@href once this is fixed: http://github.com/tenderlove/nokogiri/issues/#issue/213
|
|
109
|
+
page.nokodoc.xpath('.//a').each do |a|
|
|
110
|
+
next unless href = a['href']
|
|
111
|
+
href = CGI.unescape(href)
|
|
115
112
|
if href=~%r{^[a-z]+://}i
|
|
116
113
|
@external_links[page] << href
|
|
117
114
|
else
|
|
118
|
-
id = href[/#[a-z][\w.:-]
|
|
119
|
-
file = href.sub(
|
|
115
|
+
id = href[/#([a-z][\w.:-]*)?/i]
|
|
116
|
+
file = href.sub(/#.*/,'')
|
|
120
117
|
path = file.empty? ? page.html_path : Pathname.new( File.dirname(page.html_path) / file ).cleanpath.to_s
|
|
121
|
-
if target
|
|
122
|
-
if !id || target.nokodoc.at_css(id)
|
|
118
|
+
if target=@page_by_html_path[path]
|
|
119
|
+
if !id || id == "#" || target.nokodoc.at_css(id)
|
|
123
120
|
@internal_links[page] << href
|
|
124
121
|
else
|
|
125
122
|
warn "Could not find internal link for #{id.inspect} on #{page.html_path.inspect}" if id
|
|
126
123
|
@broken_links[page] << href
|
|
127
124
|
end
|
|
128
125
|
else
|
|
129
|
-
if File.file?(path) &&
|
|
126
|
+
if File.file?(path) && !@page_by_file_path[path]
|
|
130
127
|
@file_links[page] << href
|
|
131
128
|
else
|
|
132
129
|
@broken_links[page] << href
|
data/lib/docubot/link_tree.rb
CHANGED
|
@@ -32,7 +32,7 @@ class DocuBot::LinkTree::Node
|
|
|
32
32
|
(File.dirname(link) / 'index.html')
|
|
33
33
|
end
|
|
34
34
|
#puts "Adding #{title.inspect} (#{link}) to hierarchy under #{parent_link}"
|
|
35
|
-
parent = descendants.find{ |
|
|
35
|
+
parent = descendants.find{ |n| n.link==parent_link } || self
|
|
36
36
|
parent << node
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -41,6 +41,10 @@ class DocuBot::LinkTree::Node
|
|
|
41
41
|
@children << node
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
+
def []( child_index )
|
|
45
|
+
@children[child_index]
|
|
46
|
+
end
|
|
47
|
+
|
|
44
48
|
def children( parent_link=nil, &block )
|
|
45
49
|
if parent_link
|
|
46
50
|
root = find( parent_link )
|
|
@@ -60,19 +64,17 @@ class DocuBot::LinkTree::Node
|
|
|
60
64
|
end
|
|
61
65
|
|
|
62
66
|
def depth
|
|
63
|
-
#
|
|
67
|
+
# Cached assuming no one is going to shuffle the nodes after placement
|
|
64
68
|
@depth ||= ancestors.length
|
|
65
69
|
end
|
|
66
70
|
|
|
67
|
-
def root
|
|
68
|
-
@root ||= "../" * (depth + ( leaf? ? 0 : 1 ))
|
|
69
|
-
end
|
|
70
|
-
|
|
71
71
|
def ancestors
|
|
72
|
-
|
|
72
|
+
# Cached assuming no one is going to shuffle the nodes after placement
|
|
73
|
+
return @ancestors if @ancestors
|
|
74
|
+
@ancestors = []
|
|
73
75
|
node = self
|
|
74
|
-
ancestors << node while node = node.parent
|
|
75
|
-
ancestors.reverse!
|
|
76
|
+
@ancestors << node while node = node.parent
|
|
77
|
+
@ancestors.reverse!
|
|
76
78
|
end
|
|
77
79
|
|
|
78
80
|
def to_s
|
data/lib/docubot/page.rb
CHANGED
|
@@ -7,9 +7,18 @@ class DocuBot::Page
|
|
|
7
7
|
|
|
8
8
|
attr_reader :type, :folder, :file, :meta, :nokodoc, :bundle
|
|
9
9
|
|
|
10
|
+
def self.title( source_path )
|
|
11
|
+
# File#basename might return the same string
|
|
12
|
+
title = File.basename( source_path ).dup
|
|
13
|
+
title.sub!(/\.[^.\s]+$/,'') unless File.directory?( source_path )
|
|
14
|
+
title.gsub!( '_', ' ' )
|
|
15
|
+
title.sub!( /^\d+\s/, '' )
|
|
16
|
+
title
|
|
17
|
+
end
|
|
18
|
+
|
|
10
19
|
def initialize( bundle, source_path, title=nil )
|
|
11
20
|
puts "#{self.class}.new( #{source_path.inspect}, #{title.inspect}, #{type.inspect} )" if $DEBUG
|
|
12
|
-
title ||=
|
|
21
|
+
title ||= self.class.title( source_path )
|
|
13
22
|
@bundle = bundle
|
|
14
23
|
@file = source_path
|
|
15
24
|
if File.directory?( @file )
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
%span.sep >
|
|
23
23
|
= page.title
|
|
24
24
|
%h1#title= page.title
|
|
25
|
-
- if page.author
|
|
25
|
+
- if page.author
|
|
26
26
|
#author= page.author
|
|
27
27
|
#pagebody
|
|
28
28
|
#glossary-box
|
|
29
29
|
#mainbody= contents
|
|
30
30
|
#pagefooter
|
|
31
|
-
Copyright ©#{Time.now.year}#{ " #{global.company}" if global.company
|
|
31
|
+
Copyright ©#{Time.now.year}#{ " #{global.company}" if global.company }.
|
|
32
32
|
All Rights Reserved.
|
data/lib/docubot/writers/chm.rb
CHANGED
|
@@ -5,13 +5,41 @@ class DocuBot::CHMWriter < DocuBot::HTMLWriter
|
|
|
5
5
|
handles_type :chm
|
|
6
6
|
|
|
7
7
|
SUPPORT = DocuBot::Writer::DIR / 'chm'
|
|
8
|
+
|
|
9
|
+
attr_reader :chm_path, :hhc, :hhp, :hhk, :default_topic
|
|
10
|
+
|
|
11
|
+
def initialize( bundle )
|
|
12
|
+
super
|
|
13
|
+
@toc = @bundle.toc
|
|
14
|
+
@global = @bundle.global
|
|
15
|
+
if @global.default
|
|
16
|
+
# User tried to specify the default page
|
|
17
|
+
@default_topic = @bundle.pages_by_title[ @global.default ].first
|
|
18
|
+
if @default_topic
|
|
19
|
+
if @default_topic.file =~ /\s/
|
|
20
|
+
warn "'#{@global.default}' cannot be the default CHM page; it has a space in the file name."
|
|
21
|
+
@default_topic = nil
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
warn "The requested default page '#{@global.default}' could not be found. (Did the title change?)"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
if @default_topic.nil?
|
|
28
|
+
@default_topic = @toc.descendants.find{ |node| node.link =~ /^\S+$/ }
|
|
29
|
+
@default_topic &&= @default_topic.page
|
|
30
|
+
end
|
|
31
|
+
warn "No default page is set, because no page has a path without spaces." unless @default_topic
|
|
32
|
+
|
|
33
|
+
end
|
|
8
34
|
|
|
9
35
|
def write( destination=nil )
|
|
10
36
|
super( nil )
|
|
37
|
+
|
|
11
38
|
lap = Time.now
|
|
12
|
-
@chm_path = destination || "#{@bundle.source}.chm"
|
|
13
|
-
@
|
|
14
|
-
@
|
|
39
|
+
@chm_path = File.expand_path( destination || "#{@bundle.source}.chm" )
|
|
40
|
+
@hhc = @chm_path.sub( /[^.]+$/, 'hhc' )
|
|
41
|
+
@hhp = @chm_path.sub( /[^.]+$/, 'hhp' )
|
|
42
|
+
@hhk = @chm_path.sub( /[^.]+$/, 'hhk' )
|
|
15
43
|
write_hhc
|
|
16
44
|
write_hhk
|
|
17
45
|
write_hhp
|
|
@@ -55,37 +83,18 @@ class DocuBot::CHMWriter < DocuBot::HTMLWriter
|
|
|
55
83
|
end
|
|
56
84
|
|
|
57
85
|
def write_hhc
|
|
58
|
-
@hhc = @chm_path.sub( /[^.]+$/, 'hhc' )
|
|
59
86
|
File.open( @hhc, 'w' ) do |f|
|
|
60
87
|
f << ERB.new( IO.read( SUPPORT / 'hhc.erb' ) ).result( binding )
|
|
61
88
|
end
|
|
62
89
|
end
|
|
63
90
|
|
|
64
91
|
def write_hhp
|
|
65
|
-
@hhp = @chm_path.sub( /[^.]+$/, 'hhp' )
|
|
66
|
-
|
|
67
|
-
if @global.default
|
|
68
|
-
# User tried to specify the default page
|
|
69
|
-
@default_topic = @bundle.pages_by_title[ @global.default ].first
|
|
70
|
-
if @default_topic
|
|
71
|
-
if @default_topic.file =~ /\s/
|
|
72
|
-
warn "'#{@toc.default}' cannot be the default CHM page; it has a space in the file name."
|
|
73
|
-
@default_topic = nil
|
|
74
|
-
end
|
|
75
|
-
else
|
|
76
|
-
warn "The requested default page '#{@global.default}' could not be found. (Did the title change?)"
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
@default_topic ||= @toc.descendants.find{ |node| node.link =~ /^\S+$/ }
|
|
80
|
-
warn "No default page is set, because no page has a path without spaces." unless @default_topic
|
|
81
|
-
|
|
82
92
|
File.open( @hhp, 'w' ) do |f|
|
|
83
93
|
f << ERB.new( IO.read( SUPPORT / 'hhp.erb' ) ).result( binding )
|
|
84
94
|
end
|
|
85
95
|
end
|
|
86
96
|
|
|
87
97
|
def write_hhk
|
|
88
|
-
@hhk = @chm_path.sub( /[^.]+$/, 'hhk' )
|
|
89
98
|
File.open( @hhk, 'w' ) do |f|
|
|
90
99
|
f << ERB.new( IO.read( SUPPORT / 'hhk.erb' ) ).result( binding )
|
|
91
100
|
end
|
data/lib/docubot/writers/html.rb
CHANGED
|
@@ -53,7 +53,7 @@ class DocuBot::HTMLWriter < DocuBot::Writer
|
|
|
53
53
|
:page => node.page,
|
|
54
54
|
:contents => contents,
|
|
55
55
|
:global => @bundle.global,
|
|
56
|
-
:root => node.root,
|
|
56
|
+
:root => node.page.root,
|
|
57
57
|
:breadcrumb => node.ancestors,
|
|
58
58
|
:custom_js => custom_js,
|
|
59
59
|
:custom_css => custom_css
|
data/spec/_helper.rb
CHANGED
data/spec/bundle.rb
CHANGED
|
@@ -109,6 +109,7 @@ describe "Gathering links" do
|
|
|
109
109
|
../root.html inner1.html ../sub2.html ../sub2/inner2.html
|
|
110
110
|
../sub1/index.html index.html
|
|
111
111
|
]
|
|
112
|
+
known_internal << "one two three.html"
|
|
112
113
|
all_internal = @bundle.internal_links.values.flatten
|
|
113
114
|
known_internal.each do |link|
|
|
114
115
|
all_internal.must_include link
|
|
@@ -122,6 +123,15 @@ describe "Gathering links" do
|
|
|
122
123
|
all_file_links.must_include link
|
|
123
124
|
end
|
|
124
125
|
end
|
|
126
|
+
|
|
127
|
+
it "should identify valid links to internal files at the root" do
|
|
128
|
+
@bundle = DocuBot::Bundle.new SAMPLES/'hierarchy'
|
|
129
|
+
known_file_links = %w[ main.css ../main.css ../../main.css ../../../main.css ]
|
|
130
|
+
all_file_links = @bundle.file_links.values.flatten
|
|
131
|
+
known_file_links.each do |link|
|
|
132
|
+
all_file_links.must_include link
|
|
133
|
+
end
|
|
134
|
+
end
|
|
125
135
|
|
|
126
136
|
it "should identify and warn about invalid sub-page anchors" do
|
|
127
137
|
known_broken = %w[ #GORKBO ../root.html#GORKBO ]
|
|
@@ -327,7 +337,4 @@ describe "Page attributes" do
|
|
|
327
337
|
end
|
|
328
338
|
end
|
|
329
339
|
|
|
330
|
-
it "does something" do
|
|
331
|
-
|
|
332
|
-
end
|
|
333
340
|
end
|
data/spec/chm.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#encoding: UTF-8
|
|
2
|
+
require File.join(File.dirname(__FILE__), "_helper")
|
|
3
|
+
|
|
4
|
+
describe "CHM Writer default topic" do
|
|
5
|
+
it "should pick the first valid page as the default if not specified" do
|
|
6
|
+
out, err = capture_io do
|
|
7
|
+
@bundle = DocuBot::Bundle.new( SAMPLES/'titles' )
|
|
8
|
+
@writer = DocuBot::CHMWriter.new( @bundle )
|
|
9
|
+
end
|
|
10
|
+
@writer.default_topic.must_be_kind_of DocuBot::Page
|
|
11
|
+
# The page 'First One' can't be used as a default because it has a space in the file name
|
|
12
|
+
@writer.default_topic.must_equal @bundle.pages.find{ |page| page.title=='Second One' }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should use a valid specified default page" do
|
|
16
|
+
out, err = capture_io do
|
|
17
|
+
@bundle = DocuBot::Bundle.new( SAMPLES/'default_topic' )
|
|
18
|
+
@writer = DocuBot::CHMWriter.new( @bundle )
|
|
19
|
+
end
|
|
20
|
+
@writer.default_topic.must_be_kind_of DocuBot::Page
|
|
21
|
+
@writer.default_topic.must_equal @bundle.pages.find{ |page| page.title=='Awesomesauce' }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should warn about an invalid default topic" do
|
|
25
|
+
out, err = capture_io do
|
|
26
|
+
@bundle = DocuBot::Bundle.new( SAMPLES/'attributes' )
|
|
27
|
+
@writer = DocuBot::CHMWriter.new( @bundle )
|
|
28
|
+
end
|
|
29
|
+
err.must_include "All About Mr. Friggles"
|
|
30
|
+
@writer.default_topic.must_be_kind_of DocuBot::Page
|
|
31
|
+
@writer.default_topic.must_equal @bundle.pages.find{ |page| page.title=='defaults' }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should warn about a default topic with space in the file name" do
|
|
35
|
+
out, err = capture_io do
|
|
36
|
+
@bundle = DocuBot::Bundle.new( SAMPLES/'default_topic_2' )
|
|
37
|
+
@writer = DocuBot::CHMWriter.new( @bundle )
|
|
38
|
+
end
|
|
39
|
+
err.must_include "Excellence"
|
|
40
|
+
@writer.default_topic.must_be_kind_of DocuBot::Page
|
|
41
|
+
@writer.default_topic.must_equal @bundle.pages.find{ |page| page.title=='Awesomesauce' }
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
data/spec/page.rb
CHANGED
|
@@ -10,7 +10,7 @@ describe "Validating page titles" do
|
|
|
10
10
|
@toc.children.each{ |node| node.page.bundle.must_equal @bundle }
|
|
11
11
|
end
|
|
12
12
|
it "ignores leading numbers for the titles (unless all numbers)" do
|
|
13
|
-
@toc.children.each{ |node| node.page.title.must_match /(?:^\D|^\d
|
|
13
|
+
@toc.children.each{ |node| node.page.title.must_match /(?:^\D|^\d+$|^\d+(?:.\d+)+.*$)/ }
|
|
14
14
|
end
|
|
15
15
|
it "honors pages specifying their title" do
|
|
16
16
|
@toc.children.find{ |page| page.title =~ /renamed/i }.must_be_nil
|
|
@@ -24,6 +24,10 @@ describe "Validating page titles" do
|
|
|
24
24
|
it "doesn't change names of files that are all numbers" do
|
|
25
25
|
@toc.children.find{ |node| node.page.title == '911' }.wont_be_nil
|
|
26
26
|
end
|
|
27
|
+
it "doesn't change names of files that lead with dotted numerics" do
|
|
28
|
+
@toc.children.find{ |node| node.page.title == '6.1 More' }.wont_be_nil
|
|
29
|
+
@toc.children.find{ |node| node.page.title == '6.2 Even More' }.wont_be_nil
|
|
30
|
+
end
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
describe "Traversing page hierarchy" do
|
|
@@ -34,7 +38,7 @@ describe "Traversing page hierarchy" do
|
|
|
34
38
|
end
|
|
35
39
|
it "should have #pages returning an array" do
|
|
36
40
|
@bundle.pages.must_be_kind_of Array
|
|
37
|
-
@bundle.pages.length.must_equal
|
|
41
|
+
@bundle.pages.length.must_equal 7
|
|
38
42
|
end
|
|
39
43
|
it "every item should be a Page" do
|
|
40
44
|
@bundle.pages.each do |page|
|
|
@@ -43,6 +47,32 @@ describe "Traversing page hierarchy" do
|
|
|
43
47
|
end
|
|
44
48
|
end
|
|
45
49
|
|
|
50
|
+
describe "Page Roots" do
|
|
51
|
+
before do
|
|
52
|
+
@out, @err = capture_io do
|
|
53
|
+
@bundle = DocuBot::Bundle.new( SAMPLES/'hierarchy' )
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "should not find any missing links creating the bundle" do
|
|
58
|
+
# The bundle uses root in the page templates extensively
|
|
59
|
+
@err.must_be_empty
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "should have an empty root for pages at the root" do
|
|
63
|
+
@bundle.page_by_html_path['main.html'].root.must_equal ""
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should have a root appropriate to the HTML depth" do
|
|
67
|
+
@bundle.page_by_html_path['1/page.html'].root.must_equal "../"
|
|
68
|
+
@bundle.page_by_html_path['1/index.html'].root.must_equal "../"
|
|
69
|
+
@bundle.page_by_html_path['1/1.1/page.html'].root.must_equal "../../"
|
|
70
|
+
@bundle.page_by_html_path['1/1.1/index.html'].root.must_equal "../../"
|
|
71
|
+
@bundle.page_by_html_path['1/1.1/1.1.1/page.html'].root.must_equal "../../../"
|
|
72
|
+
@bundle.page_by_html_path['1/1.1/1.1.1/index.html'].root.must_equal "../../../"
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
46
76
|
describe "Testing user variables" do
|
|
47
77
|
it "should identify if a variable has been defined"
|
|
48
78
|
it "should inherit variables from the global"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%a(href="#{root}main.css") Linked
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%a(href="#{root}main.css") Linked
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
body { background:red }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%a(href="#{root}main.css") Linked
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
one two three
|
data/spec/samples/links/sub2.md
CHANGED
|
File without changes
|
data/spec/toc.rb
CHANGED
|
@@ -104,4 +104,26 @@ describe "Sub-page Links in the Table of Contents" do
|
|
|
104
104
|
kid.link.must_equal 'explicit2.html#h0'
|
|
105
105
|
kid.page.must_equal e2.page
|
|
106
106
|
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
describe "ToC with Deep Hierarchy" do
|
|
110
|
+
before do
|
|
111
|
+
@bundle = DocuBot::Bundle.new SAMPLES/'hierarchy'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it "should match the expected hierarchy" do
|
|
115
|
+
@bundle.toc[0].page.title.must_equal '1'
|
|
116
|
+
@bundle.toc[0][0].page.title.must_equal '1.1'
|
|
117
|
+
@bundle.toc[0][0][0].page.title.must_equal '1.1.1'
|
|
118
|
+
@bundle.toc[0][0][0][0].page.title.must_equal '1.1.1p'
|
|
119
|
+
@bundle.toc[0][0][1].page.title.must_equal '1.1p'
|
|
120
|
+
@bundle.toc[0][1].page.title.must_equal '1p'
|
|
121
|
+
@bundle.toc[1].page.title.must_equal '2'
|
|
122
|
+
@bundle.toc[1][0].page.title.must_equal '2.1'
|
|
123
|
+
@bundle.toc[1][0][0].page.title.must_equal '2.1.1'
|
|
124
|
+
@bundle.toc[1][0][0][0].page.title.must_equal '2.1.1p'
|
|
125
|
+
@bundle.toc[1][0][1].page.title.must_equal '2.1p'
|
|
126
|
+
@bundle.toc[1][1].page.title.must_equal '2p'
|
|
127
|
+
@bundle.toc[2].page.title.must_equal 'main'
|
|
128
|
+
end
|
|
107
129
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docubot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: "0.
|
|
4
|
+
version: "0.5"
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gavin Kistner
|
|
@@ -150,6 +150,7 @@ files:
|
|
|
150
150
|
- lib/docubot/writers/html.rb
|
|
151
151
|
- lib/docubot.rb
|
|
152
152
|
- spec/bundle.rb
|
|
153
|
+
- spec/chm.rb
|
|
153
154
|
- spec/command.rb
|
|
154
155
|
- spec/converters.rb
|
|
155
156
|
- spec/global.rb
|
|
@@ -168,6 +169,12 @@ files:
|
|
|
168
169
|
- spec/samples/collisions/page2.txt
|
|
169
170
|
- spec/samples/collisions/page3.bin
|
|
170
171
|
- spec/samples/collisions/page3.md
|
|
172
|
+
- spec/samples/default_topic/Alpha.md
|
|
173
|
+
- spec/samples/default_topic/index.txt
|
|
174
|
+
- spec/samples/default_topic/Zeta.md
|
|
175
|
+
- spec/samples/default_topic_2/Alpha Space.md
|
|
176
|
+
- spec/samples/default_topic_2/index.txt
|
|
177
|
+
- spec/samples/default_topic_2/Zeta.md
|
|
171
178
|
- spec/samples/files/another.md
|
|
172
179
|
- spec/samples/files/BUILDING.txt
|
|
173
180
|
- spec/samples/files/common.css
|
|
@@ -187,7 +194,19 @@ files:
|
|
|
187
194
|
- spec/samples/glossary/_glossary/complex.haml
|
|
188
195
|
- spec/samples/glossary/_glossary/project_x.md
|
|
189
196
|
- spec/samples/glossary/_glossary/Simple Term.md
|
|
197
|
+
- spec/samples/hierarchy/1/1.1/1.1.1/index.haml
|
|
198
|
+
- spec/samples/hierarchy/1/1.1/1.1.1/page.haml
|
|
199
|
+
- spec/samples/hierarchy/1/1.1/page.haml
|
|
200
|
+
- spec/samples/hierarchy/1/page.haml
|
|
201
|
+
- spec/samples/hierarchy/2/2.1/2.1.1/page.haml
|
|
202
|
+
- spec/samples/hierarchy/2/2.1/index.haml
|
|
203
|
+
- spec/samples/hierarchy/2/2.1/page.haml
|
|
204
|
+
- spec/samples/hierarchy/2/page.haml
|
|
205
|
+
- spec/samples/hierarchy/main.css
|
|
206
|
+
- spec/samples/hierarchy/main.haml
|
|
207
|
+
- spec/samples/hierarchy/toc.md
|
|
190
208
|
- spec/samples/links/index.txt
|
|
209
|
+
- spec/samples/links/one two three.textile
|
|
191
210
|
- spec/samples/links/root.md
|
|
192
211
|
- spec/samples/links/sub1/inner1.md
|
|
193
212
|
- spec/samples/links/sub2/bozo.bin
|
|
@@ -211,6 +230,7 @@ files:
|
|
|
211
230
|
- spec/samples/titles/3_renamed.txt
|
|
212
231
|
- spec/samples/titles/4 Fourth_One.txt
|
|
213
232
|
- spec/samples/titles/5_Fifth One.txt
|
|
233
|
+
- spec/samples/titles/6.1 More.md
|
|
214
234
|
- spec/samples/titles/911.txt
|
|
215
235
|
- spec/samples/titles/index.txt
|
|
216
236
|
- spec/templates.rb
|