middleman-pagegroups 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -1
  3. data/.yardopts +8 -0
  4. data/CHANGELOG.md +24 -4
  5. data/README.md +5 -5
  6. data/Rakefile +201 -7
  7. data/documentation_project/Gemfile +2 -2
  8. data/documentation_project/config.rb +15 -19
  9. data/documentation_project/source/documentation/100_nested_folder/another_file.html.md.erb +19 -0
  10. data/documentation_project/source/documentation/100_nested_folder/index.html.md.erb +25 -0
  11. data/documentation_project/source/documentation/100_nested_folder/one_file.html.md.erb +11 -0
  12. data/documentation_project/source/documentation/100_nested_folder/stray.txt +6 -0
  13. data/documentation_project/source/documentation/10_concepts.html.md.erb +1 -1
  14. data/documentation_project/source/documentation/20_directory_organization.html.md.erb +12 -10
  15. data/documentation_project/source/documentation/40_resources.html.md.erb +3 -68
  16. data/documentation_project/source/documentation/50_helpers.html.md.erb +41 -163
  17. data/documentation_project/source/documentation/60_sample_partials.html.md.erb +23 -22
  18. data/documentation_project/source/documentation/80_config.html.md.erb +6 -0
  19. data/documentation_project/source/documentation/90_cli.html.md.erb +47 -0
  20. data/documentation_project/source/partials/_yard_config.erb +744 -0
  21. data/documentation_project/source/partials/_yard_helpers.erb +710 -0
  22. data/documentation_project/source/partials/_yard_helpers_css.erb +523 -0
  23. data/documentation_project/source/partials/_yard_helpers_extended.erb +56 -0
  24. data/documentation_project/source/partials/_yard_resources.erb +540 -0
  25. data/documentation_project/source/stylesheets/_middlemac_minimal.scss +287 -0
  26. data/features/helpers_and_resources.feature +120 -0
  27. data/features/support/env.rb +20 -0
  28. data/fixtures/middleman_pagegroups_app/config.rb +17 -0
  29. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/index.html.md.erb +8 -0
  30. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/not_legitimate.html.md.erb +8 -0
  31. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/sibling_one.html.md.erb +8 -0
  32. data/fixtures/middleman_pagegroups_app/source/20_sub_folder_02/sibling_two.html.md.erb +8 -0
  33. data/fixtures/middleman_pagegroups_app/source/_partial.md.erb +111 -0
  34. data/fixtures/middleman_pagegroups_app/source/index.html.md.erb +23 -0
  35. data/fixtures/middleman_pagegroups_app/source/layout.erb +6 -0
  36. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/10_sibling_one.html.md.erb +7 -0
  37. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/20_sibling_two.html.md.erb +7 -0
  38. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/30_sibling_three.html.md.erb +7 -0
  39. data/fixtures/middleman_pagegroups_app/source/sub_folder_01/index.html.md.erb +9 -0
  40. data/lib/middleman-pagegroups/extension.rb +468 -110
  41. data/lib/middleman-pagegroups/partials.rb +9 -12
  42. data/lib/middleman-pagegroups/version.rb +1 -1
  43. data/middleman-pagegroups.gemspec +10 -2
  44. data/yard/readme.md +5 -0
  45. data/yard/template-grouped/default/module/html/method_details_list.erb +11 -0
  46. data/yard/template-partials/default/method_details/setup.rb +4 -0
  47. data/yard/template-partials/default/module/html/attribute_details.erb +9 -0
  48. data/yard/template-partials/default/module/html/method_details_list.erb +10 -0
  49. data/yard/template-partials/default/module/setup.rb +6 -0
  50. data/yard/template-partials/default/onefile/html/layout.erb +1 -0
  51. data/yard/template-partials/default/onefile/html/setup.rb +4 -0
  52. data/yard/yard_extensions.rb +109 -0
  53. metadata +105 -7
@@ -0,0 +1,11 @@
1
+ ---
2
+ title: One File
3
+ blurb: This is just a file with a sort order of 20 specified in its front
4
+ matter.
5
+ layout: template-logo-medium
6
+ order: 20
7
+ ---
8
+
9
+ # <%= current_page.data.title %>
10
+
11
+ <%= current_page.data.blurb %>
@@ -0,0 +1,6 @@
1
+ Stray.txt
2
+ ---------
3
+
4
+ This is just a non-rendered file that's tagging along for the ride. It
5
+ demonstrates that non-page numbered assets are put into the proper directory
6
+ when the directory is renamed.
@@ -36,7 +36,7 @@ management of **sort order**, **groups** (including nested groups), and making
36
36
  a determination about the **legitimacy** of these relationships.
37
37
 
38
38
  It provides helpers and sample partials to enable **breadcrumbs**, **previous**
39
- and *next** buttons, **tables of contents**, and **related pages**, all using
39
+ and **next** buttons, **tables of contents**, and **related pages**, all using
40
40
  the concepts that enable automatic navigation.
41
41
 
42
42
 
@@ -22,11 +22,12 @@ Briefly the role of the directory layout convention is this:
22
22
  `parent` of the group.
23
23
 
24
24
 
25
- Each group must include at least one file that will render into `index.html`.
26
- This file serves as the parent to the group. As such, the top-level document
27
- of any project is `source/html.index` which is a familiar expectation in any
28
- HTML project, and the default, top-level document for any nested directory is
29
- also `index.html`, which is consistent with practices to which you are no doubt
25
+ Each group must include at least one file that will render into `index.html` (or
26
+ whatever your `config[:index_file]` is for the more advanced among you). This
27
+ file serves as the parent to the group. As such, the top-level document of any
28
+ project is `source/html.index` which is a familiar expectation in any HTML
29
+ project, and the default, top-level document for any nested directory is also
30
+ `index.html`, which is consistent with practices to which you are no doubt
30
31
  already accustomed.
31
32
 
32
33
  One important novelty of `middleman-pagegroups` is that a group’s `index.html`
@@ -69,17 +70,18 @@ page’s `:order`, it’s sometimes convenient for developers to arrange files i
69
70
  order in their filesystem, too. This is supported by `middleman-pagegroups`,
70
71
  too.
71
72
 
72
- Simply prefix your filename with any integer followed by an underscore, e.g.,
73
- the source file for this page is `20_directory_organization.html.md.erb`.
73
+ Simply prefix your filename (including group directories) with any integer
74
+ followed by an underscore, e.g., the source file for this page is
75
+ `20_directory_organization.html.md.erb`.
74
76
 
75
77
  In order to avoid ugly URIs (e.g., `20_directory_organization.html`) make sure
76
78
  that your [`config.rb`](config) file sets `strip_file_prefixes` to `true`, which
77
79
  will rewrite page names without the order specifiers (e.g.,
78
80
  `directory_organization.html`).
79
81
 
80
- Filename sort order prefixes only work for non-group files, however. Groups and
81
- their `index.html` files cannot be magically numbered in this way. You _must_
82
- use the front matter `:order` key in `index.html` files, instead.
82
+ Filename sort order prefixes do not work on `index.html` files for a group; use
83
+ a sort order prefix on its enclosing directory instead. The sample
84
+ `nested_folder` in this project is numbered in this way.
83
85
  {:.note}
84
86
 
85
87
  Front matter `:order` will override any order specified by file names.
@@ -8,72 +8,7 @@ navigator: true
8
8
 
9
9
  # <%= current_page.data.title %>
10
10
 
11
- The built-in resource additions can be useful in designing your own
12
- partials, templates, and helpers.
11
+ The built-in resource extensions can be useful in designing your own
12
+ partials, templates, and helpers, and are usually accessed within them.
13
13
 
14
- ## Resources
15
-
16
- Resource extensions are usually accessed in your templates, partials, and
17
- helpers with `current_page`, and so the descriptions below will use this as an
18
- example. However keep in mind that these methods apply to _any_ resource.
19
-
20
- `current_page.breadcrumbs`
21
-
22
- : Returns an array of pages leading to the specified page.
23
-
24
- `current_page.brethren`
25
-
26
- : Returns an array of all of the legitimate siblings of the specified page,
27
- returning them by ascending sort order.
28
-
29
- `current_page.brethren_next`
30
-
31
- : Returns the next legitimate sibling of the specified page, or `nil` if it’s
32
- already the last page.
33
-
34
- `current_page.brethren_previous`
35
-
36
- : Returns the previous legitimate sibling of the specified page, or `nil` if
37
- it’s already the first page.
38
-
39
- `current_page.group_count`
40
-
41
- : Indicates the number of pages that are in the current group.
42
-
43
- `current_page.legitimate_children`
44
-
45
- : Returns an array of all of the specified page’s legitimate children, sorted
46
- in ascending order by their sort order.
47
-
48
- `current_page.navigator_eligible?`
49
-
50
- : Indicates whether or not the page is eligible for displaying a previous/next
51
- page indicator. It’s eligible if all of these conditions are met:
52
-
53
- - Its parent has front matter key `navigate` set to true.
54
- - It does _not_ have a front matter key `navigator` set to false.
55
- - It’s a legitimate page, i.e., has a sort order, not ignored, etc.
56
-
57
- `current_page.page_group`
58
-
59
- : Indicates the name of the current page group. This can be useful for setting
60
- up CSS and performing conditional tasks. The name of the group is simply
61
- the name of the containing directory. Group names might not be unique.
62
-
63
- `current_page.page_name`
64
-
65
- : Indicates the name of the current page. This can be useful for setting up
66
- CSS and performing conditional tasks. The name of the page is simply the
67
- output page name without an extension. Page names might not be unique.
68
-
69
- `current_page.page_sequence`
70
-
71
- : Indicates the sequence of the page within its group, starting with one. You
72
- might use this directly as a page number, or use it indirectly if your page
73
- numbers don’t start at one.
74
-
75
- Pages without sort orders will return `nil` for this value.
76
-
77
- `current_page.sort_order`
78
-
79
- : Indicates the sort order of the page, or 0 if no order has been assigned.
14
+ <%= partial 'partials/yard_resources' %>
@@ -14,71 +14,32 @@ helpers to access some of the extension defaults within your helpers, partials,
14
14
  and pages. Also included are several helpers that generate reasonable automatic
15
15
  navigation output into your pages.
16
16
 
17
+ * * *
18
+
17
19
  ## Extended Helpers
18
20
 
19
- Some of Middleman’s built-in helpers are extended in order to offer more
21
+ This extension extends **Middleman** built-in helpers in order to offer more
20
22
  features.
21
23
 
22
- `page_classes`
24
+ <%= partial 'partials/yard_helpers_extended' %>
23
25
 
24
- : If you’ve enabled `extend_page_class` in your [`config.rb`](config)
25
- file, then `middleman-pagegroups` will add the current `page_name` and
26
- `page_group` to the `page_classes` output. Default Middleman project
27
- templates include this as the `<body class="…"` content.
28
-
29
- Here is the result of `page_classes` right now: `<%= page_classes %>`
26
+ The current value of `page_classes` is "`<%= page_classes %>`".
30
27
 
28
+ * * *
31
29
 
32
- ## Access to Extension Configuration Settings
30
+ ## Helpers to Access Configuration Settings
33
31
 
34
32
  [Configuration settings](config) that are useful for the output-producing
35
- helpers and for the default partials are exposed via helpers. They are shown
36
- below, and the current values for this project are shown as an example.
37
-
38
- `nav_breadcrumbs_class`
39
-
40
- : Exposes `nav_breadcrumbs_class`, currently `<%= nav_breadcrumbs_class %>`
41
-
42
- `nav_breadcrumbs_alt_class`
43
-
44
- : Exposes `nav_breadcrumbs_alt_class`, currently `<%= nav_breadcrumbs_alt_class %>`
45
-
46
- `nav_breadcrumbs_alt_label`
47
-
48
- : Exposes `nav_breadcrumbs_alt_label`, currently `<%= nav_breadcrumbs_alt_label %>`
49
-
50
- `nav_brethren_class`
51
-
52
- : Exposes `nav_brethren_class`, currently `<%= nav_brethren_class %>`
53
-
54
- `nav_brethren_index_class`
55
-
56
- : Exposes `nav_brethren_index_class`, currently `<%= nav_brethren_index_class %>`
57
-
58
- `nav_legitimate_children_class`
59
-
60
- : Exposes `nav_legitimate_children_class`, currently `<%= nav_legitimate_children_class %>`
61
-
62
- `nav_prev_next_class`
63
-
64
- : Exposes `nav_prev_next_class`, currently `<%= nav_prev_next_class %>`
65
-
66
- `nav_prev_next_label_prev`
33
+ helpers and for the default partials are exposed via helpers.
67
34
 
68
- : Exposes `nav_prev_next_label_prev`, currently `<%= nav_prev_next_label_prev %>`
69
-
70
- `nav_prev_next_label_next`
71
-
72
- : Exposes `nav_prev_next_label_next`, currently `<%= nav_prev_next_label_next %>`
73
-
74
- `nav_toc_index_class`
75
-
76
- : Exposes `nav_breadcrumbs_alt_class`, currently `<%= nav_breadcrumbs_alt_class %>`
35
+ <%= partial 'partials/yard_helpers_css' %>
77
36
 
78
37
  Note that these are all read-only. These aren’t variables; they’re helpers, and
79
38
  they are simply providing a variable value to you.
80
39
  {:.note}
81
40
 
41
+ * * *
42
+
82
43
  ## Output Helpers
83
44
 
84
45
  Output helpers generate most of the automatic navigation features. They’re handy
@@ -89,9 +50,9 @@ Each of these helpers accepts an optional parameter called `locals` which, if
89
50
  used, must be a hash. For the locals to be useful, the hash must consist of
90
51
  useful key value pairs.
91
52
 
92
- All of the helpers accept a `:class` or `:klass` local. If present then the
93
- navigation feature enclose `div` will be set to that class, otherwise the
94
- default from your [config.rb](config) will be used.
53
+ All of the helpers accept a `:klass` local. If present then the navigation
54
+ feature enclosing `div` will be set to that class, otherwise the default from
55
+ your [config.rb](config) will be used.
95
56
 
96
57
  Middleman geek knowledge: these helpers are implemented internally as partials
97
58
  using the same code as used to generate the sample partials, except for
@@ -100,104 +61,46 @@ is the reason that the parameter is referred to a `locals`. It’s also the
100
61
  reason that we have to internally use `klass` instead of `class`.
101
62
  {:.note}
102
63
 
103
- For each helper below, the information shown consists of:
104
-
105
- - A brief description of the helper.
106
- - A description of the `locals` keys that can be used.
107
- - Sample HTML output, generated from using the helper in this project.
64
+ <%= partial 'partials/yard_helpers' %>
108
65
 
109
66
  * * *
110
67
 
111
- ### `nav_breadcrumbs( locals )`
68
+ ## Output Helpers’ Examples
112
69
 
113
- Generate a breadcrumbs structure as an `<ul>`. The trailing element is
114
- the current page.
70
+ The examples below illustrate the output of each of the output helpers as they
71
+ are generated on this very page.
115
72
 
116
- `:class`
117
-
118
- : Specify the class of the containing `<div>`.
119
-
73
+ <dl class="examples_list">
74
+ <dt>nav_breadcrumbs</dt>
75
+ <dd markdown="1">
120
76
  ~~~ html
121
77
  <%= nav_breadcrumbs %>
122
78
  ~~~
79
+ </dd>
123
80
 
124
- * * *
125
-
126
- ### `nav_breadcrumbs_alt( locals )`
127
-
128
- Generate the breadcrumbs structure, alternate form, wherein the trailing element
129
- consists of a label indicating “current page,” as an `<ul>`.
130
-
131
- `:class`
132
-
133
- : Specify the class of the containing `<div>`.
134
-
135
- `:label`
136
-
137
- : Specify the label to use to mark the current page.
138
-
81
+ <dt>nav_breadcrumbs_alt</dt>
82
+ <dd markdown="1">
139
83
  ~~~ html
140
84
  <%= nav_breadcrumbs_alt %>
141
85
  ~~~
86
+ </dd>
142
87
 
143
- * * *
144
-
145
- ### `nav_brethren( locals )`
146
-
147
- Generate a fuller list of related topics, including blurbs if present, as a
148
- `<dl>`.
149
-
150
- `:class`
151
-
152
- : Specify the class of the containing `<div>`.
153
-
154
- `:start`
155
-
156
- : The resource from which to start the list, e.g., `current_page` or
157
- `current_page.breadcrumbs.first`, or some other resource. The default will
158
- always be `current_page` if this local is not declared.
159
-
88
+ <dt>nav_brethren</dt>
89
+ <dd markdown="1">
160
90
  ~~~ html
161
91
  <%= nav_brethren %>
162
92
  ~~~
93
+ </dd>
163
94
 
164
- * * *
165
-
166
- ### `nav_brethren_index( locals )`
167
-
168
- Generates a condensed list of brethren, omitting blurbs, as a `<dl>`.
169
-
170
- `:class`
171
-
172
- : Specify the class of the containing `<div>`.
173
-
174
- `:start`
175
-
176
- : The resource from which to start the list, e.g., `current_page` or
177
- `current_page.breadcrumbs.first`, or some other resource. The default will
178
- always be `current_page` if this local is not declared.
179
-
95
+ <dt>nav_brethren_index</dt>
96
+ <dd markdown="1">
180
97
  ~~~ html
181
98
  <%= nav_brethren_index %>
182
99
  ~~~
100
+ </dd>
183
101
 
184
- * * *
185
-
186
- ### `nav_legitimate_children( locals )`
187
-
188
- Generate a fuller list of related topics, including blurbs if present, as a
189
- `<dl>`.
190
-
191
- `:class`
192
-
193
- : Specify the class of the containing `<div>`.
194
-
195
- `:start`
196
-
197
- : The resource from which to start the list, e.g., `current_page` or
198
- `current_page.breadcrumbs.first`, or some other resource. The default will
199
- always be `current_page` if this local is not declared.
200
-
102
+ <dt>nav_legitimate_children</dt>
103
+ <dd markdown="1">
201
104
  ~~~ html
202
105
  <%= nav_legitimate_children :start => current_page.breadcrumbs.first %>
203
106
  ~~~
@@ -207,46 +110,21 @@ using `:start => current_page.breadcrumbs.first`. You will note, though, that
207
110
  because it was generated on _this_ page, all of the links appropriately reflect
208
111
  the correct path to get to those pages from _here_.
209
112
  {:.note}
113
+ </dd>
210
114
 
211
- * * *
212
-
213
- ### `nav_prev_next( locals )`
214
-
215
- Generate a previous and next button as two anchors nested within a `<div>`.
216
-
217
- `:class`
218
-
219
- : Specify the class of the containing `<div>`.
220
-
221
- `:label_previous`
222
-
223
- : Label for previous button.
224
-
225
- `:label_next`
226
-
227
- : Label for next button.
228
115
 
116
+ <dt>nav_prev_next</dt>
117
+ <dd markdown="1">
229
118
  ~~~ html
230
119
  <%= nav_prev_next %>
231
120
  ~~~
121
+ </dd>
232
122
 
233
- * * *
234
-
235
- ### `nav_toc_index( locals )`
236
-
237
- Generate a nested `<ul>` structure representing the complete table of contents
238
- from any particular starting point.
239
-
240
- `:class`
241
-
242
- : Specify the class of the containing `<div>`.
243
-
244
- `:start`
245
123
 
246
- : The resource from which to start the index, e.g., `current_page` or
247
- `current_page.breadcrumbs.first`, or some other resource. The default will
248
- always be `current_page` if this local is not declared.
249
-
124
+ <dt>nav_toc_index</dt>
125
+ <dd markdown="1">
250
126
  ~~~ html
251
127
  <%= nav_toc_index :start => current_page.breadcrumbs.first %>
252
128
  ~~~
129
+ </dd>
130
+ </dl>
@@ -25,28 +25,29 @@ current working directory.
25
25
 
26
26
  ## The partials
27
27
 
28
- The partials are named identically to the [helpers of the same name](helpers),
29
- and they work identically and take the same optional `locals` parameters. For
30
- details of these partials, the links lead to [Helpers](helpers).
31
-
32
- **Caveat**: the `locals` parameters work _almost_ the same. For partials, you
33
- must **not** use `:class`; use `:klass` instead. This is a limitation due to
34
- the way that Middleman (really, Padrino) implements partials. These `locals`
35
- become actual, local variables in the helpers, and the word “class” is not a
36
- valid local variable name (it’s a reserved word).
37
- {:.note}
38
-
39
- * * *
40
-
41
- - [`_nav_breadcrumbs.haml`](helpers.html#navbreadcrumbs-locals-)
42
- - [`_nav_breadcrumbs_alt.haml`](helpers.html#navbreadcrumbsalt-locals-)
43
- - [`_nav_brethren_index.haml`](helpers.html#navbrethren-locals-)
44
- - [`_nav_brethren.haml`](helpers.html#navbrethrenindex-locals-)
45
- - [`_nav_legitimate_children.haml`](helpers.html#navlegitimatechildren-locals-)
46
- - [`_nav_prev_next.haml`](helpers.html#navprevnext-locals-)
47
- - [`_nav_toc_index.haml`](helpers.html#navtocindex-locals-)
48
-
49
- * * *
28
+ The partials are named identically to the [output helpers of the same name]
29
+ (helpers), and they work identically and take the same optional `locals`
30
+ parameters. For details of these partials, the refer to the to
31
+ [Helpers](helpers) section.
32
+
33
+ For reference, the list of partials is below:
34
+
35
+ - `_nav_breadcrumbs.haml`
36
+ - `_nav_breadcrumbs_alt.haml`
37
+ - `_nav_brethren_index.haml`
38
+ - `_nav_brethren.haml`
39
+ - `_nav_legitimate_children.haml`
40
+ - `_nav_prev_next.haml`
41
+ - `_nav_toc_index.haml`
42
+
43
+ As per standard **Middleman** conventions, partials’ names begin with an
44
+ underscore to prevent the partial file _per se_ from being output in the build;
45
+ it is not necessary to include the underscore (or the file extension) when using
46
+ the `partial` helper. For example:
47
+
48
+ ~~~ erb
49
+ <%%= partial 'partials/nav_breadcrumbs' %>
50
+ ~~~
50
51
 
51
52
  Middleman geek knowledge: when you generate partials using the
52
53
  `middleman-pagegroups partials` command, it’s not just a file copy. The partials