nanoc3 3.0.9 → 3.1.0a1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. data/LICENSE +1 -1
  2. data/NEWS.md +360 -0
  3. data/README.md +85 -0
  4. data/Rakefile +2 -2
  5. data/bin/nanoc3 +0 -4
  6. data/lib/nanoc3/base/code_snippet.rb +14 -6
  7. data/lib/nanoc3/base/compiler.rb +68 -49
  8. data/lib/nanoc3/base/compiler_dsl.rb +70 -29
  9. data/lib/nanoc3/base/context.rb +47 -0
  10. data/lib/nanoc3/base/core_ext/array.rb +4 -0
  11. data/lib/nanoc3/base/core_ext/hash.rb +5 -1
  12. data/lib/nanoc3/base/core_ext/string.rb +2 -0
  13. data/lib/nanoc3/base/data_source.rb +132 -96
  14. data/lib/nanoc3/base/dependency_tracker.rb +160 -185
  15. data/lib/nanoc3/base/directed_graph.rb +252 -0
  16. data/lib/nanoc3/base/errors.rb +52 -4
  17. data/lib/nanoc3/base/filter.rb +43 -28
  18. data/lib/nanoc3/base/item.rb +93 -25
  19. data/lib/nanoc3/base/item_rep.rb +166 -55
  20. data/lib/nanoc3/base/layout.rb +16 -13
  21. data/lib/nanoc3/base/notification_center.rb +28 -12
  22. data/lib/nanoc3/base/plugin_registry.rb +158 -0
  23. data/lib/nanoc3/base/rule.rb +27 -8
  24. data/lib/nanoc3/base/rule_context.rb +59 -46
  25. data/lib/nanoc3/base/site.rb +124 -77
  26. data/lib/nanoc3/base.rb +7 -2
  27. data/lib/nanoc3/cli/base.rb +4 -1
  28. data/lib/nanoc3/cli/commands/autocompile.rb +5 -4
  29. data/lib/nanoc3/cli/commands/compile.rb +28 -7
  30. data/lib/nanoc3/cli/commands/create_item.rb +1 -1
  31. data/lib/nanoc3/cli/commands/create_layout.rb +1 -1
  32. data/lib/nanoc3/cli/commands/create_site.rb +46 -22
  33. data/lib/nanoc3/cli/commands/debug.rb +100 -0
  34. data/lib/nanoc3/cli/commands/help.rb +1 -1
  35. data/lib/nanoc3/cli/commands/info.rb +1 -1
  36. data/lib/nanoc3/cli/commands/view.rb +85 -0
  37. data/lib/nanoc3/cli/commands.rb +2 -0
  38. data/lib/nanoc3/cli/logger.rb +7 -0
  39. data/lib/nanoc3/cli.rb +0 -3
  40. data/lib/nanoc3/data_sources/{delicious.rb → deprecated/delicious.rb} +1 -24
  41. data/lib/nanoc3/data_sources/{last_fm.rb → deprecated/last_fm.rb} +1 -27
  42. data/lib/nanoc3/data_sources/{twitter.rb → deprecated/twitter.rb} +1 -14
  43. data/lib/nanoc3/data_sources/filesystem.rb +188 -176
  44. data/lib/nanoc3/data_sources/filesystem_unified.rb +107 -0
  45. data/lib/nanoc3/data_sources/filesystem_verbose.rb +80 -0
  46. data/lib/nanoc3/data_sources.rb +18 -9
  47. data/lib/nanoc3/extra/core_ext/enumerable.rb +39 -0
  48. data/lib/nanoc3/extra/core_ext/time.rb +2 -2
  49. data/lib/nanoc3/extra/core_ext.rb +1 -0
  50. data/lib/nanoc3/extra/deployers/rsync.rb +49 -3
  51. data/lib/nanoc3/extra/file_proxy.rb +7 -0
  52. data/lib/nanoc3/extra/vcs.rb +25 -24
  53. data/lib/nanoc3/extra/vcses/bazaar.rb +4 -0
  54. data/lib/nanoc3/extra/vcses/dummy.rb +4 -0
  55. data/lib/nanoc3/extra/vcses/git.rb +4 -0
  56. data/lib/nanoc3/extra/vcses/mercurial.rb +4 -0
  57. data/lib/nanoc3/extra/vcses/subversion.rb +4 -0
  58. data/lib/nanoc3/extra.rb +4 -1
  59. data/lib/nanoc3/filters/erb.rb +1 -1
  60. data/lib/nanoc3/filters/erubis.rb +1 -1
  61. data/lib/nanoc3/filters/haml.rb +1 -1
  62. data/lib/nanoc3/filters/kramdown.rb +14 -0
  63. data/lib/nanoc3/filters/maruku.rb +1 -1
  64. data/lib/nanoc3/filters/rainpress.rb +1 -1
  65. data/lib/nanoc3/filters/rdiscount.rb +3 -1
  66. data/lib/nanoc3/filters.rb +2 -0
  67. data/lib/nanoc3/helpers/blogging.rb +91 -75
  68. data/lib/nanoc3/helpers/breadcrumbs.rb +18 -10
  69. data/lib/nanoc3/helpers/capturing.rb +24 -29
  70. data/lib/nanoc3/helpers/filtering.rb +20 -17
  71. data/lib/nanoc3/helpers/html_escape.rb +7 -4
  72. data/lib/nanoc3/helpers/link_to.rb +51 -41
  73. data/lib/nanoc3/helpers/rendering.rb +15 -8
  74. data/lib/nanoc3/helpers/tagging.rb +27 -21
  75. data/lib/nanoc3/helpers/text.rb +12 -8
  76. data/lib/nanoc3/helpers/xml_sitemap.rb +13 -15
  77. data/lib/nanoc3/tasks/deploy/rsync.rake +4 -1
  78. data/lib/nanoc3/tasks.rb +2 -1
  79. data/lib/nanoc3.rb +24 -1
  80. metadata +43 -87
  81. data/NEWS.rdoc +0 -328
  82. data/README.rdoc +0 -83
  83. data/lib/nanoc3/base/plugin.rb +0 -88
  84. data/lib/nanoc3/base/preprocessor_context.rb +0 -37
  85. data/lib/nanoc3/data_sources/filesystem_combined.rb +0 -214
  86. data/lib/nanoc3/data_sources/filesystem_common.rb +0 -22
  87. data/lib/nanoc3/data_sources/filesystem_compact.rb +0 -256
  88. data/lib/nanoc3/extra/context.rb +0 -24
  89. data/lib/nanoc3/package.rb +0 -107
  90. data/vendor/cri/ChangeLog +0 -0
  91. data/vendor/cri/LICENSE +0 -19
  92. data/vendor/cri/NEWS +0 -0
  93. data/vendor/cri/README +0 -4
  94. data/vendor/cri/Rakefile +0 -25
  95. data/vendor/cri/lib/cri/base.rb +0 -153
  96. data/vendor/cri/lib/cri/command.rb +0 -105
  97. data/vendor/cri/lib/cri/core_ext/string.rb +0 -41
  98. data/vendor/cri/lib/cri/core_ext.rb +0 -8
  99. data/vendor/cri/lib/cri/option_parser.rb +0 -186
  100. data/vendor/cri/lib/cri.rb +0 -12
  101. data/vendor/cri/test/test_base.rb +0 -6
  102. data/vendor/cri/test/test_command.rb +0 -6
  103. data/vendor/cri/test/test_core_ext.rb +0 -21
  104. data/vendor/cri/test/test_option_parser.rb +0 -279
data/NEWS.rdoc DELETED
@@ -1,328 +0,0 @@
1
- = nanoc News
2
-
3
- == 3.0.9
4
-
5
- * Fixed 1.8.x parsing bug due to lack of parens which could cause “undefined
6
- method `to_iso8601_time` for #<String:0x…>” errors
7
-
8
- == 3.0.8
9
-
10
- * #atom_tag_for now works with base_urls that contain a path [Eric Sunshine]
11
- * Generated root URLs in #atom_feed now end with a slash [Eric Sunshine]
12
- * Autocompiler now recognises requests to index files
13
- * Blogging helper now allows created_at to be a Time instance
14
-
15
- == 3.0.7
16
-
17
- * Fixed bug which could cause layout rules not be matched in order
18
-
19
- == 3.0.6
20
-
21
- * Error checking in `filesystem_combined` has been improved [Brian Candler]
22
- * Generated HTML files now have a default encoding of UTF-8
23
- * Periods in identifiers for layouts now behave correctly
24
- * The `relativize_paths` filter now correctly handles “/” [Eric Sunshine]
25
-
26
- == 3.0.5
27
-
28
- * Restored pre-3.0.3 behaviour of periods in identifiers. By default, a file
29
- can have multiple extensions (e.g. content/foo.html.erb will have the
30
- identifier /foo/), but if `allow_periods_in_identifiers` in the site
31
- configuration is true, a file can have only one extension (e.g.
32
- content/blog/stuff.entry.html will have the identifier /blog/stuff.entry/).
33
-
34
- == 3.0.4
35
-
36
- * Fixed a bug which would cause the filesystem_compact data source to
37
- incorrectly determine the content filename, leading to weird “Expected 1
38
- content file but found 3” errors [Eric Sunshine]
39
-
40
- == 3.0.3
41
-
42
- * The Blogging helper now properly handles item reps without paths
43
- * The relativize_paths filter now only operates inside tags
44
- * The autocompiler now handles escaped paths
45
- * The link_to and tagging helpers now output escaped HTML
46
- * Fixed played_at attribute assignment in Last.fm data source for tracks
47
- playing now and added a now_playing attribute [Nicky Peeters]
48
- * The filesystem_* data sources can now handle dots in identifiers
49
- * Required enumerator to make sure #enum_with_index always works
50
- * Array#stringify_keys now properly recurses
51
-
52
- == 3.0.2
53
-
54
- * Children-only identifier patterns no longer erroneously also match parent
55
- (e.g. /foo/*/ no longer matches /foo/)
56
- * The create_site command no longer uses those ugly HTML entities
57
- * Install message now mentions the IRC channel
58
-
59
- == 3.0.1
60
-
61
- * The proper exception is now raised when no matching compilation rules can
62
- be found
63
- * The autocompile command no longer has a duplicate --port option
64
- * The #url_for and #feed_url methods now check the presence of the base_url
65
- site configuration attribute
66
- * Several outdated URLs are now up-to-date
67
- * Error handling has been improved in general
68
-
69
- == 3.0
70
-
71
- New:
72
-
73
- * Multiple data sources
74
- * Dependency tracking between items
75
- * Filters can now optionally take arguments
76
- * create_page and create_layout methods in data sources
77
- * A new way to specify compilation/routing rules using a Rules file
78
- * Coderay filter
79
- * A filesystem_compact data source which uses less directories
80
-
81
- Changed:
82
-
83
- * Pages and textual assets are now known as "items"
84
-
85
- Removed:
86
-
87
- * Support for drafts
88
- * Support for binary assets
89
- * Support for templates
90
- * Everything that was deprecated in nanoc 2.x
91
- * save_*, move_* and delete_* methods in data sources
92
- * Processing instructions in metadata
93
-
94
- == 2.2.2
95
-
96
- * Removed relativize_paths filter; use relativize_paths_in_html or
97
- relativize_paths_in_css instead
98
- * Fixed bug which could cause nanoc to eat massive amounts of memory when an
99
- exception occurs
100
- * Fixed bug which would cause nanoc to complain about the open file limit
101
- being reached when using a large amount of assets
102
-
103
- == 2.2.1
104
-
105
- * Fixed bug which prevented relative_path_to from working
106
- * Split relativize_paths filter into two filter: relativize_paths_in_html
107
- and relativize_paths_in_css
108
- * Removed bundled mime-types library
109
-
110
- == 2.2
111
-
112
- New:
113
-
114
- * --pages and --assets compiler options
115
- * --no-color commandline option
116
- * Filtering helper
117
- * relative_path_to function in LinkTo helper
118
- * Rainpress filter
119
- * RelativizePaths filter
120
- * The current layout is now accessible through the @layout variable
121
- * Much more informative stack traces when something goes wrong
122
-
123
- Changed:
124
-
125
- * The commandline option parser is now a lot more reliable
126
- * atom_feed now takes optional :content_proc, :excerpt_proc and :articles
127
- parameters
128
- * The compile command show non-written items (those with skip_output: true)
129
- * The compile command compiles everything by default
130
- * Added --only-outdated option to compile only outdated pages
131
-
132
- Removed:
133
-
134
- * deprecated extension-based code
135
-
136
- == 2.1.6
137
-
138
- * The FilesystemCombined data source now supports empty metadata sections
139
- * The RDoc filter now works for both RDoc 1.x and 2.x
140
- * The autocompiler now serves a 500 when an exception occurs outside
141
- compilation
142
- * The autocompiler no longer serves index files when the request path does not
143
- end with a slash
144
- * The autocompiler now always serves asset content correctly
145
-
146
- == 2.1.5
147
-
148
- * Added Ruby 1.9 compatibility
149
- * The Filesystem and FilesystemCombined data sources now preserve custom
150
- extensions
151
-
152
- == 2.1.4
153
-
154
- * Fixed an issue where the autocompiler in Windows would serve broken assets
155
-
156
- == 2.1.3
157
-
158
- * The Haml and Sass filters now correctly take their options from assets
159
- * Autocompiler now serves index files instead of 404s
160
- * Layouts named "index" are now handled correctly
161
- * filesystem_combined now properly handles assets
162
-
163
- == 2.1.2
164
-
165
- * Autocompiler now compiles assets as well
166
- * Sass filter now takes options (just like the Haml filter)
167
- * Haml/Sass options are now taken from the page *rep* instead of the page
168
-
169
- == 2.1.1
170
-
171
- * Fixed issue which would cause files not to be required in the right order
172
-
173
- == 2.1
174
-
175
- This is only a short summary of all changes in 2.1. For details, see the nanoc
176
- web site at <http://nanoc.stoneship.org/> -- especially the blog and the
177
- updated manual will be useful.
178
-
179
- New:
180
-
181
- * New filters: RDiscount, Maruku, Erubis
182
- * A better commandline frontend
183
- * A new filesystem data source named "filesystem_combined"
184
- * Routers, which decide where compiled pages should be written to
185
- * Page/layout mtimes can now be retrieved through page.mtime/layout.mtime
186
-
187
- Changed:
188
-
189
- * Already compiled pages will no longer be re-compiled unless outdated
190
- * Layout processors and filters have been merged
191
- * Layouts no longer rely on file extensions to determine the layout processor
192
- * Greatly improved source code documentation
193
- * Greatly improved unit test suite
194
-
195
- Removed:
196
-
197
- * Several filters have been removed and replaced by newer filters:
198
- * `eruby`: use `erb` or `erubis` instead
199
- * `markdown`: use `bluecloth`, `rdiscount` or `maruku` instead
200
- * `textile`: use `redcloth` instead
201
-
202
- == 2.0.4
203
-
204
- * Fixed default.rb's `html_escape`
205
- * Updated Haml filter and layout processor so that @page, @pages and @config
206
- are now available as instance variables instead of local variables
207
-
208
- == 2.0.3
209
-
210
- * The autocompiler now honors custom paths
211
- * The autocompiler now attempts to serve pages with the most appropriate MIME
212
- type, instead of always serving everything as "text/html"
213
-
214
- == 2.0.2
215
-
216
- * nanoc now requires Ruby 1.8.5 instead of 1.8.6
217
-
218
- == 2.0.1
219
-
220
- * Fixed a "too many open files" error that could appear during (auto)compiling
221
-
222
- == 2.0
223
-
224
- New:
225
-
226
- * Support for custom layout processors
227
- * Support for custom data sources
228
- * Database data source
229
- * Auto-compiler
230
- * Pages have `parent` and `children`
231
-
232
- Changed:
233
-
234
- * The source has been restructured and cleaned up a great deal
235
- * Filters are defined in a different way now
236
- * The 'eruby' filter now uses ERB instead of Erubis
237
-
238
- Removed:
239
-
240
- * The `filters` property; use `filters_pre` instead
241
- * Support for Liquid
242
-
243
- == 1.6.2
244
-
245
- * Fixed an issue which prevented the content capturing plugin from working
246
-
247
- == 1.6.1
248
-
249
- * Removed a stray debug message
250
-
251
- == 1.6
252
-
253
- * Added support for post-layout filters
254
- * Added support for getting a File object for the page, so you can now e.g.
255
- easily get the modification time for a given page (`@page.file.mtime`)
256
- * Cleaned up the source code a lot
257
- * Removed deprecated asset-copying functionality
258
-
259
- == 1.5
260
-
261
- * Added support for custom filters
262
- * Improved Liquid support -- Liquid is now a first-class nanoc citizen
263
- * Deprecated assets -- use something like rsync instead
264
- * Added eruby_engine option, which can be 'erb' or 'erubis'
265
-
266
- == 1.4
267
-
268
- * nanoc now supports ERB (as well as Erubis); Erubis no longer is a dependency
269
- * meta.yaml can now have haml_options property, which is passed to Haml
270
- * Pages can now have a 'filename' property, which defaults to 'index' [Dennis
271
- Sutch]
272
- * Pages now know in what order they should be compiled, eliminating the need
273
- for custom page ordering [Dennis Sutch]
274
-
275
- == 1.3.1
276
-
277
- * The contents of the 'assets' directory are now copied into the output
278
- directory specified in 'config.yaml'
279
-
280
- == 1.3
281
-
282
- * The @pages array now also contains uncompiled pages
283
- * Pages with 'skip_output' set to true will not be outputted
284
- * Added new filters
285
- * Textile/RedCloth
286
- * Sass
287
- * nanoc now warns before overwriting in create_site, create_page and
288
- create_template (but not in compile)
289
-
290
- == 1.2
291
-
292
- * Sites now have an 'assets' directory, whose contents are copied to the
293
- 'output' directory when compiling [Soryu]
294
- * Added support for non-eRuby layouts (Markaby, Haml, Liquid, ...)
295
- * Added more filters (Markaby, Haml, Liquid, RDoc [Dmitry Bilunov])
296
- * Improved error reporting
297
- * Accessing page attributes using instance variables, and not through @page,
298
- is no longer possible
299
- * Page attributes can now be accessed using dot notation, i.e. @page.title as
300
- well as @page[:title]
301
-
302
- == 1.1.3
303
-
304
- * Fixed bug which would cause layoutless pages to be outputted incorrectly
305
-
306
- == 1.1.2
307
-
308
- * Backup files (files ending with a “~”) are now ignored
309
- * Fixed bug which would cause subpages not to be generated correctly
310
-
311
- == 1.1
312
-
313
- * Added support for nested layouts
314
- * Added coloured logging
315
- * @page now hold the page that is currently being processed
316
- * Index files are now called “content” files and are now named after the
317
- directory they are in [Colin Barrett]
318
- * It is now possible to access @page in the page’s content file
319
-
320
- == 1.0.1
321
-
322
- * Fixed a bug which would cause a “no such template” error to be displayed
323
- when the template existed but compiling it would raise an exception
324
- * Fixed bug which would cause pages not to be sorted by order before compiling
325
-
326
- == 1.0
327
-
328
- * Initial release
data/README.rdoc DELETED
@@ -1,83 +0,0 @@
1
- = nanoc 3
2
-
3
- nanoc is a simple but very flexible static site generator written in Ruby.
4
- It operates on local files, and therefore does not run on the server. nanoc
5
- "compiles" the local source files into HTML (usually), by evaluating eRuby,
6
- Markdown, etc.
7
-
8
- == Documentation
9
-
10
- nanoc3's web site, which can be found at http://nanoc.stoneship.org, contains a
11
- few useful resources to help you get started with nanoc:
12
-
13
- * The tutorial at http://nanoc.stoneship.org/tutorial
14
- * The manual at http://nanoc.stoneship.org/manual
15
- * The migration guide at http://nanoc.stoneship.org/migrating
16
-
17
- It is probably also worth checking out and perhaps subscribing to the
18
- discussion groups:
19
-
20
- * The discussion group in English at http://groups.google.com/group/nanoc
21
- * The discussion group in Spanish at http://groups.google.com/group/nanoc-es
22
-
23
- === Source Code Documentation
24
-
25
- The source code is structured in a few directories:
26
-
27
- * *bin* contains the commandline tool aptly named +nanoc+
28
- * *lib*
29
- * *nanoc*
30
- * *base* contains the bare essentials necessary for nanoc to function
31
- * *cli* contains the commandline interface
32
- * *data_sources* contains the standard data sources (Nanoc3::DataSource
33
- subclasses), such as the filesystem data source
34
- * *helpers* contains helpers, which provide functionality some sites
35
- may find useful, such as the blogging and tagging helpers
36
- * *extra* contains stuff that is not needed by nanoc itself, but which may
37
- be used by helpers, data sources, filters or VCSes.
38
- * *filters* contains the standard filters (Nanoc3::Filter subclasses) such
39
- as ERB, Markdown, Haml, ...
40
- * *test* contains testing code, structured in the same way as lib/nanoc
41
-
42
- The namespaces (modules) are organised like this:
43
-
44
- * *Nanoc3* is the namespace for everything nanoc-related (obviously). The
45
- classes in 'lib/nanoc3/base' are part of this module (not Nanoc3::Base which
46
- does not exist)
47
- * *CLI* containing everything related to the commandline tool.
48
- * *DataSources* contains the data sources
49
- * *Helpers* contains the helpers
50
- * *Extra* contains useful stuff not needed by nanoc itself
51
- * *Filters* contains the (textual) filters
52
-
53
- The central class in nanoc is Nanoc3::Site, so you should start there if you
54
- want to explore nanoc from a technical perspective.
55
-
56
- == Dependencies
57
-
58
- nanoc itself can be used without installing any dependencies. Some components, however, do have dependencies:
59
-
60
- autocompiler:: +mime-types+, +rack+
61
- documentation generation:: +rdoc+ (2.4 or newer), +yardoc+
62
- packaging:: +rubygems+ (1.3 or newer)
63
-
64
- You may need to manually install the rdoc gem and update the rubygems installation.
65
-
66
- == Contributors
67
-
68
- (In alphabetical order)
69
-
70
- * Colin Barrett
71
- * Dmitry Bilunov
72
- * Brian Candler
73
- * Christian Plessl
74
- * Šime Ramov
75
- * "Soryu"
76
- * Eric Sunshine
77
- * Dennis Sutch
78
-
79
- Special thanks to Ale Muñoz.
80
-
81
- == Contact
82
-
83
- You can reach me at <denis.defreyne@stoneship.org>.
@@ -1,88 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Nanoc3
4
-
5
- # Nanoc3::Plugin is the superclass for all plugins, such as filters
6
- # (Nanoc3::Filter), data sources (Nanoc3::DataSource) and VCSes
7
- # (Nanoc3::Extra::VCS). Each plugin has one or more unique identifiers,
8
- # and several methods in this class provides functionality for finding
9
- # plugins with given identifiers.
10
- class Plugin
11
-
12
- MAP = {}
13
-
14
- class << self
15
-
16
- # Registers the given class as a plugin.
17
- #
18
- # +superclass+:: The superclass of the plugin. For example:
19
- # Nanoc::Filter, Nanoc::VCS.
20
- #
21
- # +class_or_name+:: The class to register. This can be a string, in
22
- # which case it will be automatically converted to a
23
- # proper class at lookup. For example:
24
- # 'Nanoc::Filters::ERB', Nanoc::Filters::Haml.
25
- #
26
- # +identifiers+:: One or more symbols identifying the class. For
27
- # example: :haml, :erb.
28
- def register(superclass, class_or_name, *identifiers)
29
- MAP[superclass] ||= {}
30
-
31
- identifiers.each do |identifier|
32
- MAP[superclass][identifier.to_sym] = class_or_name
33
- end
34
- end
35
-
36
- # Returns the the plugin with the given name. Only subclasses of this
37
- # class will be searched. For example, calling this method on
38
- # Nanoc3::Filter will cause only Nanoc3::Filter subclasses to be searched.
39
- def named(name)
40
- # Initialize
41
- MAP[self] ||= {}
42
-
43
- # Lookup
44
- class_or_name = MAP[self][name.to_sym]
45
-
46
- # Get class
47
- if class_or_name.is_a?(String)
48
- class_or_name.scan(/\w+/).inject(self) { |memo, part| memo.const_get(part) }
49
- else
50
- class_or_name
51
- end
52
- end
53
-
54
- # Returns a list of all plugins in the following format:
55
- #
56
- # { :class => ..., :superclass => ..., :identifiers => ... }
57
- def all
58
- plugins = []
59
- MAP.each_pair do |superclass, submap|
60
- submap.each_pair do |identifier, klass|
61
- # Find existing plugin
62
- existing_plugin = plugins.find do |p|
63
- p[:class] == klass && p[:superclass] == superclass
64
- end
65
-
66
- if existing_plugin
67
- # Add identifier to existing plugin
68
- existing_plugin[:identifiers] << identifier
69
- existing_plugin[:identifiers] = existing_plugin[:identifiers].sort_by { |s| s.to_s }
70
- else
71
- # Create new plugin
72
- plugins << {
73
- :class => klass,
74
- :superclass => superclass,
75
- :identifiers => [ identifier ]
76
- }
77
- end
78
- end
79
- end
80
-
81
- plugins
82
- end
83
-
84
- end
85
-
86
- end
87
-
88
- end
@@ -1,37 +0,0 @@
1
- module Nanoc3
2
-
3
- # Nanoc3::PreprocessorContext provides a context in which preprocessing code
4
- # can be executed. It provides access to the site and its configuration,
5
- # items and layouts.
6
- class PreprocessorContext
7
-
8
- # Creates a new preprocessor context for the given site.
9
- def initialize(site)
10
- @site = site
11
- end
12
-
13
- # The site for which the preprocessor code is being executed.
14
- def site
15
- @site
16
- end
17
-
18
- # The configuration of the site for which the preprocessor code is being
19
- # executed.
20
- def config
21
- site.config
22
- end
23
-
24
- # The items in the site for which the preprocessor code is being executed.
25
- def items
26
- site.items
27
- end
28
-
29
- # The layouts in the site for which the preprocessor code is being
30
- # executed.
31
- def layouts
32
- site.layouts
33
- end
34
-
35
- end
36
-
37
- end