webgen 1.0.0.beta3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +7 -0
  2. data/COPYING +23 -1
  3. data/Rakefile +16 -77
  4. data/VERSION +1 -1
  5. data/bin/webgen +0 -0
  6. data/data/webgen/basic_website_template/ext/init.rb +3 -1
  7. data/data/webgen/basic_website_template/src/.gitignore +0 -0
  8. data/data/webgen/basic_website_template/webgen.config +1 -1
  9. data/data/webgen/bundle_template_files/info.yaml.erb +14 -2
  10. data/data/webgen/passive_sources/default.metainfo +10 -0
  11. data/data/webgen/passive_sources/templates/api.template +16 -2
  12. data/data/webgen/passive_sources/templates/feed.template +5 -5
  13. data/data/webgen/passive_sources/templates/sitemap.template +1 -1
  14. data/data/webgen/passive_sources/templates/tag.template +8 -4
  15. data/lib/webgen/blackboard.rb +21 -5
  16. data/lib/webgen/bundle/built-in-show-changes/info.yaml +17 -0
  17. data/lib/webgen/bundle/built-in-show-changes/init.rb +4 -5
  18. data/lib/webgen/bundle/built-in/info.yaml +1064 -0
  19. data/lib/webgen/bundle/built-in/init.rb +103 -136
  20. data/lib/webgen/bundle_loader.rb +82 -9
  21. data/lib/webgen/cli.rb +12 -8
  22. data/lib/webgen/cli/commands/create.rb +27 -0
  23. data/lib/webgen/cli/{create_bundle_command.rb → commands/create_bundle.rb} +2 -2
  24. data/lib/webgen/cli/{create_command.rb → commands/create_website.rb} +2 -2
  25. data/lib/webgen/cli/commands/generate.rb +66 -0
  26. data/lib/webgen/cli/{install_bundle_command.rb → commands/install.rb} +1 -1
  27. data/lib/webgen/cli/{show_command.rb → commands/show.rb} +6 -4
  28. data/lib/webgen/cli/{list_bundle_command.rb → commands/show_bundles.rb} +12 -15
  29. data/lib/webgen/cli/{show_config_command.rb → commands/show_config.rb} +34 -6
  30. data/lib/webgen/cli/{show_dependencies_command.rb → commands/show_dependencies.rb} +0 -0
  31. data/lib/webgen/cli/{show_extensions_command.rb → commands/show_extensions.rb} +1 -13
  32. data/lib/webgen/cli/{show_tree_command.rb → commands/show_tree.rb} +3 -0
  33. data/lib/webgen/cli/utils.rb +1 -1
  34. data/lib/webgen/configuration.rb +9 -11
  35. data/lib/webgen/content_processor/html_head.rb +3 -4
  36. data/lib/webgen/content_processor/rainpress.rb +21 -0
  37. data/lib/webgen/content_processor/sass.rb +8 -8
  38. data/lib/webgen/content_processor/tikz.rb +59 -16
  39. data/lib/webgen/item_tracker.rb +33 -12
  40. data/lib/webgen/item_tracker/missing_node.rb +5 -5
  41. data/lib/webgen/item_tracker/template_chain.rb +52 -0
  42. data/lib/webgen/misc/dummy_index.rb +78 -0
  43. data/lib/webgen/node.rb +1 -1
  44. data/lib/webgen/node_finder.rb +86 -141
  45. data/lib/webgen/page.rb +5 -5
  46. data/lib/webgen/path.rb +4 -1
  47. data/lib/webgen/path_handler.rb +25 -21
  48. data/lib/webgen/path_handler/api.rb +36 -3
  49. data/lib/webgen/path_handler/base.rb +20 -4
  50. data/lib/webgen/path_handler/feed.rb +6 -2
  51. data/lib/webgen/path_handler/meta_info.rb +4 -2
  52. data/lib/webgen/path_handler/page.rb +5 -7
  53. data/lib/webgen/path_handler/sitemap.rb +6 -1
  54. data/lib/webgen/path_handler/virtual.rb +6 -8
  55. data/lib/webgen/source/file_system.rb +2 -2
  56. data/lib/webgen/tag.rb +22 -18
  57. data/lib/webgen/tag/menu.rb +5 -5
  58. data/lib/webgen/test_helper.rb +18 -18
  59. data/lib/webgen/utils/external_command.rb +1 -1
  60. data/lib/webgen/utils/tag_parser.rb +1 -1
  61. data/lib/webgen/vendor/rainpress.rb +168 -0
  62. data/lib/webgen/version.rb +1 -1
  63. data/lib/webgen/website.rb +10 -10
  64. data/man/man1/webgen.1 +54 -23
  65. data/test/test_documentation.rb +27 -4
  66. data/test/webgen/cli/test_logger.rb +1 -1
  67. data/test/webgen/content_processor/test_blocks.rb +1 -1
  68. data/test/webgen/content_processor/test_builder.rb +3 -2
  69. data/test/webgen/content_processor/test_erb.rb +1 -1
  70. data/test/webgen/content_processor/test_erubis.rb +2 -2
  71. data/test/webgen/content_processor/test_fragments.rb +1 -1
  72. data/test/webgen/content_processor/test_haml.rb +2 -2
  73. data/test/webgen/content_processor/test_html_head.rb +5 -1
  74. data/test/webgen/content_processor/test_kramdown.rb +2 -2
  75. data/test/webgen/content_processor/test_maruku.rb +2 -2
  76. data/test/webgen/content_processor/test_r_discount.rb +2 -2
  77. data/test/webgen/content_processor/test_r_doc.rb +1 -1
  78. data/test/webgen/content_processor/test_rainpress.rb +19 -0
  79. data/test/webgen/content_processor/test_red_cloth.rb +2 -2
  80. data/test/webgen/content_processor/test_ruby.rb +1 -1
  81. data/test/webgen/content_processor/test_sass.rb +8 -6
  82. data/test/webgen/content_processor/test_scss.rb +3 -3
  83. data/test/webgen/content_processor/test_tags.rb +1 -1
  84. data/test/webgen/content_processor/test_tidy.rb +9 -1
  85. data/test/webgen/content_processor/test_tikz.rb +6 -3
  86. data/test/webgen/content_processor/test_xmllint.rb +9 -2
  87. data/test/webgen/destination/test_file_system.rb +4 -4
  88. data/test/webgen/item_tracker/test_file.rb +1 -1
  89. data/test/webgen/item_tracker/test_missing_node.rb +1 -1
  90. data/test/webgen/item_tracker/test_node_content.rb +1 -1
  91. data/test/webgen/item_tracker/test_node_meta_info.rb +1 -1
  92. data/test/webgen/item_tracker/test_nodes.rb +2 -4
  93. data/test/webgen/item_tracker/test_template_chain.rb +36 -0
  94. data/test/webgen/misc/test_dummy_index.rb +83 -0
  95. data/test/webgen/path_handler/test_api.rb +6 -46
  96. data/test/webgen/path_handler/test_base.rb +3 -2
  97. data/test/webgen/path_handler/test_copy.rb +1 -1
  98. data/test/webgen/path_handler/test_feed.rb +3 -4
  99. data/test/webgen/path_handler/test_meta_info.rb +1 -1
  100. data/test/webgen/path_handler/test_page.rb +1 -1
  101. data/test/webgen/path_handler/test_page_utils.rb +1 -1
  102. data/test/webgen/path_handler/test_sitemap.rb +3 -5
  103. data/test/webgen/path_handler/test_template.rb +1 -1
  104. data/test/webgen/path_handler/test_virtual.rb +1 -3
  105. data/test/webgen/source/test_file_system.rb +9 -4
  106. data/test/webgen/source/test_stacked.rb +1 -1
  107. data/test/webgen/source/test_tar_archive.rb +2 -2
  108. data/test/webgen/tag/test_breadcrumb_trail.rb +1 -1
  109. data/test/webgen/tag/test_coderay.rb +3 -2
  110. data/test/webgen/tag/test_date.rb +1 -1
  111. data/test/webgen/tag/test_execute_command.rb +1 -1
  112. data/test/webgen/tag/test_include_file.rb +1 -1
  113. data/test/webgen/tag/test_langbar.rb +1 -1
  114. data/test/webgen/tag/test_link.rb +1 -1
  115. data/test/webgen/tag/test_menu.rb +12 -30
  116. data/test/webgen/tag/test_meta_info.rb +1 -1
  117. data/test/webgen/tag/test_relocatable.rb +1 -1
  118. data/test/webgen/tag/test_tikz.rb +3 -2
  119. data/test/webgen/task/test_create_website.rb +2 -2
  120. data/test/webgen/test_blackboard.rb +11 -3
  121. data/test/webgen/test_bundle_loader.rb +26 -9
  122. data/test/webgen/test_cache.rb +1 -1
  123. data/test/webgen/test_cli.rb +2 -2
  124. data/test/webgen/test_configuration.rb +8 -9
  125. data/test/webgen/test_content_processor.rb +1 -1
  126. data/test/webgen/test_context.rb +1 -1
  127. data/test/webgen/test_core_ext.rb +1 -1
  128. data/test/webgen/test_destination.rb +1 -1
  129. data/test/webgen/test_error.rb +5 -5
  130. data/test/webgen/test_extension_manager.rb +1 -1
  131. data/test/webgen/test_item_tracker.rb +26 -5
  132. data/test/webgen/test_languages.rb +1 -1
  133. data/test/webgen/test_logger.rb +1 -1
  134. data/test/webgen/test_node.rb +1 -1
  135. data/test/webgen/test_node_finder.rb +2 -2
  136. data/test/webgen/test_page.rb +5 -5
  137. data/test/webgen/test_path.rb +8 -8
  138. data/test/webgen/test_rake_task.rb +1 -1
  139. data/test/webgen/test_source.rb +1 -1
  140. data/test/webgen/test_tag.rb +16 -24
  141. data/test/webgen/test_task.rb +1 -1
  142. data/test/webgen/test_tree.rb +1 -1
  143. data/test/webgen/test_utils.rb +1 -1
  144. data/test/webgen/test_website.rb +1 -1
  145. data/test/webgen/utils/test_tag_parser.rb +1 -1
  146. metadata +85 -105
  147. data/lib/webgen/cli/bundle_command.rb +0 -30
  148. data/lib/webgen/cli/generate_command.rb +0 -25
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bc28598716d6dbfc5755161abde547978815a8fb
4
+ data.tar.gz: 9fcab153b65bfcb25fe189174e292591153944fb
5
+ SHA512:
6
+ metadata.gz: a8819bc56874a30b1d5c0b63bb7f65a7fe8a104c8c8ed7c2b659db128d600a9ffd66d3e821e476b4c29775596678f83aafaf3025dee52ec715a966184cfbad50
7
+ data.tar.gz: e0a3b69860bdcf22c5b654f0c37529543acc7137ba5a6d5841c10fc56b10da308160451d38b4b397d22e82710b28da39deec537c7e5109db4207f2045bc33eeb
data/COPYING CHANGED
@@ -15,9 +15,31 @@ You should have received a copy of the GNU General Public License
15
15
  along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
 
18
- The webgen distribution contains some data files that have a different
18
+ The webgen distribution contains some files that have a different
19
19
  license. These files/directories are listed here:
20
20
 
21
+ lib/webgen/vendor/rainpress.rb:
22
+ Copyright (c) 2007-2008 Uwe L. Korn
23
+
24
+ Permission is hereby granted, free of charge, to any person obtaining
25
+ a copy of this software and associated documentation files (the
26
+ "Software"), to deal in the Software without restriction, including
27
+ without limitation the rights to use, copy, modify, merge, publish,
28
+ distribute, sublicense, and/or sell copies of the Software, and to
29
+ permit persons to whom the Software is furnished to do so, subject to
30
+ the following conditions:
31
+
32
+ The above copyright notice and this permission notice shall be
33
+ included in all copies or substantial portions of the Software.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
37
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
38
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
39
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
40
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
41
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42
+
21
43
  data/webgen/passive_sources/stylesheets/coderay-default.css:
22
44
  This file has been generated with the coderay_stylesheet binary and
23
45
  falls under the LGPL.
data/Rakefile CHANGED
@@ -16,9 +16,7 @@ require 'rake/testtask'
16
16
  require 'rake/packagetask'
17
17
 
18
18
  $:.unshift('lib')
19
- require 'webgen/rake_task'
20
19
  require 'webgen/version'
21
- require 'webgen/page'
22
20
 
23
21
  # End user tasks ###############################################################
24
22
 
@@ -35,32 +33,8 @@ task :clobber do
35
33
  ruby "setup.rb clean"
36
34
  end
37
35
 
38
- desc "Build the whole user documentation"
39
- task :doc => [:rdoc, :htmldoc]
40
-
41
- desc "Generate the HTML documentation"
42
- Webgen::RakeTask.new('htmldoc') do |site|
43
- site.clobber_outdir = true
44
- site.config_block = lambda do |config|
45
- config['sources'] = [['/', "Webgen::Source::FileSystem", 'doc'],
46
- ['/', "Webgen::Source::FileSystem", 'misc', 'default.*'],
47
- ['/', "Webgen::Source::FileSystem", 'misc', 'htmldoc.metainfo'],
48
- ['/', "Webgen::Source::FileSystem", 'misc', 'htmldoc.virtual'],
49
- ['/', "Webgen::Source::FileSystem", 'misc', 'images/**/*']]
50
- prefix = "webgen-website-bundle-"
51
- config['resources'].select {|name, data| name =~ /^#{prefix}style/}.each do |name, data|
52
- config['sources'] <<
53
- ["/references/website_styles/#{name.sub(prefix, '')}/", "Webgen::Source::FileSystem", 'misc', 'style.page']
54
- config['sources'] <<
55
- ["/references/website_styles/#{name.sub(prefix, '')}/", 'Webgen::Source::Resource', name, '/src/**', '/src/']
56
- end
57
- config['output'] = ['Webgen::Output::FileSystem', 'htmldoc']
58
- config.default_processing_pipeline('Page' => 'erb,tags,kramdown,blocks,fragments')
59
- end
60
- end
61
-
62
36
  RDoc::Task.new do |rdoc|
63
- rdoc.rdoc_dir = 'htmldoc/rdoc'
37
+ rdoc.rdoc_dir = 'rdoc'
64
38
  rdoc.title = 'webgen'
65
39
  rdoc.main = 'API.rdoc'
66
40
  rdoc.options << '--line-numbers'
@@ -68,7 +42,7 @@ RDoc::Task.new do |rdoc|
68
42
  end
69
43
 
70
44
  Rake::TestTask.new do |test|
71
- test.test_files = FileList['test/webgen/**/test_*.rb']
45
+ test.test_files = FileList['test/**/test_*.rb']
72
46
  end
73
47
 
74
48
  # Release tasks and development tasks ############################################
@@ -83,12 +57,6 @@ dynamic content like menus on the fly and comes with many powerful
83
57
  extensions.
84
58
  EOF
85
59
 
86
- begin
87
- REL_PAGE = Webgen::Page.from_data(File.read('website/src/news/release_' + Webgen::VERSION.split('.').join('_') + '.page'))
88
- rescue
89
- puts 'NO RELEASE NOTES/CHANGES FILE'
90
- end
91
-
92
60
  PKG_FILES = FileList.new([
93
61
  'Rakefile',
94
62
  'setup.rb',
@@ -101,12 +69,11 @@ EOF
101
69
  'README.md',
102
70
  'bin/webgen',
103
71
  'data/**/*',
104
- 'lib/**/*.rb',
72
+ 'data/**/.gitignore',
73
+ 'lib/**/*',
105
74
  'man/man1/webgen.1',
106
75
  'test/**/*',
107
- ]) do |fl|
108
- fl.exclude('**/.gitignore')
109
- end
76
+ ])
110
77
 
111
78
  CLOBBER << "VERSION"
112
79
  file 'VERSION' do
@@ -127,14 +94,15 @@ EOF
127
94
  s.version = Webgen::VERSION
128
95
  s.summary = SUMMARY
129
96
  s.description = DESCRIPTION
97
+ s.license = 'GPL'
130
98
  s.post_install_message = <<EOF
131
99
 
132
100
  Thanks for choosing webgen! Here are some places to get you started:
133
- * The webgen User Documentation at <http://webgen.rubyforge.org/documentation/index.html>
101
+ * The webgen User Documentation at <http://webgen.rubyforge.org/documentation/>
134
102
  * The mailing list archive at <http://rubyforge.org/pipermail/webgen-users/>
135
103
  * The webgen Wiki at <http://github.com/gettalong/webgen/wiki>
136
104
 
137
- Have a look at <http://webgen.rubyforge.org/> for a list of changes!
105
+ Have a look at <http://webgen.rubyforge.org/news.html> for a list of changes!
138
106
 
139
107
  Have fun!
140
108
 
@@ -142,12 +110,13 @@ EOF
142
110
 
143
111
  #### Dependencies, requirements and files
144
112
 
145
- s.required_ruby_version = '>= 1.9.2'
113
+ s.required_ruby_version = '>= 1.9.3'
146
114
 
147
115
  s.add_dependency('cmdparse', '>= 2.0.5')
148
116
  s.add_dependency('systemu', '>= 2.5.0')
149
- s.add_dependency('kramdown', '>= 0.14.0')
117
+ s.add_dependency('kramdown', '~> 1.0')
150
118
  s.add_development_dependency('rake', '>= 0.8.3')
119
+ s.add_development_dependency('minitest', '>= 5.0.0')
151
120
  s.add_development_dependency('diff-lcs', '>= 1.1.0')
152
121
  s.add_development_dependency('rubyforge', '>= 2.0.2')
153
122
  s.add_development_dependency('maruku', '>= 0.6.0')
@@ -186,12 +155,7 @@ EOF
186
155
  end
187
156
 
188
157
  desc 'Release webgen version ' + Webgen::VERSION
189
- task :release => [:clobber, :package, :publish_files, :publish_doc, :website, :publish_website, :post_news]
190
-
191
- desc "Upload webgen documentation to Rubyforge homepage"
192
- task :publish_doc => [:doc] do
193
- sh "rsync -avc --delete htmldoc/ gettalong@rubyforge.org:/var/www/gforge-projects/webgen/documentation/#{(Webgen::VERSION.split('.')[0..-2] + ['x']).join('.')}"
194
- end
158
+ task :release => [:clobber, :package, :publish_files, :post_news]
195
159
 
196
160
  if defined? RubyForge
197
161
  desc "Upload the release to Rubyforge"
@@ -203,8 +167,8 @@ EOF
203
167
  rf.configure
204
168
  rf.login
205
169
 
206
- rf.userconfig["release_notes"] = REL_PAGE.blocks['notes'].content
207
- rf.userconfig["release_changes"] = REL_PAGE.blocks['changes'].content
170
+ rf.userconfig["release_notes"] = ""
171
+ rf.userconfig["release_changes"] = ""
208
172
  rf.userconfig["preformatted"] = false
209
173
 
210
174
  files = %w[.gem .tgz .zip].collect {|ext| "pkg/webgen-#{Webgen::VERSION}" + ext}
@@ -224,37 +188,12 @@ EOF
224
188
  rf.configure
225
189
  rf.login
226
190
 
227
- rf.post_news('webgen', "webgen #{Webgen::VERSION} released", REL_PAGE.blocks['notes'].content)
191
+ text = "Have a look at http://webgen.rubyforge.org/news.html for the release details!"
192
+ rf.post_news('webgen', "webgen #{Webgen::VERSION} released", text)
228
193
  puts "done"
229
194
  end
230
195
  end
231
196
 
232
- desc 'Generates the webgen website'
233
- Webgen::RakeTask.new(:website) do |site|
234
- site.directory = 'website'
235
- site.clobber_outdir = true
236
- site.config_block = lambda do |config|
237
- config['sources'] += [['/documentation/', 'Webgen::Source::FileSystem', '../doc'],
238
- ['/', "Webgen::Source::FileSystem", '../misc', 'default.less.css'],
239
- ['/documentation/', "Webgen::Source::FileSystem", '../misc', 'htmldoc.virtual'],
240
- ['/', "Webgen::Source::FileSystem", '../misc', 'images/**/*']]
241
- prefix = "webgen-website-bundle-"
242
- config['resources'].select {|name, data| name =~ /^#{prefix}style/}.each do |name, data|
243
- config['sources'] <<
244
- ["/documentation/references/website_styles/#{name.sub(prefix, '')}/", "Webgen::Source::FileSystem", '../misc', 'style.page']
245
- config['sources'] <<
246
- ["/documentation/references/website_styles/#{name.sub(prefix, '')}/", 'Webgen::Source::Resource', name, '/src/**', '/src/']
247
- end
248
- config.default_processing_pipeline('Page' => 'erb,tags,kramdown,blocks,fragments')
249
- end
250
- end
251
-
252
- desc "Upload the webgen website to Rubyforge"
253
- task :publish_website => ['rdoc', :website] do
254
- sh "rsync -avc --delete --exclude documentation/rdoc --exclude 'documentation/0.5.x' --exclude 'documentation/0.4.x' --exclude 'wiki' --exclude 'robots.txt' website/out/ gettalong@rubyforge.org:/var/www/gforge-projects/webgen/"
255
- sh "rsync -avc --delete htmldoc/rdoc/ gettalong@rubyforge.org:/var/www/gforge-projects/webgen/documentation/rdoc"
256
- end
257
-
258
197
 
259
198
  desc "Run the tests one by one to check for missing deps"
260
199
  task :test_isolated do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.beta2
1
+ 1.0.0
data/bin/webgen CHANGED
File without changes
@@ -8,7 +8,9 @@
8
8
  # directory in which it is!
9
9
  #
10
10
  # * For information on how to write extensions, have a look at the API
11
- # documentation of webgen at http://webgen.rubyforge.org/docs/api.
11
+ # documentation of webgen at
12
+ #
13
+ # http://webgen.rubyforge.org/documentation/reference/api/
12
14
  #
13
15
  # * Have a look at the API documentation of Webgen::BundlerLoader to see
14
16
  # what methods are available in init.rb files.
@@ -12,7 +12,7 @@
12
12
  # The available configuration options can be found on the homepage in the Configuration Option
13
13
  # Reference at
14
14
  #
15
- # http://webgen.rubyforge.org/documentation/references/configuration.html
15
+ # http://webgen.rubyforge.org/documentation/reference/configuration_options.html
16
16
  #
17
17
  # More info about YAML itself can be found at http://www.yaml.org/
18
18
  #####
@@ -5,8 +5,8 @@ version:
5
5
  license:
6
6
  homepage:
7
7
 
8
- # If extensions are defined, document them here like in the following
9
- # example (at least the summary key should be set):
8
+ # If extensions or configuration options are defined, document them here
9
+ # like in the following example (at least the summary key should be set):
10
10
  #
11
11
  # extensions:
12
12
  # content_processor.my_processor:
@@ -14,3 +14,15 @@ homepage:
14
14
  # super_duper:
15
15
  # summary: Provides some very super-duper things!!
16
16
  # author: Some One Else
17
+ #
18
+ # options:
19
+ # tag.my_processor.option:
20
+ # summary: Some description of the option here
21
+ # syntax: Syntax description of this option
22
+ # example:
23
+ # config: |
24
+ # tag.my_processor.option: some_value
25
+ # tag: |
26
+ # {my_tag: {option: some_value}}
27
+ #
28
+ # The options:*:example:tag key should only be used for tags!
@@ -35,3 +35,13 @@
35
35
 
36
36
  [/**/*.sass, /**/*.scss, /**/*.haml, /**/*.rdoc, /**/*.textile, /**/*.tikz]:
37
37
  handler: copy
38
+
39
+ /**/_*.sass:
40
+ handler: copy
41
+ pipeline: sass
42
+ no_output: true
43
+
44
+ /**/_*.scss:
45
+ handler: copy
46
+ pipeline: scss
47
+ no_output: true
@@ -1,5 +1,19 @@
1
- --- name:content pipeline:erb
2
- <% klass = context.node.node_info[:api_class_object] %>
1
+ --- name:content pipeline:ruby
2
+ rdoc_object = context.node.node_info[:rdoc_object]
3
+ if rdoc_object.kind_of?(::RDoc::ClassModule)
4
+ context.content = context.render_block(:name => 'klass', :node => 'current')
5
+ else
6
+ context.content = context.render_block(:name => 'page', :node => 'current')
7
+ end
8
+ --- name:page pipeline:erb
9
+ <% page = context.node.node_info[:rdoc_object] %>
10
+ <div class="api-documentation api-page">
11
+ <div class="description">
12
+ <%= page.description %>
13
+ </div>
14
+ </div>
15
+ --- name:klass pipeline:erb
16
+ <% klass = context.node.node_info[:rdoc_object] %>
3
17
  <div class="api-documentation api-<%= klass.type %>">
4
18
  <h1 class="<%= klass.type %>"><%= klass.type %> <%= klass.full_name %></h1>
5
19
 
@@ -9,7 +9,7 @@
9
9
  </author>
10
10
 
11
11
  <link href="<%= context.node.feed_link %>" rel="alternate" />
12
- <link href="<%= Webgen::Path.url(File.join(context.node['site_url'], context.node.dest_path), false) %>" rel="self" />
12
+ <link href="<%= context.node.url %>" rel="self" />
13
13
  <generator uri="http://webgen.rubyforge.org/" version="<%= Webgen::VERSION %>">
14
14
  webgen - Webgen::PathHandler::Feed
15
15
  </generator>
@@ -25,8 +25,8 @@
25
25
  <uri><%= h(entry['author_url']) %></uri>
26
26
  </author>
27
27
  <% end %>
28
- <link href="<%= Webgen::Path.url(File.join(context.node['site_url'], entry.dest_path), false) %>" rel="alternate" />
29
- <id><%= Webgen::Path.url(File.join(context.node['site_url'], entry.dest_path), false) %></id>
28
+ <link href="<%= entry.url %>" rel="alternate" />
29
+ <id><%= entry.url %></id>
30
30
  <updated><%= entry['modified_at'].xmlschema %></updated>
31
31
  <% if entry['created_at'].kind_of?(Time) %>
32
32
  <published><%= entry['created_at'].xmlschema %></published>
@@ -55,10 +55,10 @@
55
55
  <% context.node.feed_entries.flatten.each do |entry| %>
56
56
  <item>
57
57
  <title><%= h(entry['title']) %></title>
58
- <link><%= Webgen::Path.url(File.join(context.node['site_url'], entry.dest_path), false) %></link>
58
+ <link><%= entry.url %></link>
59
59
  <description><%= h(context.node.entry_content(entry)) %></description>
60
60
  <pubDate><%= entry['modified_at'].rfc822 %></pubDate>
61
- <guid isPermaLink="true"><%= Webgen::Path.url(File.join(context.node['site_url'], entry.dest_path), false) %></guid>
61
+ <guid isPermaLink="true"><%= entry.url %></guid>
62
62
  </item>
63
63
  <% end %>
64
64
 
@@ -5,7 +5,7 @@
5
5
  context.node.sitemap_entries.each do |item|
6
6
  %>
7
7
  <url>
8
- <loc><%= URI.escape(File.join(context.node['site_url'], item.dest_path)) %></loc>
8
+ <loc><%= URI.escape(item.url) %></loc>
9
9
  <lastmod><%= item['modified_at'].iso8601 %></lastmod>
10
10
  <changefreq><%= item['change_freq'] || context.node['default_change_freq'] %></changefreq>
11
11
  <% if priority = item['priority'] || context.node['default_priority'] %>
@@ -13,11 +13,15 @@ end.join(context[:config]['tag.breadcrumb_trail.separator'])
13
13
 
14
14
 
15
15
  --- name:tag.menu pipeline:ruby --------------------------------------------------------------------
16
+ start_tag = "<ul"
17
+ start_tag << " class=\"#{context[:config]['tag.menu.css_class']}\"" if context[:config]['tag.menu.css_class']
18
+ start_tag << ">"
19
+
16
20
  nested_list = lambda do |nodes, level|
17
- out = "<ul>"
21
+ out = (level == 1 ? start_tag.dup : "<ul>")
18
22
  nodes.each do |node, children|
19
23
  menu = (children ? nested_list.call(children, level + 1) : '')
20
- style, link = Webgen::Tag::Menu.menu_item_details(context.dest_node, node, context.content_node.lang, level, !children.nil?)
24
+ style, link = Webgen::Tag::Menu.menu_item_details(context.dest_node, node, context.content_node.lang, level, !children.nil?, context[:config])
21
25
  out << "<li #{style}>#{link}"
22
26
  out << menu
23
27
  out << "</li>"
@@ -28,10 +32,10 @@ end
28
32
 
29
33
  flat_list = lambda do |nodes, level|
30
34
  submenu = ''
31
- out = "<ul>"
35
+ out = (level == 1 ? start_tag.dup : "<ul>")
32
36
  nodes.each do |node, children|
33
37
  submenu << (children ? flat_list.call(children, level + 1) : '')
34
- style, link = Webgen::Tag::Menu.menu_item_details(context.dest_node, node, context.content_node.lang, level, !children.nil?)
38
+ style, link = Webgen::Tag::Menu.menu_item_details(context.dest_node, node, context.content_node.lang, level, !children.nil?, context[:config])
35
39
  out << "<li #{style}>#{link}</li>"
36
40
  end
37
41
  out << "</ul>" << submenu
@@ -13,16 +13,32 @@ module Webgen
13
13
  @listener = {}
14
14
  end
15
15
 
16
- # Add the given block as listener for the messages +msg_names+ (one message name or an array of
17
- # message names). If you want to be able to remove the block from being called by the blackboard
18
- # later, you have to provide a unique ID object!
19
- def add_listener(msg_names = nil, id = nil, &block)
16
+ # Add the given block as listener for the message +msg_name+.
17
+ #
18
+ # The +id+ parameter can be used to specify a string which uniquely identifies the listener.
19
+ #
20
+ # The +position+ parameter can be used to specify where the listener should be added. The keys
21
+ # :before and :after are recognized and must contain a valid listener ID. If no key is or an
22
+ # unknown ID is specified, the listener is added as last entry in the listener array.
23
+ def add_listener(msg_name, id = nil, position = {}, &block)
24
+ position = if position[:before]
25
+ (@listener[msg_name] || []).index {|id, obj| id == position[:before]}
26
+ elsif position[:after]
27
+ (pos = (@listener[msg_name] || []).index {|id, obj| id == position[:after]}) && pos + 1
28
+ end
29
+ insert_listener_at_position(msg_name, id, position || -1, &block)
30
+ end
31
+
32
+ # Insert the block as listener for +msg_name+ with the given +id+ at the +position+ in the
33
+ # listener array.
34
+ def insert_listener_at_position(msg_name, id, position, &block)
20
35
  if !block.nil?
21
- [msg_names].flatten.compact.each {|name| (@listener[name] ||= []) << [id, block]}
36
+ (@listener[msg_name] ||= []).insert(position, [id, block])
22
37
  else
23
38
  raise ArgumentError, "You have to provide a block"
24
39
  end
25
40
  end
41
+ private :insert_listener_at_position
26
42
 
27
43
  # Remove the blocks associated with the given ID from the dispatcher queues of the given message
28
44
  # names.
@@ -0,0 +1,17 @@
1
+ author: &author Thomas Leitner <t_leitner@gmx.at>
2
+ summary: Built-in webgen extension for showing destination path changes
3
+ description: |
4
+ This is an extension bundle that comes with webgen. It provides a means for
5
+ showing the changes that would be written to a destination path.
6
+
7
+ options:
8
+ destination.show_changes:
9
+ summary: |
10
+ Specifies whether changes to the content of destination paths should be shown in a diff-like
11
+ manner. This option combined with the website.dry_run configuration option allows one to
12
+ preview the changes that the invocation of webgen would do.
13
+ syntax: |
14
+ `true` or `false`
15
+ example:
16
+ config: |
17
+ destination.show_changes: true
@@ -2,15 +2,14 @@
2
2
  #
3
3
  # This file initializes the show-changes built-in extension.
4
4
 
5
- option('destination.show_changes', false,
6
- 'Show changes to destination paths') do |val|
5
+ option('destination.show_changes', false) do |val|
7
6
  raise "The value has to be 'true' or 'false'" unless val == true || val == false
8
7
  val
9
8
  end
10
9
 
11
10
  data = nil
12
11
 
13
- website.blackboard.add_listener(:before_node_written) do |node|
12
+ website.blackboard.add_listener(:before_node_written, 'destination.show_changes') do |node|
14
13
  next unless website.config['destination.show_changes'] && node.is_file? && !node['no_output']
15
14
  webgen_require('diff/lcs', 'diff-lcs')
16
15
  webgen_require('diff/lcs/hunk', 'diff-lcs')
@@ -21,13 +20,13 @@ website.blackboard.add_listener(:before_node_written) do |node|
21
20
  end
22
21
  end
23
22
 
24
- website.blackboard.add_listener(:after_node_written) do |node, content|
23
+ website.blackboard.add_listener(:after_node_written, 'destination.show_changes') do |node, content|
25
24
  next unless website.config['destination.show_changes'] && node.is_file? && !node['no_output']
26
25
  if data.nil?
27
26
  website.logger.info { "New destination path <#{node.dest_path}>" }
28
27
  next
29
28
  end
30
- new_data = (content.kind_of?(String) ? content : content.data)
29
+ new_data = (content.kind_of?(String) ? content : content.data).force_encoding('ASCII-8BIT')
31
30
 
32
31
  binary = data[0...4096]["\0"] || new_data[0..4096]["\0"]
33
32
  if binary