nanoc3 3.0.3 → 3.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS.rdoc CHANGED
@@ -1,5 +1,11 @@
1
1
  = nanoc News
2
2
 
3
+ == 3.0.4
4
+
5
+ * Fixed a bug which would cause the filesystem_compact data source to
6
+ incorrectly determine the content filename, leading to weird “Expected 1
7
+ content file but found 3” errors [Eric Sunshine]
8
+
3
9
  == 3.0.3
4
10
 
5
11
  * The Blogging helper now properly handles item reps without paths
data/README.rdoc CHANGED
@@ -67,9 +67,9 @@ You may need to manually install the rdoc gem and update the rubygems installati
67
67
 
68
68
  (In alphabetical order)
69
69
 
70
- * Christian Plessl
71
70
  * Colin Barrett
72
71
  * Dmitry Bilunov
72
+ * Christian Plessl
73
73
  * Šime Ramov
74
74
  * "Soryu"
75
75
  * Dennis Sutch
@@ -31,6 +31,10 @@ module Nanoc3::DataSources
31
31
  # can have an 'index.txt' content file and a 'meta.yaml' meta file. This is
32
32
  # to preserve backward compatibility.
33
33
  #
34
+ # The identifier is calculated by stripping the extension; if there is more
35
+ # than one extension, only the last extension is stripped and the previous
36
+ # extensions will be part of the identifier.
37
+ #
34
38
  # = Layouts
35
39
  #
36
40
  # Layouts are stored as directories in the 'layouts' directory. Each layout
@@ -42,6 +46,9 @@ module Nanoc3::DataSources
42
46
  # 'layouts' directory. Such a layout cannot have any metadata; the filter
43
47
  # used for this layout is determined from the file extension.
44
48
  #
49
+ # The identifier for layouts is generated the same way as identifiers for
50
+ # items (see above for details).
51
+ #
45
52
  # = Code Snippets
46
53
  #
47
54
  # Code snippets are stored in '.rb' files in the 'lib' directory. Code
@@ -19,7 +19,10 @@ module Nanoc3::DataSources
19
19
  # The identifier of a item is determined as follows. A file with an
20
20
  # 'index.*' filename, such as 'index.txt', will have the filesystem path
21
21
  # with the 'index.*' part stripped as a identifier. For example,
22
- # 'foo/bar/index.html' will have '/foo/bar/' as identifier.
22
+ # 'foo/bar/index.html' will have '/foo/bar/' as identifier. In other cases,
23
+ # the identifier is calculated by stripping the extension; if there is more
24
+ # than one extension, only the last extension is stripped and the previous
25
+ # extensions will be part of the identifier.
23
26
  #
24
27
  # A file with a filename not starting with 'index.', such as 'foo.html',
25
28
  # will have an identifier ending in 'foo/'. For example, 'foo/bar.html' will
@@ -46,6 +49,9 @@ module Nanoc3::DataSources
46
49
  # each layout consists of a metadata part and a content part, separated by
47
50
  # '---' (three dashes).
48
51
  #
52
+ # The identifier for layouts is generated the same way as identifiers for
53
+ # items (see above for details).
54
+ #
49
55
  # = Code Snippets
50
56
  #
51
57
  # Code snippets are stored in '.rb' files in the 'lib' directory. Code
@@ -25,6 +25,10 @@ module Nanoc3::DataSources
25
25
  # nested in directories and named "index" such as the home page item, or
26
26
  # they can simply be given a non-"index" name.
27
27
  #
28
+ # The identifier is calculated by stripping the extension; if there is more
29
+ # than one extension, only the last extension is stripped and the previous
30
+ # extensions will be part of the identifier.
31
+ #
28
32
  # For example, this directory structure:
29
33
  #
30
34
  # content/
@@ -42,6 +46,8 @@ module Nanoc3::DataSources
42
46
  # a-very-old-post.yaml
43
47
  # another-very-old-post.html
44
48
  # another-very-old-post.yaml
49
+ # foo.entry.html
50
+ # foo.entry.yaml
45
51
  # myst/
46
52
  # index.html
47
53
  # index.yaml
@@ -54,6 +60,7 @@ module Nanoc3::DataSources
54
60
  # /journal/2005/
55
61
  # /journal/2005/a-very-old-post/
56
62
  # /journal/2005/another-very-old-post/
63
+ # /journal/2005/foo.entry/
57
64
  # /myst/
58
65
  #
59
66
  # = Layouts
@@ -61,6 +68,9 @@ module Nanoc3::DataSources
61
68
  # Layouts are stored the same way as items, except that they are stored in
62
69
  # the "layouts" directory instead of the "content" directory.
63
70
  #
71
+ # The identifier for layouts is generated the same way as identifiers for
72
+ # items (see above for details).
73
+ #
64
74
  # = Code Snippets
65
75
  #
66
76
  # Code snippets are stored in '.rb' files in the 'lib' directory. Code
@@ -177,14 +187,18 @@ module Nanoc3::DataSources
177
187
  ########## Custom functions ##########
178
188
 
179
189
  # Returns the identifier for the given meta filename. This method assumes
180
- # that the base is already stripped.
190
+ # that the base is already stripped. The identifier is calculated by
191
+ # stripping the extension; if there is more than one extension, only the
192
+ # last extension is stripped and the previous extensions will be part of
193
+ # the identifier.
181
194
  #
182
195
  # For example:
183
196
  #
184
- # /foo.yaml -> /foo/
185
- # /foo/index.yaml -> /foo/
186
- # /foo/foo.yaml -> /foo/foo/
187
- # /foo/bar.yaml -> /foo/bar/
197
+ # /foo.yaml -> /foo/
198
+ # /foo/index.yaml -> /foo/
199
+ # /foo/foo.yaml -> /foo/foo/
200
+ # /foo/bar.yaml -> /foo/bar/
201
+ # /foo/bar.entry.yaml -> /foo/bar.entry/
188
202
  def identifier_for_meta_filename(meta_filename)
189
203
  # Split into components
190
204
  components = meta_filename.gsub(%r{(^/|/$)}, '').split('/')
@@ -210,7 +224,7 @@ module Nanoc3::DataSources
210
224
  # Find all files
211
225
  base_filename = File.basename(meta_filename, '.yaml')
212
226
  dirname = File.dirname(meta_filename)
213
- filenames = Dir.entries(dirname).select { |f| f =~ /#{base_filename}\.[^.]+$/ }.map { |f| "#{dirname}/#{f}" }
227
+ filenames = Dir.entries(dirname).select { |f| f =~ /^#{base_filename}\.[^.]+$/ }.map { |f| "#{dirname}/#{f}" }
214
228
 
215
229
  # Reject meta files
216
230
  filenames.reject! { |f| f =~ /\.yaml$/ }
@@ -13,7 +13,9 @@ module Nanoc3::Helpers
13
13
  include Nanoc3::Helpers::HTMLEscape
14
14
 
15
15
  # Creates a HTML link to the given path or item representation, and with
16
- # the given text.
16
+ # the given text. All attributes of the `a` element, including the `href`
17
+ # attribute, will be HTML-escaped; the contents of the `a` element, which
18
+ # can contain markup, will not be HTML-escaped.
17
19
  #
18
20
  # +path_or_rep+:: the URL or path (a String) that should be linked to, or
19
21
  # the item representation that should be linked to.
@@ -49,7 +51,8 @@ module Nanoc3::Helpers
49
51
 
50
52
  # Creates a HTML link using link_to, except when the linked item is the
51
53
  # current one. In this case, a span element with class "active" and with
52
- # the given text will be returned.
54
+ # the given text will be returned. The HTML-escaping rules for `link_to`
55
+ # apply here as well.
53
56
  #
54
57
  # Examples:
55
58
  #
@@ -71,7 +74,7 @@ module Nanoc3::Helpers
71
74
  end
72
75
 
73
76
  # Returns the relative path from the current item to the given path or
74
- # item representation.
77
+ # item representation. The returned path will not be HTML-escaped.
75
78
  #
76
79
  # +path_or_rep+:: the URL or path (a String) to where the relative should
77
80
  # point, or the item representation to which the relative
@@ -16,8 +16,10 @@ module Nanoc3::Helpers
16
16
  require 'nanoc3/helpers/html_escape'
17
17
  include Nanoc3::Helpers::HTMLEscape
18
18
 
19
- # Returns a formatted list of tags for the given item as a string. Several
20
- # parameters allow customization:
19
+ # Returns a formatted list of tags for the given item as a string. The
20
+ # tags will be linked using the `link_for_tag` function; the HTML-escaping
21
+ # rules for this function apply here as well. Several parameters allow
22
+ # customization:
21
23
  #
22
24
  # :base_url:: The URL to which the tag will be appended to construct the
23
25
  # link URL. This URL must have a trailing slash. Defaults to
@@ -45,7 +47,8 @@ module Nanoc3::Helpers
45
47
  end
46
48
 
47
49
  # Returns a link to to the specified tag. The link is marked up using the
48
- # rel-tag microformat.
50
+ # rel-tag microformat. The `href` attribute of the link will be HTML-
51
+ # escaped, as will the content of the `a` element.
49
52
  #
50
53
  # +tag+:: The name of the tag, which should consist of letters and numbers
51
54
  # (no spaces, slashes, or other special characters).
data/lib/nanoc3.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Nanoc3
4
4
 
5
5
  # The current nanoc version.
6
- VERSION = '3.0.3'
6
+ VERSION = '3.0.4'
7
7
 
8
8
  end
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-07 00:00:00 +01:00
12
+ date: 2010-01-08 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15