nanoc 4.2.4 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d71e907ef0318683da05fb81149422628b700007
4
- data.tar.gz: 8d6e28866ff7dc184b6738005c55e4f368c2f74c
3
+ metadata.gz: 42d007123a8daf12e6e2a49eec0faedcde6a9bfe
4
+ data.tar.gz: 6350ddff74b8837e0338e319bbb495dea5c8969b
5
5
  SHA512:
6
- metadata.gz: ef183242bffb54bc9875275146912a1bc7f3bc84ed51fa77b032ba986952a8bd6895e18170b2580e6131e8deaee0591a2df94769917ae4bd829a566310f529e7
7
- data.tar.gz: bf46729b4e0e8e682327b553460f9e3611b76ef74627441d3f1189d155bd6f978da4b3668dc08cf06fec6c00ad6dcdf694f6b2afe19814cc7436efda5b7df18a
6
+ metadata.gz: d67dfeb6608496945aa0cf341199b39fd137d7c12f790b1ae8eeea6ec28aa6491daf4f20cb566c5d61a50a78e870fb510a4ad8642820a902708d46e7b8b67696
7
+ data.tar.gz: 64a00a9a64a0b9d4b1e2e6a0953fae371b3a72e95b510b5264e9033cbda85ff877333220ef67d18c3af0dba822881251c1a8e6ade5da50dbb1f66ee4f8d18830
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (4.2.4)
4
+ nanoc (4.3.0)
5
5
  cri (~> 2.3)
6
6
  hamster (~> 3.0)
7
7
  ref (~> 2.0)
@@ -39,12 +39,12 @@ GEM
39
39
  sass (>= 3.2, < 3.5)
40
40
  concurrent-ruby (1.0.2)
41
41
  contracts (0.14.0)
42
- coveralls (0.8.14)
42
+ coveralls (0.8.15)
43
43
  json (>= 1.8, < 3)
44
44
  simplecov (~> 0.12.0)
45
45
  term-ansicolor (~> 1.3)
46
46
  thor (~> 0.19.1)
47
- tins (~> 1.6.0)
47
+ tins (>= 1.6.0, < 2)
48
48
  crack (0.4.3)
49
49
  safe_yaml (~> 1.0.0)
50
50
  cri (2.7.0)
@@ -94,7 +94,7 @@ GEM
94
94
  fog-atmos (0.1.0)
95
95
  fog-core
96
96
  fog-xml
97
- fog-aws (0.10.0)
97
+ fog-aws (0.11.0)
98
98
  fog-core (~> 1.38)
99
99
  fog-json (~> 1.0)
100
100
  fog-xml (~> 0.1)
@@ -128,7 +128,7 @@ GEM
128
128
  multi_json (~> 1.10)
129
129
  fog-local (0.3.0)
130
130
  fog-core (~> 1.27)
131
- fog-openstack (0.1.8)
131
+ fog-openstack (0.1.11)
132
132
  fog-core (>= 1.40)
133
133
  fog-json (>= 1.0)
134
134
  ipaddress (>= 0.8)
@@ -174,7 +174,7 @@ GEM
174
174
  fog-voxel (0.1.0)
175
175
  fog-core
176
176
  fog-xml
177
- fog-vsphere (0.8.0)
177
+ fog-vsphere (1.0.0)
178
178
  fog-core
179
179
  rbvmomi (~> 1.8)
180
180
  fog-xenserver (0.2.3)
@@ -210,8 +210,8 @@ GEM
210
210
  hashdiff (0.3.0)
211
211
  inflecto (0.0.2)
212
212
  ipaddress (0.8.3)
213
- json (2.0.1)
214
- kramdown (1.11.1)
213
+ json (2.0.2)
214
+ kramdown (1.12.0)
215
215
  less (2.6.0)
216
216
  commonjs (~> 0.2.7)
217
217
  libv8 (3.16.14.15)
@@ -238,7 +238,7 @@ GEM
238
238
  nokogiri (1.6.8)
239
239
  mini_portile2 (~> 2.1.0)
240
240
  pkg-config (~> 1.1.7)
241
- notiffany (0.1.0)
241
+ notiffany (0.1.1)
242
242
  nenv (~> 0.1)
243
243
  shellany (~> 0.0)
244
244
  pandoc-ruby (2.0.1)
@@ -274,7 +274,7 @@ GEM
274
274
  rspec-core (~> 3.5.0)
275
275
  rspec-expectations (~> 3.5.0)
276
276
  rspec-mocks (~> 3.5.0)
277
- rspec-core (3.5.1)
277
+ rspec-core (3.5.2)
278
278
  rspec-support (~> 3.5.0)
279
279
  rspec-expectations (3.5.0)
280
280
  diff-lcs (>= 1.2.0, < 2.0)
@@ -283,15 +283,15 @@ GEM
283
283
  diff-lcs (>= 1.2.0, < 2.0)
284
284
  rspec-support (~> 3.5.0)
285
285
  rspec-support (3.5.0)
286
- rubocop (0.41.2)
286
+ rubocop (0.42.0)
287
287
  parser (>= 2.3.1.1, < 3.0)
288
288
  powerpack (~> 0.1)
289
289
  rainbow (>= 1.99.1, < 3.0)
290
290
  ruby-progressbar (~> 1.7)
291
291
  unicode-display_width (~> 1.0, >= 1.0.1)
292
292
  ruby-progressbar (1.8.1)
293
- ruby_dep (1.3.1)
294
- rubypants (0.2.0)
293
+ ruby_dep (1.4.0)
294
+ rubypants (0.5.0)
295
295
  safe_yaml (1.0.4)
296
296
  sass (3.4.22)
297
297
  shellany (0.0.1)
@@ -312,11 +312,11 @@ GEM
312
312
  ref
313
313
  thor (0.19.1)
314
314
  tilt (2.0.5)
315
- tins (1.6.0)
315
+ tins (1.12.0)
316
316
  trollop (2.1.2)
317
317
  typogruby (1.0.18)
318
318
  rubypants
319
- uglifier (3.0.0)
319
+ uglifier (3.0.2)
320
320
  execjs (>= 0.3.0, < 3)
321
321
  unicode-display_width (1.1.0)
322
322
  vcr (3.0.3)
data/NEWS.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.3 (2016-08-21)
4
+
5
+ Features:
6
+
7
+ * Added `Nanoc::Filter.define`, to easily define filters (#895)
8
+ * Made the `nanoc` Gemfile group be auto-required when Nanoc starts (#910) [whitequark]
9
+
3
10
  ## 4.2.4 (2016-07-24)
4
11
 
5
12
  Fixes:
@@ -38,6 +38,13 @@ module Nanoc
38
38
  extend Nanoc::Int::PluginRegistry::PluginMethods
39
39
 
40
40
  class << self
41
+ def define(ident)
42
+ filter_class = Class.new(::Nanoc::Filter) { identifier(ident) }
43
+ filter_class.send(:define_method, :run) do |content, params|
44
+ yield(content, params)
45
+ end
46
+ end
47
+
41
48
  # Sets the new type for the filter. The type can be `:binary` (default)
42
49
  # or `:text`. The given argument can either be a symbol indicating both
43
50
  # “from” and “to” types, or a hash where the only key is the “from” type
@@ -6,9 +6,15 @@ module Nanoc::Int
6
6
  class Ignorer
7
7
  include Singleton
8
8
 
9
+ # rubocop:disable Style/MethodMissing
9
10
  def method_missing(*_args)
10
11
  self
11
12
  end
13
+ # rubocop:enable Style/MethodMissing
14
+
15
+ def respond_to_missing?(*_args)
16
+ true
17
+ end
12
18
  end
13
19
 
14
20
  module DisabledContracts
@@ -161,7 +161,6 @@ module Nanoc::Int
161
161
  private
162
162
 
163
163
  def initialize_content
164
- # FIXME: Where is :raw?
165
164
  @snapshot_contents = { last: @item.content }
166
165
  end
167
166
  end
@@ -61,7 +61,7 @@ module Nanoc
61
61
  #
62
62
  # @return [void]
63
63
  def use
64
- up if @references == 0
64
+ up if @references.zero?
65
65
  @references += 1
66
66
  end
67
67
 
@@ -74,7 +74,7 @@ module Nanoc
74
74
  # @return [void]
75
75
  def unuse
76
76
  @references -= 1
77
- down if @references == 0
77
+ down if @references.zero?
78
78
  end
79
79
 
80
80
  # Brings up the connection to the data. Depending on the way data is
data/lib/nanoc/cli.rb CHANGED
@@ -103,6 +103,11 @@ module Nanoc::CLI
103
103
  cmd = load_command_at(cmd_filename)
104
104
  add_command(cmd)
105
105
  end
106
+
107
+ if defined?(Bundler)
108
+ # Discover external commands through Bundler
109
+ Bundler.require(:nanoc)
110
+ end
106
111
  end
107
112
 
108
113
  # Loads site-specific commands.
@@ -271,7 +271,7 @@ module Nanoc::CLI::Commands
271
271
  # @see Listener#start
272
272
  def start
273
273
  Nanoc::Int::NotificationCenter.on(:compilation_started) do |_rep|
274
- if @gc_count % 20 == 0
274
+ if (@gc_count % 20).zero?
275
275
  GC.enable
276
276
  GC.start
277
277
  GC.disable
@@ -62,8 +62,7 @@ module Nanoc::CLI::Commands
62
62
 
63
63
  target = options.fetch(:target, :default).to_sym
64
64
  deploy_configs.fetch(target) do
65
- # FIXME: target name is unobvious
66
- raise Nanoc::Int::Errors::GenericTrivial, "The site has no deployment configuration for #{target}."
65
+ raise Nanoc::Int::Errors::GenericTrivial, "The site has no deployment configuration named `#{target}`."
67
66
  end
68
67
  end
69
68
 
@@ -84,8 +84,9 @@ module Nanoc::Extra::Deployers
84
84
  path = config[:path]
85
85
  cdn_id = config[:cdn_id]
86
86
 
87
- # FIXME: confusing error message
88
- raise 'The path requires no trailing slash' if path && path[-1, 1] == '/'
87
+ if path && path.end_with?('/')
88
+ raise "The path `#{path}` is not supposed to have a trailing slash"
89
+ end
89
90
 
90
91
  connection = connect
91
92
  directory = get_or_create_bucket(connection, bucket, path)
@@ -55,7 +55,7 @@ module Nanoc::Extra
55
55
  all_files_and_dirs_in(dir_name, extra_files).map do |fn|
56
56
  case File.ftype(fn)
57
57
  when 'link'
58
- if 0 == recursion_limit
58
+ if recursion_limit.zero?
59
59
  raise MaxSymlinkDepthExceededError.new(fn)
60
60
  else
61
61
  absolute_target = resolve_symlink(fn)
@@ -129,7 +129,7 @@ module Nanoc::Extra
129
129
 
130
130
  case File.ftype(absolute_target)
131
131
  when 'link'
132
- if 0 == recursion_limit
132
+ if recursion_limit.zero?
133
133
  raise MaxSymlinkDepthExceededError.new(absolute_target)
134
134
  else
135
135
  resolve_symlink(absolute_target, recursion_limit - 1)
@@ -1,28 +1,7 @@
1
1
  module Nanoc::Helpers
2
- # Provides functionality for building blogs, such as finding articles and
3
- # constructing feeds.
4
- #
5
- # This helper has a few requirements. First, all blog articles should have
6
- # the following attributes:
7
- #
8
- # * `kind` - Set to `"article"`
9
- #
10
- # * `created_at` - The article's publication timestamp
11
- #
12
- # Some functions in this blogging helper, such as the {#atom_feed} function,
13
- # require additional attributes to be set; these attributes are described in
14
- # the documentation for these functions.
15
- #
16
- # All "time" item attributes, site configuration attributes or method
17
- # parameters can either be a `Time` instance or a string in any format
18
- # parseable by `Time.parse`.
19
- #
20
- # The two main functions are {#sorted_articles} and {#atom_feed}.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#blogging
21
3
  module Blogging
22
- # Returns an unsorted list of articles, i.e. items where the `kind`
23
- # attribute is set to `"article"`.
24
- #
25
- # @return [Array] An array containing all articles
4
+ # @return [Array]
26
5
  def articles
27
6
  blk = -> { @items.select { |item| item[:kind] == 'article' } }
28
7
  if @items.frozen?
@@ -32,11 +11,7 @@ module Nanoc::Helpers
32
11
  end
33
12
  end
34
13
 
35
- # Returns a sorted list of articles, i.e. items where the `kind`
36
- # attribute is set to `"article"`. Articles are sorted by descending
37
- # creation date, so newer articles appear before older articles.
38
- #
39
- # @return [Array] A sorted array containing all articles
14
+ # @return [Array]
40
15
  def sorted_articles
41
16
  blk = -> { articles.sort_by { |a| attribute_to_time(a[:created_at]) }.reverse }
42
17
 
@@ -190,118 +165,18 @@ module Nanoc::Helpers
190
165
  end
191
166
  end
192
167
 
193
- # Returns a string representing the atom feed containing recent articles,
194
- # sorted by descending creation date.
195
- #
196
- # The following attributes must be set on blog articles:
197
- #
198
- # * `title` - The title of the blog post
199
- #
200
- # * `created_at` (described above)
201
- #
202
- # * `kind` (described above) *unless* you are passing an explicit list of
203
- # articles using the `:articles` parameter
204
- #
205
- # The following attributes can optionally be set on blog articles to
206
- # change the behaviour of the Atom feed:
207
- #
208
- # * `excerpt` - An excerpt of the article, which is usually only a few
209
- # lines long.
210
- #
211
- # * `custom_path_in_feed` - The path that will be used instead of the
212
- # normal path in the feed. This can be useful when including
213
- # non-outputted items in a feed; such items could have their custom feed
214
- # path set to the blog path instead, for example.
215
- #
216
- # * `custom_url_in_feed` - The url that will be used instead of the
217
- # normal url in the feed (generated from the site's base url + the item
218
- # rep's path). This can be useful when building a link-blog where the
219
- # URL of article is a remote location.
220
- #
221
- # * `updated_at` - The time when the article was last modified. If this
222
- # attribute is not present, the `created_at` attribute will be used as
223
- # the time when the article was last modified.
224
- #
225
- # The site configuration will need to have the following attributes:
226
- #
227
- # * `base_url` - The URL to the site, without trailing slash. For
228
- # example, if the site is at "http://example.com/", the `base_url`
229
- # would be "http://example.com".
230
- #
231
- # The feed item will need to know about the feed title, the feed author
232
- # name, and the URI corresponding to the author. These can be specified
233
- # using parameters, as attributes in the feed item, or in the site
234
- # configuration.
235
- #
236
- # * `title` - The title of the feed, which is usually also the title of
237
- # the blog.
238
- #
239
- # * `author_name` - The name of the item's author.
240
- #
241
- # * `author_uri` - The URI for the item's author, such as the author's
242
- # web site URL.
243
- #
244
- # The feed item can have the following optional attributes:
245
- #
246
- # * `feed_url` - The custom URL of the feed. This can be useful when the
247
- # private feed URL shouldn't be exposed; for example, when using
248
- # FeedBurner this would be set to the public FeedBurner URL.
249
- #
250
- # To construct a feed, create a new item and make sure that it is
251
- # filtered with `:erb` or `:erubis`; it should not be laid out. Ensure
252
- # that it is routed to the proper path, e.g. `/blog.xml`. It may also be
253
- # useful to set the `is_hidden` attribute to true, so that helpers such
254
- # as the sitemap helper will ignore the item. The content of the feed
255
- # item should be `<%= atom_feed %>`.
256
- #
257
- # @example Defining compilation and routing rules for a feed item
258
- #
259
- # compile '/blog/feed/' do
260
- # filter :erb
261
- # end
262
- #
263
- # route '/blog/feed/' do
264
- # '/blog.xml'
265
- # end
266
- #
267
- # @example Limiting the number of items in a feed
268
- #
269
- # <%= atom_feed :limit => 5 %>
270
- #
271
- # @option params [Number] :limit (5) The maximum number of articles to
272
- # show
273
- #
274
- # @option params [Array] :articles (articles) A list of articles to include
275
- # in the feed
276
- #
277
- # @option params [Boolean] :preserve_order (false) Whether or not the
278
- # ordering of the list of articles should be preserved. If false, the
279
- # articles will be sorted by `created_at`. If true, the list of articles
280
- # will be used as-is, and should have the most recent articles last.
281
- #
282
- # @option params [Proc] :content_proc (->{ |article|
283
- # article.compiled_content(:snapshot => :pre) }) A proc that returns the
284
- # content of the given article, which is passed as a parameter. This
285
- # function may not return nil.
286
- #
287
- # @option params [proc] :excerpt_proc (->{ |article| article[:excerpt] })
288
- # A proc that returns the excerpt of the given article, passed as a
289
- # parameter. This function should return nil if there is no excerpt.
290
- #
291
- # @option params [String] :title The feed's title, if it is not given in
292
- # the item attributes.
293
- #
294
- # @option params [String] :author_name The name of the feed's author, if
295
- # it is not given in the item attributes.
296
- #
297
- # @option params [String] :author_uri The URI of the feed's author, if it
298
- # is not given in the item attributes.
299
- #
300
- # @option params [String] :icon The URI of the feed's icon.
301
- #
302
- # @option params [String] :logo The URI of the feed's logo.
303
- #
304
- # @return [String] The generated feed content
168
+ # @option params [Number] :limit
169
+ # @option params [Array] :articles
170
+ # @option params [Boolean] :preserve_order
171
+ # @option params [Proc] :content_proc
172
+ # @option params [Proc] :excerpt_proc
173
+ # @option params [String] :title
174
+ # @option params [String] :author_name
175
+ # @option params [String] :author_uri
176
+ # @option params [String] :icon
177
+ # @option params [String] :logo
178
+ #
179
+ # @return [String]
305
180
  def atom_feed(params = {})
306
181
  require 'builder'
307
182
 
@@ -325,12 +200,7 @@ module Nanoc::Helpers
325
200
  builder.build
326
201
  end
327
202
 
328
- # Returns the URL for the given item. It will return the URL containing
329
- # the custom path in the feed if possible, otherwise the normal path.
330
- #
331
- # @param [Nanoc::Int::Item] item The item for which to fetch the URL.
332
- #
333
- # @return [String] The URL of the given item
203
+ # @return [String]
334
204
  def url_for(item)
335
205
  # Check attributes
336
206
  if @config[:base_url].nil?
@@ -347,10 +217,7 @@ module Nanoc::Helpers
347
217
  end
348
218
  end
349
219
 
350
- # Returns the URL of the feed. It will return the custom feed URL if set,
351
- # or otherwise the normal feed URL.
352
- #
353
- # @return [String] The URL of the feed
220
+ # @return [String]
354
221
  def feed_url
355
222
  # Check attributes
356
223
  if @config[:base_url].nil?
@@ -360,15 +227,7 @@ module Nanoc::Helpers
360
227
  @item[:feed_url] || @config[:base_url] + @item.path
361
228
  end
362
229
 
363
- # Returns an URI containing an unique ID for the given item. This will be
364
- # used in the Atom feed to uniquely identify articles. These IDs are
365
- # created using a procedure suggested by Mark Pilgrim and described in his
366
- # ["How to make a good ID in Atom" blog post]
367
- # (http://web.archive.org/web/20110915110202/http://diveintomark.org/archives/2004/05/28/howto-atom-id).
368
- #
369
- # @param [Nanoc::Int::Item] item The item for which to create an atom tag
370
- #
371
- # @return [String] The atom tag for the given item
230
+ # @return [String]
372
231
  def atom_tag_for(item)
373
232
  hostname, base_dir = %r{^.+?://([^/]+)(.*)$}.match(@config[:base_url])[1..2]
374
233
 
@@ -377,14 +236,9 @@ module Nanoc::Helpers
377
236
  'tag:' + hostname + ',' + formatted_date + ':' + base_dir + (item.path || item.identifier.to_s)
378
237
  end
379
238
 
380
- # Converts the given attribute (which can be a string, a Time, a Date or a
381
- # DateTime) into a Time. When given a Date instance or a string, the
382
- # argument is assumed to be in the local timezone.
383
- #
384
- # @param [String, Time, Date, DateTime] arg Something that contains time
385
- # information but is not necessarily a Time instance yet
239
+ # @param [String, Time, Date, DateTime] arg
386
240
  #
387
- # @return [Time] The Time instance corresponding to the given input
241
+ # @return [Time]
388
242
  def attribute_to_time(arg)
389
243
  case arg
390
244
  when DateTime
@@ -1,6 +1,5 @@
1
1
  module Nanoc::Helpers
2
- # Provides support for breadcrumbs, which allow the user to go up in the
3
- # page hierarchy.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#breadcrumbs
4
3
  module Breadcrumbs
5
4
  class CannotGetBreadcrumbsForNonLegacyItem < Nanoc::Int::Errors::Generic
6
5
  def initialize(identifier)
@@ -8,14 +7,7 @@ module Nanoc::Helpers
8
7
  end
9
8
  end
10
9
 
11
- # Creates a breadcrumb trail leading from the current item to its parent,
12
- # to its parent’s parent, etc, until the root item is reached. This
13
- # function does not require that each intermediate item exist; for
14
- # example, if there is no `/foo/` item, breadcrumbs for a `/foo/bar/` item
15
- # will contain a `nil` element.
16
- #
17
- # @return [Array] The breadcrumbs, starting with the root item and ending
18
- # with the item itself
10
+ # @return [Array]
19
11
  def breadcrumbs_trail
20
12
  unless @item.identifier.legacy?
21
13
  raise CannotGetBreadcrumbsForNonLegacyItem.new(@item.identifier)
@@ -1,64 +1,14 @@
1
1
  module Nanoc::Helpers
2
- # Provides functionality for “capturing” content in one place and reusing
3
- # this content elsewhere.
4
- #
5
- # For example, suppose you want the sidebar of your site to contain a short
6
- # summary of the item. You could put the summary in the meta file, but
7
- # that’s not possible when the summary contains eRuby. You could also put
8
- # the sidebar inside the actual item, but that’s not very pretty. Instead,
9
- # you write the summary on the item itself, but capture it, and print it in
10
- # the sidebar layout.
11
- #
12
- # This helper has been tested with ERB and Haml. Other filters may not work
13
- # correctly.
14
- #
15
- # @example Capturing content for a summary
16
- #
17
- # <% content_for :summary do %>
18
- # <p>On this item, Nanoc is introduced, blah blah.</p>
19
- # <% end %>
20
- #
21
- # @example Showing captured content in a sidebar
22
- #
23
- # <div id="sidebar">
24
- # <h3>Summary</h3>
25
- # <%= content_for(@item, :summary) || '(no summary)' %>
26
- # </div>
2
+ # @see http://nanoc.ws/doc/reference/helpers/#capturing
27
3
  module Capturing
28
4
  # @overload content_for(name, params = {}, &block)
29
- #
30
- # Captures the content inside the block and stores it so that it can be
31
- # referenced later on. The same method, {#content_for}, is used for
32
- # getting the captured content as well as setting it. When capturing,
33
- # the content of the block itself will not be outputted.
34
- #
35
- # By default, capturing content with the same name will raise an error if the newly captured
36
- # content differs from the previously captured content. This behavior can be changed by
37
- # providing a different `:existing` option to this method:
38
- #
39
- # * `:error`: When content already exists and is not identical, raise an error.
40
- #
41
- # * `:overwrite`: Overwrite the previously captured content with the newly captured content.
42
- #
43
- # * `:append`: Append the newly captured content to the previously captured content.
44
- #
45
- # @param [Symbol, String] name The base name of the attribute into which
46
- # the content should be stored
47
- #
48
- # @option params [Symbol] existing Can be either `:error`, `:overwrite`, or `:append`
49
- #
5
+ # @param [Symbol, String] name
6
+ # @option params [Symbol] existing
50
7
  # @return [void]
51
8
  #
52
9
  # @overload content_for(item, name)
53
- #
54
- # Fetches the capture with the given name from the given item and
55
- # returns it.
56
- #
57
- # @param [Nanoc::Int::Item] item The item for which to get the capture
58
- #
59
- # @param [Symbol, String] name The name of the capture to fetch
60
- #
61
- # @return [String] The stored captured content
10
+ # @param [Symbol, String] name
11
+ # @return [String]
62
12
  def content_for(*args, &block)
63
13
  if block_given? # Set content
64
14
  # Get args
@@ -125,10 +75,7 @@ module Nanoc::Helpers
125
75
  end
126
76
  end
127
77
 
128
- # Evaluates the given block and returns its contents. The contents of the
129
- # block is not outputted.
130
- #
131
- # @return [String] The captured result
78
+ # @return [String]
132
79
  def capture(&block)
133
80
  # Get erbout so far
134
81
  erbout = eval('_erbout', block.binding)
@@ -1,21 +1,6 @@
1
1
  module Nanoc::Helpers
2
- # Provides functionality for fetching the children and the parent of a given
3
- # item. This works for both full identifiers and legacy identifiers.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#childparent
4
3
  module ChildParent
5
- # Returns the parent of the given item.
6
- #
7
- # For items with legacy identifiers, the parent is the item where the
8
- # identifier contains one less component than the identifier of the given
9
- # item. For # example, the parent of the “/projects/nanoc/” item is the
10
- # “/projects/” item.
11
- #
12
- # For items with full identifiers, the parent is the item where the
13
- # identifier contains one less component than the identifier of the given
14
- # item, and ends with any extension. For example, the parent of the
15
- # “/projects/nanoc.md” item could be the “/projects.md” item, or the
16
- # “/projects.html” item, etc. Note that the parent is ambiguous for items
17
- # that have a full identifier; only the first candidate parent item will be
18
- # returned.
19
4
  def parent_of(item)
20
5
  if item.identifier.legacy?
21
6
  item.parent
@@ -25,20 +10,6 @@ module Nanoc::Helpers
25
10
  end
26
11
  end
27
12
 
28
- # Returns the children of the given item.
29
- #
30
- # For items with legacy identifiers, the children are the items where the
31
- # identifier contains one more component than the identifier of the given
32
- # item. For example, the children of the “/projects/” item could be
33
- # “/projects/nanoc/” and “/projects/cri/”, but not “/about/” nor
34
- # “/projects/nanoc/history/”.
35
- #
36
- # For items with full identifiers, the children are the item where the
37
- # identifier starts with the identifier of the given item, minus the
38
- # extension, followed by a slash. For example, the children of the
39
- # “/projects.md” item could be the “/projects/nanoc.md” and
40
- # “/projects/cri.adoc” items , but not “/about.md” nor
41
- # “/projects/nanoc/history.md”.
42
13
  def children_of(item)
43
14
  if item.identifier.legacy?
44
15
  item.children
@@ -1,27 +1,11 @@
1
1
  module Nanoc::Helpers
2
- # Provides functionality for filtering parts of an item or a layout.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#filtering
3
3
  module Filtering
4
4
  require 'nanoc/helpers/capturing'
5
5
  include Nanoc::Helpers::Capturing
6
6
 
7
- # Filters the content in the given block and outputs it. This function
8
- # does not return anything; instead, the filtered contents is directly
9
- # appended to the output buffer (`_erbout`).
10
- #
11
- # This function has been tested with ERB and Haml. Other filters may not
12
- # work correctly.
13
- #
14
- # @example Running a filter on a part of an item or layout
15
- #
16
- # <p>Lorem ipsum dolor sit amet...</p>
17
- # <% filter :rubypants do %>
18
- # <p>Consectetur adipisicing elit...</p>
19
- # <% end %>
20
- #
21
- # @param [Symbol] filter_name The name of the filter to run on the
22
- # contents of the block
23
- #
24
- # @param [Hash] arguments Arguments to pass to the filter
7
+ # @param [Symbol] filter_name
8
+ # @param [Hash] arguments
25
9
  #
26
10
  # @return [void]
27
11
  def filter(filter_name, arguments = {}, &block)
@@ -1,29 +1,12 @@
1
1
  module Nanoc::Helpers
2
- # Contains functionality for HTML-escaping strings.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#filtering
3
3
  module HTMLEscape
4
4
  require 'nanoc/helpers/capturing'
5
5
  include Nanoc::Helpers::Capturing
6
6
 
7
- # Returns the HTML-escaped representation of the given string or the given
8
- # block. Only `&`, `<`, `>` and `"` are escaped. When given a block, the
9
- # contents of the block will be escaped and appended to the output buffer,
10
- # `_erbout`.
7
+ # @param [String] string
11
8
  #
12
- # @example Escaping a string
13
- #
14
- # h('<br>')
15
- # # => '&lt;br&gt;'
16
- #
17
- # @example Escaping with a block
18
- #
19
- # <% h do %>
20
- # <h1>Hello <em>world</em>!</h1>
21
- # <% end %>
22
- # # The buffer will now contain “&lt;h1&gt;Hello &lt;em&gt;world&lt;/em&gt;!&lt;/h1&gt;”
23
- #
24
- # @param [String] string The string to escape
25
- #
26
- # @return [String] The escaped string
9
+ # @return [String]
27
10
  def html_escape(string = nil, &block)
28
11
  if block_given?
29
12
  # Capture and escape block
@@ -1,46 +1,14 @@
1
1
  module Nanoc::Helpers
2
- # Contains functions for linking to items and item representations.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#linkto
3
3
  module LinkTo
4
4
  require 'nanoc/helpers/html_escape'
5
5
  include Nanoc::Helpers::HTMLEscape
6
6
 
7
- # Creates a HTML link to the given path or item representation, and with
8
- # the given text. All attributes of the `a` element, including the `href`
9
- # attribute, will be HTML-escaped; the contents of the `a` element, which
10
- # can contain markup, will not be HTML-escaped. The HTML-escaping is done
11
- # using {Nanoc::Helpers::HTMLEscape#html_escape}.
7
+ # @param [String] text
12
8
  #
13
- # @param [String] text The visible link text
9
+ # @param [Hash] attributes
14
10
  #
15
- # @param [String, Nanoc::Int::Item, Nanoc::Int::ItemRep] target The path/URL,
16
- # item or item representation that should be linked to
17
- #
18
- # @param [Hash] attributes A hash containing HTML attributes (e.g.
19
- # `rel`, `title`, …) that will be added to the link.
20
- #
21
- # @return [String] The link text
22
- #
23
- # @example Linking to a path
24
- #
25
- # link_to('Blog', '/blog/')
26
- # # => '<a href="/blog/">Blog</a>'
27
- #
28
- # @example Linking to an item
29
- #
30
- # about = @items.find { |i| i.identifier == '/about/' }
31
- # link_to('About Me', about)
32
- # # => '<a href="/about.html">About Me</a>'
33
- #
34
- # @example Linking to an item representation
35
- #
36
- # about = @items.find { |i| i.identifier == '/about/' }
37
- # link_to('My vCard', about.rep(:vcard))
38
- # # => '<a href="/about.vcf">My vCard</a>'
39
- #
40
- # @example Linking with custom attributes
41
- #
42
- # link_to('Blog', '/blog/', :title => 'My super cool blog')
43
- # # => '<a title="My super cool blog" href="/blog/">Blog</a>'
11
+ # @return [String]
44
12
  def link_to(text, target, attributes = {})
45
13
  # Find path
46
14
  path =
@@ -63,30 +31,11 @@ module Nanoc::Helpers
63
31
  "<a #{attributes}href=\"#{h path}\">#{text}</a>"
64
32
  end
65
33
 
66
- # Creates a HTML link using {#link_to}, except when the linked item is
67
- # the current one. In this case, a span element with class “active” and
68
- # with the given text will be returned. The HTML-escaping rules for
69
- # {#link_to} apply here as well.
34
+ # @param [String] text
70
35
  #
71
- # @param [String] text The visible link text
36
+ # @param [Hash] attributes
72
37
  #
73
- # @param [String, Nanoc::Int::Item, Nanoc::Int::ItemRep] target The path/URL,
74
- # item or item representation that should be linked to
75
- #
76
- # @param [Hash] attributes A hash containing HTML attributes (e.g.
77
- # `rel`, `title`, …) that will be added to the link.
78
- #
79
- # @return [String] The link text
80
- #
81
- # @example Linking to a different page
82
- #
83
- # link_to_unless_current('Blog', '/blog/')
84
- # # => '<a href="/blog/">Blog</a>'
85
- #
86
- # @example Linking to the same page
87
- #
88
- # link_to_unless_current('This Item', @item)
89
- # # => '<span class="active">This Item</span>'
38
+ # @return [String]
90
39
  def link_to_unless_current(text, target, attributes = {})
91
40
  # Find path
92
41
  path = target.is_a?(String) ? target : target.path
@@ -99,20 +48,7 @@ module Nanoc::Helpers
99
48
  end
100
49
  end
101
50
 
102
- # Returns the relative path from the current item to the given path or
103
- # item representation. The returned path will not be HTML-escaped.
104
- #
105
- # @param [String, Nanoc::Int::Item, Nanoc::Int::ItemRep] target The path/URL,
106
- # item or item representation to which the relative path should be
107
- # generated
108
- #
109
- # @return [String] The relative path to the target
110
- #
111
- # @example
112
- #
113
- # # if the current item's path is /foo/bar/
114
- # relative_path_to('/foo/qux/')
115
- # # => '../qux/'
51
+ # @return [String]
116
52
  def relative_path_to(target)
117
53
  require 'pathname'
118
54
 
@@ -1,78 +1,16 @@
1
1
  module Nanoc::Helpers
2
- # Provides functionality for rendering layouts as partials.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#rendering
3
3
  module Rendering
4
4
  include Nanoc::Helpers::Capturing
5
5
 
6
- # Renders the given layout. The given layout will be run through the first
7
- # matching layout rule.
6
+ # @param [String] identifier
7
+ # @param [Hash] other_assigns
8
8
  #
9
- # When this method is invoked _without_ a block, the return value will be
10
- # the rendered layout (a string) and `_erbout` will not be modified.
9
+ # @raise [Nanoc::Int::Errors::UnknownLayout]
10
+ # @raise [Nanoc::Int::Errors::CannotDetermineFilter]
11
+ # @raise [Nanoc::Int::Errors::UnknownFilter]
11
12
  #
12
- # When this method is invoked _with_ a block, an empty string will be
13
- # returned and the rendered content will be appended to `_erbout`. In this
14
- # case, the content of the block will be captured (using the
15
- # {Nanoc::Helpers::Capturing} helper) and this content will be made
16
- # available with `yield`. In other words, a `yield` inside the partial
17
- # will output the content of the block passed to the method.
18
- #
19
- # (For the curious: the reason why {#render} with a block has this
20
- # behaviour of returning an empty string and modifying `_erbout` is
21
- # because ERB does not support combining the `<%= ... %>` form with a
22
- # method call that takes a block.)
23
- #
24
- # The assigns (`@item`, `@config`, …) will be available in the partial. It
25
- # is also possible to pass custom assigns to the method; these assigns
26
- # will be made available as instance variables inside the partial.
27
- #
28
- # @param [String] identifier The identifier of the layout that should be
29
- # rendered
30
- #
31
- # @param [Hash] other_assigns A hash containing extra assigns that will be
32
- # made available as instance variables in the partial
33
- #
34
- # @example Rendering a head and a foot partial around some text
35
- #
36
- # <%= render 'head' %> - MIDDLE - <%= render 'foot' %>
37
- # # => "HEAD - MIDDLE - FOOT"
38
- #
39
- # @example Rendering a head partial with a custom title
40
- #
41
- # # The 'head' layout
42
- # <h1><%= @title %></h1>
43
- #
44
- # # The item/layout where the partial is rendered
45
- # <%= render 'head', :title => 'Foo' %>
46
- # # => "<h1>Foo</h1>"
47
- #
48
- # @example Yielding inside a partial
49
- #
50
- # # The 'box' partial
51
- # <div class="box">
52
- # <%= yield %>
53
- # </div>
54
- #
55
- # # The item/layout where the partial is rendered
56
- # <% render 'box' do %>
57
- # I'm boxy! Luvz!
58
- # <% end %>
59
- #
60
- # # Result
61
- # <div class="box">
62
- # I'm boxy! Luvz!
63
- # </div>
64
- #
65
- # @raise [Nanoc::Int::Errors::UnknownLayout] if the given layout does not
66
- # exist
67
- #
68
- # @raise [Nanoc::Int::Errors::CannotDetermineFilter] if there is no layout
69
- # rule for the given layout
70
- #
71
- # @raise [Nanoc::Int::Errors::UnknownFilter] if the layout rule for the given
72
- # layout specifies an unknown filter
73
- #
74
- # @return [String, nil] The rendered partial, or nil if this method was
75
- # invoked with a block
13
+ # @return [String, nil]
76
14
  def render(identifier, other_assigns = {}, &block)
77
15
  # Find layout
78
16
  layout = @layouts[identifier]
@@ -1,31 +1,14 @@
1
1
  module Nanoc::Helpers
2
- # Provides support for managing tags added to items.
3
- #
4
- # To add tags to items, set the `tags` attribute to an array of tags that
5
- # should be applied to the item.
6
- #
7
- # @example Adding tags to an item
8
- #
9
- # tags: [ 'foo', 'bar', 'baz' ]
2
+ # @see http://nanoc.ws/doc/reference/helpers/#tagging
10
3
  module Tagging
11
4
  require 'nanoc/helpers/html_escape'
12
5
  include Nanoc::Helpers::HTMLEscape
13
6
 
14
- # Returns a formatted list of tags for the given item as a string. The
15
- # tags will be linked using the {#link_for_tag} function; the
16
- # HTML-escaping rules for {#link_for_tag} apply here as well.
7
+ # @param [String] base_url
8
+ # @param [String] none_text
9
+ # @param [String] separator
17
10
  #
18
- # @param [String] base_url The URL to which the tag will be appended
19
- # to construct the link URL. This URL must have a trailing slash. The
20
- # function will return a tags string without tag page link if the param
21
- # is not provided.
22
- #
23
- # @param [String] none_text The text to display when
24
- # the item has no tags
25
- #
26
- # @param [String] separator The separator to put between tags
27
- #
28
- # @return [String] A hyperlinked list of tags for the given item
11
+ # @return [String]
29
12
  def tags_for(item, base_url: nil, none_text: '(none)', separator: ', ')
30
13
  if item[:tags].nil? || item[:tags].empty?
31
14
  none_text
@@ -34,26 +17,17 @@ module Nanoc::Helpers
34
17
  end
35
18
  end
36
19
 
37
- # Find all items with the given tag.
20
+ # @param [String] tag
38
21
  #
39
- # @param [String] tag The tag for which to find all items
40
- #
41
- # @return [Array] All items with the given tag
22
+ # @return [Array]
42
23
  def items_with_tag(tag)
43
24
  @items.select { |i| (i[:tags] || []).include?(tag) }
44
25
  end
45
26
 
46
- # Returns a link to to the specified tag. The link is marked up using the
47
- # rel-tag microformat. The `href` attribute of the link will be HTML-
48
- # escaped, as will the content of the `a` element.
49
- #
50
- # @param [String] tag The name of the tag, which should consist of letters
51
- # and numbers (no spaces, slashes, or other special characters).
52
- #
53
- # @param [String] base_url The URL to which the tag will be appended to
54
- # construct the link URL. This URL must have a trailing slash.
27
+ # @param [String] tag
28
+ # @param [String] base_url
55
29
  #
56
- # @return [String] A link for the given tag and the given base URL
30
+ # @return [String]
57
31
  def link_for_tag(tag, base_url)
58
32
  %(<a href="#{h base_url}#{h tag}" rel="tag">#{h tag}</a>)
59
33
  end
@@ -1,19 +1,11 @@
1
1
  module Nanoc::Helpers
2
- # Contains several useful text-related helper functions.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#text
3
3
  module Text
4
- # Returns an excerpt for the given string. HTML tags are ignored, so if
5
- # you don't want them to turn up, they should be stripped from the string
6
- # before passing it to the excerpt function.
4
+ # @param [String] string
5
+ # @param [Number] length
6
+ # @param [String] omission
7
7
  #
8
- # @param [String] string The string for which to build an excerpt
9
- #
10
- # @param [Number] length The maximum number of characters
11
- # this excerpt can contain, including the omission.
12
- #
13
- # @param [String] omission The string to append to the
14
- # excerpt when the excerpt is shorter than the original string
15
- #
16
- # @return [String] The excerpt of the given string
8
+ # @return [String]
17
9
  def excerptize(string, length: 25, omission: '...')
18
10
  if string.length > length
19
11
  excerpt_length = [0, length - omission.length].max
@@ -23,11 +15,9 @@ module Nanoc::Helpers
23
15
  end
24
16
  end
25
17
 
26
- # Strips all HTML tags out of the given string.
27
- #
28
- # @param [String] string The string from which to strip all HTML
18
+ # @param [String] string
29
19
  #
30
- # @return [String] The given string with all HTML stripped
20
+ # @return [String]
31
21
  def strip_html(string)
32
22
  # FIXME: will need something more sophisticated than this, because it sucks
33
23
  string.gsub(/<[^>]*(>+|\s*\z)/m, '').strip
@@ -1,40 +1,10 @@
1
1
  module Nanoc::Helpers
2
- # Contains functionality for building XML sitemaps that will be crawled by
3
- # search engines. See the [Sitemaps protocol site](http://www.sitemaps.org)
4
- # for details.
2
+ # @see http://nanoc.ws/doc/reference/helpers/#xmlsitemap
5
3
  module XMLSitemap
6
- # Builds an XML sitemap and returns it.
4
+ # @option params [Array] :items
5
+ # @option params [Proc] :rep_select
7
6
  #
8
- # The following attributes can optionally be set on items to change the
9
- # behaviour of the sitemap:
10
- #
11
- # * `changefreq` — The estimated change frequency as defined by the
12
- # Sitemaps protocol
13
- #
14
- # * `priority` — The item's priority, ranging from 0.0 to 1.0, as defined
15
- # by the Sitemaps protocol
16
- #
17
- # The sitemap will also include dates on which the items were updated.
18
- # These are generated automatically; the way this happens depends on the
19
- # used data source (the filesystem data source checks the file mtimes, for
20
- # instance).
21
- #
22
- # The site configuration will need to have the following attributes:
23
- #
24
- # * `base_url` — The URL to the site, without trailing slash. For example,
25
- # if the site is at "http://example.com/", the `base_url` would be
26
- # "http://example.com".
27
- #
28
- # @example Excluding binary items from the sitemap
29
- #
30
- # <%= xml_sitemap :items => @items.reject{ |i| i[:is_hidden] || i.binary? } %>
31
- #
32
- # @option params [Array] :items A list of items to include in the sitemap
33
- #
34
- # @option params [Proc] :rep_select A proc to filter reps through. If the
35
- # proc returns true, the rep will be included; otherwise, it will not.
36
- #
37
- # @return [String] The XML sitemap
7
+ # @return [String]
38
8
  def xml_sitemap(params = {})
39
9
  require 'builder'
40
10
 
data/lib/nanoc/spec.rb CHANGED
@@ -47,8 +47,9 @@ module Nanoc
47
47
  # @param [Nanoc::ItemWithRepsView] item The item to create a represetation for
48
48
  #
49
49
  # @param [String] path The path of the `:last` snapshot of this item representation
50
- def create_rep(item, path)
51
- rep = Nanoc::Int::ItemRep.new(item.unwrap, :default)
50
+ # @param [Symbol] rep The rep name to create
51
+ def create_rep(item, path, rep = :default)
52
+ rep = Nanoc::Int::ItemRep.new(item.unwrap, rep)
52
53
  rep.paths[:last] = path
53
54
  @reps << rep
54
55
  Nanoc::ItemRepView.new(rep, view_context)
data/lib/nanoc/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.2.4'.freeze
3
+ VERSION = '4.3.0'.freeze
4
4
  end
data/tasks/rubocop.rake CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubocop/rake_task'
2
2
 
3
3
  RuboCop::RakeTask.new(:rubocop) do |task|
4
- task.options = %w( --display-cop-names --format simple )
4
+ task.options = %w(--display-cop-names --format simple)
5
5
  task.patterns = ['bin/nanoc', 'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb']
6
6
  end
data/tasks/test.rake CHANGED
@@ -4,7 +4,7 @@ require 'coveralls/rake/task'
4
4
 
5
5
  Coveralls::RakeTask.new
6
6
 
7
- SUBDIRS = %w( * base cli data_sources extra filters helpers ).freeze
7
+ SUBDIRS = %w(* base cli data_sources extra filters helpers).freeze
8
8
 
9
9
  namespace :test do
10
10
  SUBDIRS.each do |dir|
@@ -6,9 +6,15 @@ class Nanoc::CLI::CleaningStreamTest < Nanoc::TestCase
6
6
  @called_methods = Set.new
7
7
  end
8
8
 
9
+ # rubocop:disable Style/MethodMissing
9
10
  def method_missing(symbol, *_args)
10
11
  @called_methods << symbol
11
12
  end
13
+ # rubocop:enable Style/MethodMissing
14
+
15
+ def respond_to_missing?(*_args)
16
+ true
17
+ end
12
18
  end
13
19
 
14
20
  def test_forward
@@ -48,7 +48,7 @@ class Nanoc::CLI::ErrorHandlerTest < Nanoc::TestCase
48
48
 
49
49
  def new_error(amount_factor)
50
50
  backtrace_generator = lambda do |af|
51
- if af == 0
51
+ if af.zero?
52
52
  raise 'finally!'
53
53
  else
54
54
  backtrace_generator.call(af - 1)
@@ -52,7 +52,7 @@ class Nanoc::Extra::Checking::Checks::ExternalLinksTest < Nanoc::TestCase
52
52
  # Create check
53
53
  check = Nanoc::Extra::Checking::Checks::ExternalLinks.create(site)
54
54
  def check.request_url_once(url, req_method = Net::HTTP::Head)
55
- Net::HTTPResponse.new('1.1', (req_method == Net::HTTP::Head || url.path == '/405') ? '405' : '200', 'okay')
55
+ Net::HTTPResponse.new('1.1', req_method == Net::HTTP::Head || url.path == '/405' ? '405' : '200', 'okay')
56
56
  end
57
57
 
58
58
  # Test
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.4
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-24 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -86,7 +86,6 @@ extra_rdoc_files:
86
86
  - README.md
87
87
  - NEWS.md
88
88
  files:
89
- - CONTRIBUTING.md
90
89
  - ChangeLog
91
90
  - Gemfile
92
91
  - Gemfile.lock
data/CONTRIBUTING.md DELETED
@@ -1,38 +0,0 @@
1
- Contributing
2
- ============
3
-
4
- Reporting bugs
5
- --------------
6
-
7
- If you find a bug in Nanoc, you should report it! Some information that you should include in your bug report is the Nanoc version (`nanoc --version`) and, if relevant, the crash log (`crash.log`).
8
-
9
- For details, check the [*bug reporting* section of the development guide](http://nanoc.ws/development/#reporting-bugs).
10
-
11
- Contributing code
12
- -----------------
13
-
14
- Pull requests are appreciated! When submitting a PR, be sure to submit it onto the right branch:
15
-
16
- * For bug fixes, use the release branch, e.g. `release-3.6.x`
17
- * For features, use the `master` branch
18
-
19
- When submitting a PR, make sure that your changes have covering tests, that the documentation remains up-to-date and that you retain backwards compatibility.
20
-
21
- For details, check the [*contributing code* section of the development guide](http://nanoc.ws/development/#contributing-code).
22
-
23
- Contributor Code of Conduct
24
- ---------------------------
25
-
26
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
27
-
28
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
29
-
30
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
31
-
32
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
33
-
34
- This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
35
-
36
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
37
-
38
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.1.0, available at [http://contributor-covenant.org/version/1/1/0/](http://contributor-covenant.org/version/1/1/0/)