docubot 0.0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/docubot +83 -14
- data/lib/docubot.rb +33 -10
- data/lib/docubot/bundle.rb +68 -0
- data/lib/docubot/converter.rb +13 -9
- data/lib/docubot/converters/haml.rb +9 -0
- data/lib/docubot/converters/html.rb +5 -0
- data/lib/docubot/converters/markdown.rb +12 -4
- data/lib/docubot/converters/raw_code.rb +5 -0
- data/lib/docubot/converters/textile.rb +10 -0
- data/lib/docubot/glossary.rb +44 -0
- data/lib/docubot/index.rb +66 -0
- data/lib/docubot/page.rb +142 -18
- data/lib/docubot/shells/default/0_License.md +60 -0
- data/lib/docubot/shells/default/Appendix/Glossary.md +5 -0
- data/lib/docubot/shells/default/Appendix/Index_Page.md +8 -0
- data/lib/docubot/shells/default/Appendix/Table of Contents.md +5 -0
- data/lib/docubot/shells/default/_static/logo.png +0 -0
- data/lib/docubot/shells/default/index.txt +3 -0
- data/lib/docubot/shells/docubot-help/0_License.md +21 -0
- data/lib/docubot/shells/docubot-help/1_Getting_Started.md +48 -0
- data/lib/docubot/templates/default/page.haml b/data/lib/docubot/shells/docubot-help/2_Basic_Concepts/0 The → Metasection.md +0 -0
- data/lib/docubot/shells/docubot-help/2_Basic_Concepts/1 Interpage Links.md +1 -0
- data/lib/docubot/shells/docubot-help/2_Basic_Concepts/2 Generating the Output.md +1 -0
- data/lib/docubot/shells/docubot-help/2_Basic_Concepts/3 Customizing Templates.md +1 -0
- data/lib/docubot/shells/docubot-help/2_Basic_Concepts/4 Adding Images.md +2 -0
- data/lib/docubot/shells/docubot-help/2_Basic_Concepts/index.md +6 -0
- data/lib/docubot/shells/docubot-help/3_Advanced_Topics/Controlling Glossary.md +3 -0
- data/lib/docubot/shells/docubot-help/3_Advanced_Topics/Controlling Indexing.md +10 -0
- data/lib/docubot/shells/docubot-help/3_Advanced_Topics/Controlling the Table of Contents.md +7 -0
- data/lib/docubot/shells/docubot-help/3_Advanced_Topics/Switching Page Templates.md +1 -0
- data/lib/docubot/shells/docubot-help/4_Appendix/Glossary.md +5 -0
- data/lib/docubot/shells/docubot-help/4_Appendix/Index_Page.md +6 -0
- data/lib/docubot/shells/docubot-help/4_Appendix/Table of Contents.md +7 -0
- data/lib/docubot/shells/docubot-help/_glossary/Template.md +1 -0
- data/lib/docubot/shells/docubot-help/_static/glider.png +0 -0
- data/lib/docubot/shells/docubot-help/index.txt +8 -0
- data/lib/docubot/shells/nvphysx/0_License.md +3 -0
- data/lib/docubot/shells/nvphysx/1_Getting_Started.haml +51 -0
- data/lib/docubot/shells/nvphysx/Appendix/Glossary.md +7 -0
- data/lib/docubot/shells/nvphysx/_glossary/APEX.md +1 -0
- data/lib/docubot/shells/nvphysx/_glossary/NVIDIA.md +1 -0
- data/lib/docubot/shells/nvphysx/_glossary/PhysX.textile +3 -0
- data/lib/docubot/shells/nvphysx/_static/NVBadge_3D.png +0 -0
- data/lib/docubot/shells/nvphysx/_static/PhysXbyNV_Black.png +0 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/bg_green_bar_revised.gif +0 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/close.png +0 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/common.css +264 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/glossary.css +4 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/glossary.js +24 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/nvdevtools.js +31 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/nvidia-logo.gif +0 -0
- data/lib/docubot/shells/nvphysx/_templates/_root/right-sidebar.png +0 -0
- data/lib/docubot/shells/nvphysx/_templates/top.haml +28 -0
- data/lib/docubot/shells/nvphysx/index.txt +5 -0
- data/lib/docubot/snippet.rb +4 -3
- data/lib/docubot/snippets/glossary.rb +6 -3
- data/lib/docubot/snippets/index_entries.rb +7 -0
- data/lib/docubot/templates/_root/common.css +107 -0
- data/lib/docubot/templates/_root/toc.css +5 -0
- data/lib/docubot/templates/_root/toc.js +4 -0
- data/lib/docubot/templates/glossary.haml +5 -0
- data/lib/docubot/templates/index.haml +14 -0
- data/lib/docubot/templates/page.haml +1 -0
- data/lib/docubot/templates/section.haml +10 -0
- data/lib/docubot/templates/toc.haml +10 -0
- data/lib/docubot/templates/top.haml +25 -0
- data/lib/docubot/writer.rb +24 -0
- data/lib/docubot/writers/chm.rb +73 -0
- data/lib/docubot/writers/chm/hhc.erb +27 -0
- data/lib/docubot/writers/chm/hhk.erb +28 -0
- data/lib/docubot/writers/chm/hhp.erb +23 -0
- data/lib/docubot/writers/html.rb +75 -0
- data/test/all.rb +2 -0
- data/test/site1/A Slight Change of Heart/3_more_crap.haml +17 -0
- data/test/site1/appendices/gkheadftw.html +2 -0
- data/test/site1/appendices/index.md +2 -0
- data/test/site1/preamble.haml +4 -0
- data/test/site1/raw.textile +10 -0
- metadata +88 -14
- data/lib/docubot/generator.rb +0 -35
- data/lib/docubot/section.rb +0 -16
- data/lib/docubot/template.rb +0 -13
- data/lib/docubot/templates/default/section.haml +0 -0
- data/test/site1/A Slight Change of Heart/3_more_crap.md +0 -5
- data/test/site1/raw.md +0 -3
@@ -0,0 +1,28 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
2
|
+
<HTML>
|
3
|
+
<HEAD>
|
4
|
+
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
|
5
|
+
<!-- Sitemap 1.0 -->
|
6
|
+
</HEAD><BODY>
|
7
|
+
<OBJECT type="text/site properties">
|
8
|
+
<param name="FrameName" value="right">
|
9
|
+
</OBJECT>
|
10
|
+
<UL>
|
11
|
+
<%@toc.index.each do |entry,pages|%>
|
12
|
+
<LI> <OBJECT type="text/sitemap">
|
13
|
+
<param name="Name" value="<%=entry%>">
|
14
|
+
<param name="Local" value="<%=FileUtils.win_path( @html_path/pages.first.html_path )%>">
|
15
|
+
</OBJECT>
|
16
|
+
<%unless pages.length==1%>
|
17
|
+
<UL>
|
18
|
+
<%pages.each do |page|%>
|
19
|
+
<LI> <OBJECT type="text/sitemap">
|
20
|
+
<param name="Name" value="<%=page.title%>">
|
21
|
+
<param name="Local" value="<%=FileUtils.win_path( @html_path/page.html_path )%>">
|
22
|
+
</OBJECT>
|
23
|
+
<%end%>
|
24
|
+
</UL>
|
25
|
+
<%end%>
|
26
|
+
<%end%>
|
27
|
+
</UL>
|
28
|
+
</BODY></HTML>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
[OPTIONS]
|
2
|
+
Compatibility=1.1 or later
|
3
|
+
Compiled file="<%=FileUtils.win_path @chm_path%>"
|
4
|
+
Contents file="<%=FileUtils.win_path @hhc%>"
|
5
|
+
Index file="<%=FileUtils.win_path @hhk%>"
|
6
|
+
<%if @default_topic%>Default topic=<%=FileUtils.win_path(File.basename(@html_path)/@default_topic.html_path)%>
|
7
|
+
<%end%>Display compile progress=No
|
8
|
+
Full-text search=Yes
|
9
|
+
Language=0x409 English (United States)
|
10
|
+
Title=<%=@toc.title%>
|
11
|
+
|
12
|
+
|
13
|
+
[FILES]
|
14
|
+
<%@toc.descendants.each do |page|
|
15
|
+
%><%=FileUtils.win_path( @html_path/page.html_path) %>
|
16
|
+
<%end
|
17
|
+
@bundle.extras.each do |file|
|
18
|
+
%><%=FileUtils.win_path @html_path/file%>
|
19
|
+
<%end%>
|
20
|
+
|
21
|
+
|
22
|
+
[INFOTYPES]
|
23
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
class DocuBot::HTMLWriter < DocuBot::Writer
|
2
|
+
handles_type :html
|
3
|
+
|
4
|
+
# Specify nil for destination to place "<source>_html" next to the source.
|
5
|
+
def write( destination=nil )
|
6
|
+
source = @bundle.source
|
7
|
+
@html_path = destination || File.dirname(source)/"#{File.basename source}_html"
|
8
|
+
FileUtils.rm_rf(@html_path) if File.exists?(@html_path)
|
9
|
+
FileUtils.mkdir(@html_path)
|
10
|
+
|
11
|
+
master_templates = DocuBot::TEMPLATE_DIR
|
12
|
+
source_templates = source/'_templates'
|
13
|
+
|
14
|
+
# Copy any files found in the source directory that weren't made into pages
|
15
|
+
@bundle.extras.each do |file|
|
16
|
+
FileUtils.mkdir_p( @html_path / File.dirname( file ) )
|
17
|
+
FileUtils.cp( source / file, @html_path / file )
|
18
|
+
end
|
19
|
+
|
20
|
+
# Copy files from template to root of destination
|
21
|
+
# Record these as extras so that the CHMWriter can access them
|
22
|
+
Dir.chdir @html_path do
|
23
|
+
existing_files = Dir[ '*' ]
|
24
|
+
FileUtils.copy( Dir[ master_templates/'_root'/'*' ], '.' )
|
25
|
+
FileUtils.copy( Dir[ source_templates/'_root'/'*' ], '.' )
|
26
|
+
new_files = Dir[ '*' ] - existing_files
|
27
|
+
@bundle.extras.concat( new_files )
|
28
|
+
end
|
29
|
+
|
30
|
+
Dir.chdir @html_path do
|
31
|
+
o = Object.new
|
32
|
+
|
33
|
+
# Write out every page
|
34
|
+
template = File.exists?( source_templates/'top.haml' ) ? source_templates/'top.haml' : master_templates/'top.haml'
|
35
|
+
template = Haml::Engine.new( IO.read( template ), HAML_OPTIONS )
|
36
|
+
@bundle.toc.descendants.each do |page|
|
37
|
+
next if page.sublink?
|
38
|
+
contents = page.to_html!
|
39
|
+
root = "../" * page.depth
|
40
|
+
html = template.render( o, :page=>page, :contents=>contents, :global=>@bundle.toc, :root=>root )
|
41
|
+
FileUtils.mkdir_p( File.dirname( page.html_path ) )
|
42
|
+
File.open( page.html_path, 'w' ){ |f| f << html }
|
43
|
+
end
|
44
|
+
|
45
|
+
# Write out the TOC and Index (even though the CHM won't use them, others may)
|
46
|
+
{ 'toc.haml'=>'_toc.html', 'index.haml'=>'_index.html' }.each do |haml,output|
|
47
|
+
File.open( output, 'w' ) do |f|
|
48
|
+
template = File.exists?( source_templates/haml ) ? source_templates/haml : master_templates/haml
|
49
|
+
template = Haml::Engine.new( IO.read( template ), HAML_OPTIONS )
|
50
|
+
f << template.render( o, :toc=>@bundle.toc, :global=>@bundle.toc, :root=>'' )
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
File.open( 'glossary-terms.js', 'w' ){ |f| f << @bundle.glossary.to_js }
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
module Haml::Helpers
|
61
|
+
def li_pages_for( page )
|
62
|
+
page.pages.each do |child|
|
63
|
+
haml_tag :li do
|
64
|
+
haml_tag :a, :href=>child.html_path do
|
65
|
+
haml_concat child.title
|
66
|
+
end
|
67
|
+
unless child.pages.empty?
|
68
|
+
haml_tag :ul do
|
69
|
+
li_pages_for child
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
data/test/all.rb
CHANGED
@@ -0,0 +1,17 @@
|
|
1
|
+
title : Additional Helpful Information
|
2
|
+
author : Gavin Kistner
|
3
|
+
date : 2010-1-4
|
4
|
+
toc : frist-post moar
|
5
|
+
+++
|
6
|
+
%h2#frist-post Title Verification
|
7
|
+
%p The title of this page should be "Additional Helpful Information", not "More Crap".
|
8
|
+
|
9
|
+
%h2#moar TOC Verification
|
10
|
+
:markdown
|
11
|
+
The TOC for this page should have sub-entries for the referenced headings.
|
12
|
+
|
13
|
+
* The links should be named for the headings.
|
14
|
+
* The links should link to the headings.
|
15
|
+
|
16
|
+
%h2#dumb Exclusivity
|
17
|
+
%p The TOC should not, however, have this last heading.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
This is a simple two paragraph page.
|
2
|
+
|
3
|
+
This is the second paragraph. Click on the $$foinkle$$ to start the fun.
|
4
|
+
|
5
|
+
IMPORTANT: READ THE FOLLOWING TERMS AND CONDITIONS BEFORE USING THE ACCOMPANYING NVIDIA PHYSX SDK.
|
6
|
+
BY CLICKING ON THE "ACCEPT” BUTTON, YOU ACKNOWLEDGE THAT YOU HAVE READ THIS AGREEMENT, UNDERSTAND IT AND AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, NVIDIA IS NOT WILLING TO LICENSE THE PHYSX SDK TO YOU. IF YOU DO NOT AGREE TO THESE TERMS, YOU MAY, WITHIN 15 DAYS, DESTROY THIS ENTIRE PRODUCT AND PROVIDE WRITTEN VERIFICATION OF DELETION OF ALL COPIES OF THE ENTIRE PRODUCT.
|
7
|
+
|
8
|
+
RedCloth's parser is said to "sexify" English apostrophes and quotation marks...what does it do for the '80s--which should curl to the _left_--I wonder?
|
9
|
+
|
10
|
+
A 2x4 is actually 1.5" x 3.5".
|
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.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Kistner
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-01-
|
13
|
+
date: 2010-01-14 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -33,33 +33,106 @@ dependencies:
|
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: "0"
|
35
35
|
version:
|
36
|
-
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: RedCloth
|
38
|
+
type: :runtime
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
description: DocuBot creates HTML or CHM documentation from a hierarchy of files, supporting markups like Markdown, Textile, and Haml.
|
37
47
|
email: gavin@phrogz.net
|
38
|
-
executables:
|
39
|
-
|
48
|
+
executables:
|
49
|
+
- docubot
|
40
50
|
extensions: []
|
41
51
|
|
42
52
|
extra_rdoc_files: []
|
43
53
|
|
44
54
|
files:
|
45
55
|
- bin/docubot
|
56
|
+
- lib/docubot/bundle.rb
|
46
57
|
- lib/docubot/converter.rb
|
58
|
+
- lib/docubot/converters/haml.rb
|
59
|
+
- lib/docubot/converters/html.rb
|
47
60
|
- lib/docubot/converters/markdown.rb
|
48
|
-
- lib/docubot/
|
61
|
+
- lib/docubot/converters/raw_code.rb
|
62
|
+
- lib/docubot/converters/textile.rb
|
63
|
+
- lib/docubot/glossary.rb
|
64
|
+
- lib/docubot/index.rb
|
49
65
|
- lib/docubot/page.rb
|
50
|
-
- lib/docubot/
|
66
|
+
- lib/docubot/shells/default/0_License.md
|
67
|
+
- lib/docubot/shells/default/Appendix/Glossary.md
|
68
|
+
- lib/docubot/shells/default/Appendix/Index_Page.md
|
69
|
+
- lib/docubot/shells/default/Appendix/Table of Contents.md
|
70
|
+
- lib/docubot/shells/default/index.txt
|
71
|
+
- lib/docubot/shells/default/_static/logo.png
|
72
|
+
- lib/docubot/shells/docubot-help/0_License.md
|
73
|
+
- lib/docubot/shells/docubot-help/1_Getting_Started.md
|
74
|
+
- lib/docubot/shells/docubot-help/2_Basic_Concepts/0 The Metasection.md
|
75
|
+
- lib/docubot/shells/docubot-help/2_Basic_Concepts/1 Interpage Links.md
|
76
|
+
- lib/docubot/shells/docubot-help/2_Basic_Concepts/2 Generating the Output.md
|
77
|
+
- lib/docubot/shells/docubot-help/2_Basic_Concepts/3 Customizing Templates.md
|
78
|
+
- lib/docubot/shells/docubot-help/2_Basic_Concepts/4 Adding Images.md
|
79
|
+
- lib/docubot/shells/docubot-help/2_Basic_Concepts/index.md
|
80
|
+
- lib/docubot/shells/docubot-help/3_Advanced_Topics/Controlling Glossary.md
|
81
|
+
- lib/docubot/shells/docubot-help/3_Advanced_Topics/Controlling Indexing.md
|
82
|
+
- lib/docubot/shells/docubot-help/3_Advanced_Topics/Controlling the Table of Contents.md
|
83
|
+
- lib/docubot/shells/docubot-help/3_Advanced_Topics/Switching Page Templates.md
|
84
|
+
- lib/docubot/shells/docubot-help/4_Appendix/Glossary.md
|
85
|
+
- lib/docubot/shells/docubot-help/4_Appendix/Index_Page.md
|
86
|
+
- lib/docubot/shells/docubot-help/4_Appendix/Table of Contents.md
|
87
|
+
- lib/docubot/shells/docubot-help/index.txt
|
88
|
+
- lib/docubot/shells/docubot-help/_glossary/Template.md
|
89
|
+
- lib/docubot/shells/docubot-help/_static/glider.png
|
90
|
+
- lib/docubot/shells/nvphysx/0_License.md
|
91
|
+
- lib/docubot/shells/nvphysx/1_Getting_Started.haml
|
92
|
+
- lib/docubot/shells/nvphysx/Appendix/Glossary.md
|
93
|
+
- lib/docubot/shells/nvphysx/index.txt
|
94
|
+
- lib/docubot/shells/nvphysx/_glossary/APEX.md
|
95
|
+
- lib/docubot/shells/nvphysx/_glossary/NVIDIA.md
|
96
|
+
- lib/docubot/shells/nvphysx/_glossary/PhysX.textile
|
97
|
+
- lib/docubot/shells/nvphysx/_static/NVBadge_3D.png
|
98
|
+
- lib/docubot/shells/nvphysx/_static/PhysXbyNV_Black.png
|
99
|
+
- lib/docubot/shells/nvphysx/_templates/top.haml
|
100
|
+
- lib/docubot/shells/nvphysx/_templates/_root/bg_green_bar_revised.gif
|
101
|
+
- lib/docubot/shells/nvphysx/_templates/_root/close.png
|
102
|
+
- lib/docubot/shells/nvphysx/_templates/_root/common.css
|
103
|
+
- lib/docubot/shells/nvphysx/_templates/_root/glossary.css
|
104
|
+
- lib/docubot/shells/nvphysx/_templates/_root/glossary.js
|
105
|
+
- lib/docubot/shells/nvphysx/_templates/_root/nvdevtools.js
|
106
|
+
- lib/docubot/shells/nvphysx/_templates/_root/nvidia-logo.gif
|
107
|
+
- lib/docubot/shells/nvphysx/_templates/_root/right-sidebar.png
|
51
108
|
- lib/docubot/snippet.rb
|
52
109
|
- lib/docubot/snippets/glossary.rb
|
53
|
-
- lib/docubot/
|
54
|
-
- lib/docubot/templates/
|
55
|
-
- lib/docubot/templates/
|
110
|
+
- lib/docubot/snippets/index_entries.rb
|
111
|
+
- lib/docubot/templates/glossary.haml
|
112
|
+
- lib/docubot/templates/index.haml
|
113
|
+
- lib/docubot/templates/page.haml
|
114
|
+
- lib/docubot/templates/section.haml
|
115
|
+
- lib/docubot/templates/toc.haml
|
116
|
+
- lib/docubot/templates/top.haml
|
117
|
+
- lib/docubot/templates/_root/common.css
|
118
|
+
- lib/docubot/templates/_root/toc.css
|
119
|
+
- lib/docubot/templates/_root/toc.js
|
120
|
+
- lib/docubot/writer.rb
|
121
|
+
- lib/docubot/writers/chm/hhc.erb
|
122
|
+
- lib/docubot/writers/chm/hhk.erb
|
123
|
+
- lib/docubot/writers/chm/hhp.erb
|
124
|
+
- lib/docubot/writers/chm.rb
|
125
|
+
- lib/docubot/writers/html.rb
|
56
126
|
- lib/docubot.rb
|
57
127
|
- test/all.rb
|
58
128
|
- test/site1/A Slight Change of Heart/1 Ze First Page in Ze Section.md
|
59
129
|
- test/site1/A Slight Change of Heart/2 Another Page in the Section.md
|
60
|
-
- test/site1/A Slight Change of Heart/3_more_crap.
|
130
|
+
- test/site1/A Slight Change of Heart/3_more_crap.haml
|
131
|
+
- test/site1/appendices/gkheadftw.html
|
132
|
+
- test/site1/appendices/index.md
|
61
133
|
- test/site1/headers.md
|
62
|
-
- test/site1/
|
134
|
+
- test/site1/preamble.haml
|
135
|
+
- test/site1/raw.textile
|
63
136
|
has_rdoc: true
|
64
137
|
homepage: http://github.com/Phrogz/docubot
|
65
138
|
licenses: []
|
@@ -85,10 +158,11 @@ requirements:
|
|
85
158
|
- Windows with HTML Help Workshop installed.
|
86
159
|
- BlueCloth gem for Markdown conversion.
|
87
160
|
- Haml gem for template interpretation.
|
88
|
-
|
161
|
+
- RedCloth gem for Textile conversion.
|
162
|
+
rubyforge_project:
|
89
163
|
rubygems_version: 1.3.5
|
90
164
|
signing_key:
|
91
165
|
specification_version: 3
|
92
|
-
summary: Create
|
166
|
+
summary: Create documentation from a hierarchy of text files.
|
93
167
|
test_files:
|
94
168
|
- test/all.rb
|
data/lib/docubot/generator.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
module DocuBot
|
2
|
-
GENERATOR_DEFAULTS = {
|
3
|
-
:template => 'default'
|
4
|
-
}
|
5
|
-
def self.generate( directory, options={} )
|
6
|
-
options = GENERATOR_DEFAULTS.merge( options )
|
7
|
-
|
8
|
-
if !File.exists?( directory )
|
9
|
-
raise "DocuBot cannot find directory #{File.expand_path(directory)}. Exiting."
|
10
|
-
end
|
11
|
-
|
12
|
-
use_template( options[:template] )
|
13
|
-
|
14
|
-
@toc = DocuBot::Section.new( 'Table of Contents' )
|
15
|
-
sections_by_path = {}
|
16
|
-
|
17
|
-
Dir[ File.join( directory, '**/*' ) ].each do |item|
|
18
|
-
parent = sections_by_path[ File.dirname( item ) ] || @toc
|
19
|
-
if File.directory?( item )
|
20
|
-
section = DocuBot::Section.new( DocuBot.name( item ) )
|
21
|
-
sections_by_path[ item ] = section
|
22
|
-
parent << section
|
23
|
-
else
|
24
|
-
parent << DocuBot::Page.from_file( item )
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
puts @toc
|
29
|
-
|
30
|
-
output = "#{directory}_html"
|
31
|
-
Dir.mkdir(output) unless File.exists?(output)
|
32
|
-
|
33
|
-
# TODO: CHM the results
|
34
|
-
end
|
35
|
-
end
|
data/lib/docubot/section.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
class DocuBot::Section
|
2
|
-
attr_reader :entries, :title
|
3
|
-
def initialize( title )
|
4
|
-
@entries = []
|
5
|
-
@title = title
|
6
|
-
end
|
7
|
-
def sub_sections
|
8
|
-
@entries.select{ |e| e.is_a?( DocuBot::Section ) }
|
9
|
-
end
|
10
|
-
def <<( entry )
|
11
|
-
@entries << entry
|
12
|
-
end
|
13
|
-
def to_s( depth=0 )
|
14
|
-
(["#{' '*depth}#@title"] + @entries.map{ |e| e.to_s(depth+1) }).join("\n")
|
15
|
-
end
|
16
|
-
end
|
data/lib/docubot/template.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module DocuBot
|
2
|
-
TEMPLATE_DIR = File.expand_path( File.join( DocuBot::DIR, 'docubot/templates' ) )
|
3
|
-
Dir.chdir TEMPLATE_DIR do
|
4
|
-
@available_templates = Dir[ '*' ]
|
5
|
-
end
|
6
|
-
def self.use_template( template_name )
|
7
|
-
@template = template_name
|
8
|
-
unless @available_templates.include?( template_name )
|
9
|
-
warn "No template named '#{template_name}' exists in #{TEMPLATE_DIR}; using 'default' instead."
|
10
|
-
use 'default' unless template_name=='default'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
File without changes
|
data/test/site1/raw.md
DELETED