middleman-pagegroups 1.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +18 -0
- data/LICENSE.md +22 -0
- data/README.md +87 -0
- data/Rakefile +10 -0
- data/bin/middleman-pagegroups +108 -0
- data/documentation_project/.gitignore +25 -0
- data/documentation_project/Gemfile +18 -0
- data/documentation_project/README.md +13 -0
- data/documentation_project/config.rb +109 -0
- data/documentation_project/source/documentation/10_concepts.html.md.erb +111 -0
- data/documentation_project/source/documentation/20_directory_organization.html.md.erb +85 -0
- data/documentation_project/source/documentation/30_frontmatter.html.md.erb +70 -0
- data/documentation_project/source/documentation/40_resources.html.md.erb +79 -0
- data/documentation_project/source/documentation/50_helpers.html.md.erb +252 -0
- data/documentation_project/source/documentation/60_sample_partials.html.md.erb +55 -0
- data/documentation_project/source/documentation/70_sample_layouts.html.md.erb +92 -0
- data/documentation_project/source/documentation/80_config.html.md.erb +98 -0
- data/documentation_project/source/documentation/index.html.md.erb +32 -0
- data/documentation_project/source/documentation/ovum.html.md.erb +27 -0
- data/documentation_project/source/fonts/font-awesome/FontAwesome.otf +0 -0
- data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.eot +0 -0
- data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.svg +655 -0
- data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
- data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.woff +0 -0
- data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.woff2 +0 -0
- data/documentation_project/source/images/middleman-pagegroups-small.png +0 -0
- data/documentation_project/source/images/middleman-pagegroups.png +0 -0
- data/documentation_project/source/index.html.md.erb +39 -0
- data/documentation_project/source/javascripts/all.js +1 -0
- data/documentation_project/source/layouts/layout.haml +11 -0
- data/documentation_project/source/layouts/template-logo-large.haml +25 -0
- data/documentation_project/source/layouts/template-logo-medium.haml +26 -0
- data/documentation_project/source/layouts/template-logo-small.haml +26 -0
- data/documentation_project/source/license.html.md.erb +29 -0
- data/documentation_project/source/partials/_nav_breadcrumbs.haml +11 -0
- data/documentation_project/source/partials/_nav_breadcrumbs_alt.haml +15 -0
- data/documentation_project/source/partials/_nav_brethren.haml +18 -0
- data/documentation_project/source/partials/_nav_brethren_index.haml +14 -0
- data/documentation_project/source/partials/_nav_legitimate_children.haml +16 -0
- data/documentation_project/source/partials/_nav_prev_next.haml +21 -0
- data/documentation_project/source/partials/_nav_toc_index.haml +21 -0
- data/documentation_project/source/stylesheets/_github.scss +61 -0
- data/documentation_project/source/stylesheets/_middlemac_minimal.scss +668 -0
- data/documentation_project/source/stylesheets/_normalize.scss +374 -0
- data/documentation_project/source/stylesheets/breadcrumb-separator-light.png +0 -0
- data/documentation_project/source/stylesheets/style.css.scss +3 -0
- data/documentation_project/source/toc.html.md.erb +26 -0
- data/lib/middleman-pagegroups/extension.rb +431 -0
- data/lib/middleman-pagegroups/partials.rb +173 -0
- data/lib/middleman-pagegroups/version.rb +5 -0
- data/lib/middleman-pagegroups.rb +6 -0
- data/middleman-pagegroups.gemspec +26 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d0f5bd96df68bc910b528cbaae3a2d6ee49f769
|
4
|
+
data.tar.gz: 3458d3fbb6bd11fc50b6901c1233e7e8c13bf3d9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1ee3edf96541e2d7b09464b23bcdd493e82033fe75fe9cc6a6baa73c165fe9f246704e1974058c01c5e1c7f6aa62e44cc022a4700f9b0857b3baecdf09fd2330
|
7
|
+
data.tar.gz: 62448847f7f368f721f56db215c98c80c45f17ad93f96a861f5d653edf442b637603534682e56205d3f8c50044abb92f81050e84c849e1ab92e9dd6a27acfb19
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# If you do not have OpenSSL installed, update
|
2
|
+
# the following line to use "http://" instead
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in middleman-pagegroups.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'aruba'
|
17
|
+
gem 'rspec'
|
18
|
+
end
|
data/LICENSE.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License
|
2
|
+
===============
|
3
|
+
|
4
|
+
Copyright (c) 2016 Jim Derry
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
middleman-pagegroups readme
|
2
|
+
---------------------------
|
3
|
+
[](https://badge.fury.io/rb/middleman-targets)
|
4
|
+
|
5
|
+
|
6
|
+
`middleman-pagegroups`
|
7
|
+
|
8
|
+
: This gem provides advanced navigation tools and helpers for grouping pages
|
9
|
+
by topic and navigating between them. It includes support for tables of
|
10
|
+
content, related pages, breadcrumbs, and more.
|
11
|
+
|
12
|
+
It is standalone and can be used in any Middleman project.
|
13
|
+
|
14
|
+
|
15
|
+
Install the Gem
|
16
|
+
---------------
|
17
|
+
|
18
|
+
Install the gem in your preferred way, typically:
|
19
|
+
|
20
|
+
~~~ bash
|
21
|
+
gem install middleman-pagegroups
|
22
|
+
~~~
|
23
|
+
|
24
|
+
From git source:
|
25
|
+
|
26
|
+
~~~ bash
|
27
|
+
rake install
|
28
|
+
~~~
|
29
|
+
|
30
|
+
|
31
|
+
Documentation
|
32
|
+
-------------
|
33
|
+
|
34
|
+
The complete documentation leverages the features of this gem in order to better
|
35
|
+
document them. Having installed the gem, read the full documentation in your
|
36
|
+
web browser:
|
37
|
+
|
38
|
+
~~~ bash
|
39
|
+
middleman-pagegroups documentation
|
40
|
+
cd middleman-pagegroups-docs/
|
41
|
+
bundle install
|
42
|
+
bundle exec middleman server
|
43
|
+
~~~
|
44
|
+
|
45
|
+
And then open your web browser to the address specified (typically
|
46
|
+
`localhost:4567`).
|
47
|
+
|
48
|
+
|
49
|
+
Quick Documentation
|
50
|
+
-------------------
|
51
|
+
|
52
|
+
[Middleman](https://middlemanapp.com/) 4.1.6 or newer is required. Earlier
|
53
|
+
point versions of Middleman do not have the necessary support for this
|
54
|
+
extension.
|
55
|
+
|
56
|
+
Once setup and configured, you can build multiple targets like so:
|
57
|
+
|
58
|
+
TO-DO
|
59
|
+
|
60
|
+
|
61
|
+
Added Features
|
62
|
+
--------------
|
63
|
+
|
64
|
+
TO-DO
|
65
|
+
|
66
|
+
|
67
|
+
Middlemac
|
68
|
+
---------
|
69
|
+
|
70
|
+
This Middleman extension is a critical part of
|
71
|
+
[Middlemac](https://github.com/middlemac), the Mac OS X help building system
|
72
|
+
for Mac OS X applications. However this gem is not Mac OS X specific and can be
|
73
|
+
useful in any application for which you want to provide structure and
|
74
|
+
navigation.
|
75
|
+
|
76
|
+
|
77
|
+
License
|
78
|
+
-------
|
79
|
+
|
80
|
+
MIT. See `LICENSE.md`.
|
81
|
+
|
82
|
+
|
83
|
+
Changelog
|
84
|
+
---------
|
85
|
+
|
86
|
+
See `CHANGELOG.md` for point changes, or simply have a look at the commit
|
87
|
+
history for non-version changes (such as readme updates).
|
data/Rakefile
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
################################################################################
|
4
|
+
# middleman-pagegroups
|
5
|
+
# This file constitutes the command line interface for middleman-pagegroups
|
6
|
+
################################################################################
|
7
|
+
|
8
|
+
require 'thor'
|
9
|
+
require 'fileutils'
|
10
|
+
require_relative '../lib/middleman-pagegroups/version'
|
11
|
+
require_relative '../lib/middleman-pagegroups/partials'
|
12
|
+
|
13
|
+
|
14
|
+
module MiddlemanPageGroupsCli
|
15
|
+
|
16
|
+
class Cli < Thor
|
17
|
+
|
18
|
+
map %w[--version -v] => :__print_version
|
19
|
+
|
20
|
+
############################################################
|
21
|
+
# help
|
22
|
+
# Override to add additional description.
|
23
|
+
############################################################
|
24
|
+
def help(*args)
|
25
|
+
if args.count == 0
|
26
|
+
puts <<-HEREDOC
|
27
|
+
|
28
|
+
middleman-pagegroups version #{Middleman::MiddlemanPageGroups::VERSION}
|
29
|
+
|
30
|
+
This gem adds functionality to Middleman and is not executable on its own,
|
31
|
+
other than for generating the documentation sample project and sample partial
|
32
|
+
files. Instead, you must add this gem to your Middleman project's `Gemfile`
|
33
|
+
and then activate it in your `config.rb` file.
|
34
|
+
|
35
|
+
HEREDOC
|
36
|
+
end
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
############################################################
|
42
|
+
# documentation
|
43
|
+
############################################################
|
44
|
+
desc 'documentation', 'Install the sample project into your current working directory.'
|
45
|
+
long_desc <<-HEREDOC
|
46
|
+
`documentation` will produce a sample project named `middleman-pagegroups-docs/`
|
47
|
+
in your current working directory. This sample uses the features of this gem.
|
48
|
+
You can then serve this new project to read the documentation by:
|
49
|
+
|
50
|
+
cd middleman-pagegroups-docs
|
51
|
+
bundle install
|
52
|
+
bundle exec middleman server
|
53
|
+
|
54
|
+
HEREDOC
|
55
|
+
def documentation
|
56
|
+
source = File.join('..', '..', 'documentation_project', '.')
|
57
|
+
source = File.expand_path(source, __FILE__)
|
58
|
+
dest = File.expand_path(File.join('.', 'middleman-pagegroups-docs', '.'))
|
59
|
+
FileUtils.cp_r(source, dest)
|
60
|
+
puts "middleman-pagegroups installed the project in\n#{dest}"
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
############################################################
|
65
|
+
# partials
|
66
|
+
############################################################
|
67
|
+
desc 'partials [<directory>]', 'Install the sample partials.'
|
68
|
+
long_desc <<-HEREDOC
|
69
|
+
`partials` will produce sample partial files into your current working
|
70
|
+
directory, or into <directory> if you specify one. These partials can
|
71
|
+
then be used using Middleman's `partials` helper in your own projects.
|
72
|
+
|
73
|
+
HEREDOC
|
74
|
+
def partials(*args)
|
75
|
+
dest = File.expand_path( args.empty? ? File.join('.') : args[0] )
|
76
|
+
unless File.writable?( dest )
|
77
|
+
puts "middleman-pagegroups can't seem to write to #{dest}."
|
78
|
+
exit 1
|
79
|
+
end
|
80
|
+
|
81
|
+
MMPartials::MM_PARTIALS.each do |p|
|
82
|
+
filename = File.join( dest, p[:filename] )
|
83
|
+
puts "writing #{filename}"
|
84
|
+
File.open( filename, 'w' ) { |f| f.write( p[:content]) }
|
85
|
+
end
|
86
|
+
|
87
|
+
puts "middleman-pagegroups installed #{MMPartials::MM_PARTIALS.count} partials in\n#{dest}"
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
############################################################
|
92
|
+
# __print_version
|
93
|
+
############################################################
|
94
|
+
desc '--version, -v', 'print the version'
|
95
|
+
def __print_version
|
96
|
+
puts "middleman-pagegroups version #{Middleman::MiddlemanPageGroups::VERSION}"
|
97
|
+
end
|
98
|
+
|
99
|
+
end # class Cli
|
100
|
+
|
101
|
+
end # module MiddlemanPagegroupsCli
|
102
|
+
|
103
|
+
|
104
|
+
###########################################################
|
105
|
+
# Main
|
106
|
+
###########################################################
|
107
|
+
|
108
|
+
MiddlemanPageGroupsCli::Cli.start(ARGV)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Rubymine noise
|
2
|
+
.idea/
|
3
|
+
|
4
|
+
# BBedit noise
|
5
|
+
*.bbprojectd
|
6
|
+
|
7
|
+
# Mac OS X noise
|
8
|
+
.DS_Store
|
9
|
+
|
10
|
+
# Ignore bundler lock files
|
11
|
+
Gemfile.lock
|
12
|
+
|
13
|
+
# Ignore pkg folder
|
14
|
+
/pkg
|
15
|
+
|
16
|
+
# Ignore build folders
|
17
|
+
.rbenv-*
|
18
|
+
.ruby-gemset
|
19
|
+
.ruby-version
|
20
|
+
.sass-cache
|
21
|
+
.sassc
|
22
|
+
.tmp
|
23
|
+
build*
|
24
|
+
Makefile
|
25
|
+
tmp
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# If you do not have OpenSSL installed, change
|
2
|
+
# the following line to use 'http://'
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# For faster file watcher updates on Windows:
|
6
|
+
gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw]
|
7
|
+
|
8
|
+
# Windows does not come with time zone data
|
9
|
+
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
|
10
|
+
|
11
|
+
# Middleman Gems
|
12
|
+
gem 'middleman-pagegroups', :path => '../'
|
13
|
+
gem 'middleman', '~> 4.1.6'
|
14
|
+
gem 'middleman-syntax'
|
15
|
+
|
16
|
+
|
17
|
+
#gem 'middleman-compass'
|
18
|
+
gem 'font-awesome-sass'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
documentation-project readme
|
2
|
+
----------------------------
|
3
|
+
|
4
|
+
This gem's documentation is a Middleman project using the features of this gem.
|
5
|
+
To view the documentation project, `cd` into this directory and
|
6
|
+
|
7
|
+
~~~ bash
|
8
|
+
gem install
|
9
|
+
bundle exec middleman serve
|
10
|
+
~~~
|
11
|
+
|
12
|
+
When the server starts, it will provide instructions on how to view the project
|
13
|
+
in your web browser.
|
@@ -0,0 +1,109 @@
|
|
1
|
+
################################################################################
|
2
|
+
# Sample Project for middleman-pagegroups
|
3
|
+
################################################################################
|
4
|
+
|
5
|
+
#==========================================================================
|
6
|
+
# Conflicting resources
|
7
|
+
# middleman-pagegroups uses Middleman's resource map to determine
|
8
|
+
# relationships between pages in groups. Be sure to activate other
|
9
|
+
# extensions that might manipulate the resource map before activating
|
10
|
+
# middleman-pagegroups, such as MiddlemanTargets.
|
11
|
+
#==========================================================================
|
12
|
+
# activate :MiddlemanTargets
|
13
|
+
|
14
|
+
|
15
|
+
#==========================================================================
|
16
|
+
# Extension Setup
|
17
|
+
# Note that middleman-targets adds configuration parameters to the base
|
18
|
+
# Middleman application (supported feature in 4.0+); there are *not*
|
19
|
+
# extension options. Additionally if middleman-targets is in your Gemfile
|
20
|
+
# then it is also activated automatically.
|
21
|
+
#==========================================================================
|
22
|
+
activate :MiddlemanPageGroups do |config|
|
23
|
+
|
24
|
+
# Indicate whether or not numeric file name prefixes used for sorting
|
25
|
+
# pages should be eliminated during output. This results in cleaner
|
26
|
+
# URI's. Helpers such as `page_name` and Middleman helpers such as
|
27
|
+
# `page_class` will reflect the pretty name.
|
28
|
+
config.strip_file_prefixes = true
|
29
|
+
|
30
|
+
# Indicates whether or not Middleman's built-in `page_class` helper is
|
31
|
+
# extended to include the page_group and page_name.
|
32
|
+
config.extend_page_class = true
|
33
|
+
|
34
|
+
# the following options provide defaults for the built-in helpers, and
|
35
|
+
# also work with the sample partials if you choose to install them.
|
36
|
+
# They'll also work in your own partials and helpers, of course.
|
37
|
+
|
38
|
+
# Default css class for the nav_breadcrumbs helper/partial.
|
39
|
+
config.nav_breadcrumbs_class = 'breadcrumbs'
|
40
|
+
|
41
|
+
# Default css class for the nav_breadcrumbs_alt helper/partial.
|
42
|
+
config.nav_breadcrumbs_alt_class = 'breadcrumbs'
|
43
|
+
|
44
|
+
# Default "current page" label for the nav_breadcrumbs_alt helper/partial.
|
45
|
+
config.nav_breadcrumbs_alt_label = 'Current page'
|
46
|
+
|
47
|
+
# Default css class for the nav_brethren helper/partial.
|
48
|
+
config.nav_brethren_class = 'table_contents'
|
49
|
+
|
50
|
+
# Default css class for the nav_brethren_index helper/partial.
|
51
|
+
config.nav_brethren_index_class = 'related-topics'
|
52
|
+
|
53
|
+
# Default css class for the nav_legitimate_children helper/partial.
|
54
|
+
config.nav_legitimate_children_class = 'table_contents'
|
55
|
+
|
56
|
+
# Default css class for the nav_prev_next helper/partial.
|
57
|
+
config.nav_prev_next_class = 'navigate_prev_next'
|
58
|
+
|
59
|
+
# Default "previous" label text for the nav_prev_next helper/partial.
|
60
|
+
config.nav_prev_next_label_prev = 'Previous'
|
61
|
+
|
62
|
+
# Default "next" label text for the nav_prev_next helper/partial.
|
63
|
+
config.nav_prev_next_label_next = 'Next'
|
64
|
+
|
65
|
+
# Default css class for the nav_toc_index helper/partial.
|
66
|
+
config.nav_toc_index_class = 'help_map'
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
#==========================================================================
|
72
|
+
# Regular Middleman Setup
|
73
|
+
#==========================================================================
|
74
|
+
|
75
|
+
set :relative_links, true
|
76
|
+
activate :syntax
|
77
|
+
|
78
|
+
|
79
|
+
#==========================================================================
|
80
|
+
# Helpers
|
81
|
+
# These helpers are used by the sample project only; there's no need
|
82
|
+
# to keep them around in your own projects.
|
83
|
+
#==========================================================================
|
84
|
+
|
85
|
+
# Methods defined in the helpers block are available in templates
|
86
|
+
helpers do
|
87
|
+
|
88
|
+
def product_name
|
89
|
+
'middleman-pagegroups'
|
90
|
+
end
|
91
|
+
|
92
|
+
def product_version
|
93
|
+
'1.0.0'
|
94
|
+
end
|
95
|
+
|
96
|
+
def product_uri
|
97
|
+
'https://github.com/middlemac'
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
# Build-specific configuration
|
103
|
+
configure :build do
|
104
|
+
# Minify CSS on build
|
105
|
+
# activate :minify_css
|
106
|
+
|
107
|
+
# Minify Javascript on build
|
108
|
+
# activate :minify_javascript
|
109
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
---
|
2
|
+
title: Concepts
|
3
|
+
id: concepts
|
4
|
+
blurb: Understand the design and philosophy of <code>middleman-pagegroups</code>.
|
5
|
+
layout: template-logo-medium
|
6
|
+
navigator: true
|
7
|
+
---
|
8
|
+
|
9
|
+
# <%= current_page.data.title %>
|
10
|
+
|
11
|
+
This section describes some of `middleman-pagegroups`’ design and
|
12
|
+
philosophy, and this is the right section to begin in if you’re still wondering
|
13
|
+
what this extension actually provides to you.
|
14
|
+
|
15
|
+
## Intended Uses
|
16
|
+
|
17
|
+
`middleman-pagegroups` is chiefly designed to support hierarchical, structured,
|
18
|
+
multi-page documents that have organizational relationships between them, such
|
19
|
+
as product manuals, help files, and Middleman extension gem documentation.
|
20
|
+
|
21
|
+
Using its model for groups, pages, legitimate children, and brethren simplifies
|
22
|
+
the implementation of tables of contents, previous and next buttons, breadcrumb
|
23
|
+
indicators, see-also tables, and more. This frees you from having to manually
|
24
|
+
update and validate scores of links and hand-coding on a page-by-page basis.
|
25
|
+
|
26
|
+
Books with sections, chapters, and pages are an obvious sample use case.
|
27
|
+
Software manuals, tutorials, training courses, and more are all suitable
|
28
|
+
candidates for the flexible and nearly-automatic organization provided by
|
29
|
+
`middleman-pagegroups`.
|
30
|
+
|
31
|
+
|
32
|
+
## What `middleman-pagegroups` does
|
33
|
+
|
34
|
+
`middleman-pagegroups` principally enables **automatic navigation** via the
|
35
|
+
management of **sort order**, **groups** (including nested groups), and making
|
36
|
+
a determination about the **legitimacy** of these relationships.
|
37
|
+
|
38
|
+
It provides helpers and sample partials to enable **breadcrumbs**, **previous**
|
39
|
+
and *next** buttons, **tables of contents**, and **related pages**, all using
|
40
|
+
the concepts that enable automatic navigation.
|
41
|
+
|
42
|
+
|
43
|
+
## Convention over Configuration
|
44
|
+
|
45
|
+
All of the features making `middleman-pagegroups` useful hinge on being able to
|
46
|
+
enable automatic navigation, and this is accomplished by following logical,
|
47
|
+
simple conventions that avoid having to micromanage many series of configuration
|
48
|
+
files.
|
49
|
+
|
50
|
+
For example you will define a **group** as a directory in your file system and
|
51
|
+
include an `index.html` file to serve as the parent of that group.
|
52
|
+
|
53
|
+
You will establish **sort orders** to define the **legitimacy** of certain
|
54
|
+
pages for inclusion or exclusion in the automatic navigation system.
|
55
|
+
|
56
|
+
|
57
|
+
## Hierarchical Design
|
58
|
+
|
59
|
+
`middleman-pagegroups` inherently uses the concept of “groups,” each of which
|
60
|
+
has pages and/or groups that belong to the group as its children.
|
61
|
+
|
62
|
+
Every project has a single, top-level (root) group, and because groups are named
|
63
|
+
for the directory that contain them, the top level group is usually named
|
64
|
+
`source` (because Middleman’s default source folder is so-named).
|
65
|
+
|
66
|
+
A detailed look at the hierarchical design and requirements can be found in the
|
67
|
+
[Directory Organization](directory_organization) section.
|
68
|
+
|
69
|
+
|
70
|
+
## Sort Order
|
71
|
+
|
72
|
+
Every page intended for automatic navigation must include a sort order, which
|
73
|
+
can be specified with a [Front Matter](frontmatter) key or as part of the file
|
74
|
+
name.
|
75
|
+
|
76
|
+
Don’t confuse sort order with page number. Sort order is simply an integer value
|
77
|
+
that does not have to be consecutive. It may be convenient to specify these in
|
78
|
+
steps of 10, for example, to make later insertions easier.
|
79
|
+
|
80
|
+
To include pages in your project (such as [this one](ovum)) that don’t
|
81
|
+
participate in the automatic navigation scheme, simply do not provide a sort
|
82
|
+
order.
|
83
|
+
|
84
|
+
|
85
|
+
## Legitimacy
|
86
|
+
|
87
|
+
In the context of `middleman-pagegroups` “legitimacy” refers to eligibility for
|
88
|
+
inclusion in the automatic navigation system. The criteria for legitimacy
|
89
|
+
include:
|
90
|
+
|
91
|
+
- The file must be an HTML or XHTML file.
|
92
|
+
- The file must not be `ignored?`, which is a resource attribute built into
|
93
|
+
Middleman. Other extensions (such as `middleman-targets`) may modify this
|
94
|
+
attribute.
|
95
|
+
- The file must have an assigned sort order.
|
96
|
+
|
97
|
+
You can still include accessible pages within the group but exclude them from
|
98
|
+
the automatic navigation features, i.e., render them “illegitimate.” Simply do
|
99
|
+
not provide a sort order for these pages.
|
100
|
+
|
101
|
+
|
102
|
+
## Brethren
|
103
|
+
|
104
|
+
`middleman-pagegroups` uses the word _brethren_ to refer to _legitimate
|
105
|
+
siblings_, i.e., “legitimate” as described above, not including itself. This
|
106
|
+
serves as a good basis for related-pages types of links.
|
107
|
+
|
108
|
+
## Legitimate Children
|
109
|
+
|
110
|
+
`middleman-pagegroups` similarly refines Middleman’s built-in children to
|
111
|
+
ensure that _only_ “legitimate” documents are included in automatic navigation.
|
@@ -0,0 +1,85 @@
|
|
1
|
+
---
|
2
|
+
title: Directory and File Organization
|
3
|
+
id: directory_organization
|
4
|
+
blurb: Organized directory structures enable most of the automatic features
|
5
|
+
of <code>middleman-pagegroups</code>.
|
6
|
+
layout: template-logo-medium
|
7
|
+
navigator: true
|
8
|
+
---
|
9
|
+
|
10
|
+
# <%= current_page.data.title %>
|
11
|
+
|
12
|
+
Directory organization is one of key parts of letting `middleman-pagegroups`
|
13
|
+
take the hassle out of managing content for you.
|
14
|
+
|
15
|
+
Briefly the role of the directory layout convention is this:
|
16
|
+
|
17
|
+
- Directories equate to groups.
|
18
|
+
- Directory names equate to the group names.
|
19
|
+
- Each file in a directory, except for `index.html`, constitutes a member of
|
20
|
+
the group.
|
21
|
+
- The `index.html` file in a directory serves as the placeholder for the
|
22
|
+
`parent` of the group.
|
23
|
+
|
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
|
30
|
+
already accustomed.
|
31
|
+
|
32
|
+
One important novelty of `middleman-pagegroups` is that a group’s `index.html`
|
33
|
+
file is considered a child of parent group. For example in this documentation
|
34
|
+
project’s hierarchy…
|
35
|
+
|
36
|
+
~~~
|
37
|
+
source/
|
38
|
+
index.html <- root object, parent to license, toc, and documentation/index.html
|
39
|
+
license.html <- Sort order is 20. Member of the `source` group.
|
40
|
+
toc.html <- Sort order is 30. Member of the `source` group.
|
41
|
+
documentation/
|
42
|
+
index.html <- Sort order is 10, and is a member of the `source` group!
|
43
|
+
concepts.html
|
44
|
+
directory_organization.html
|
45
|
+
…
|
46
|
+
~~~
|
47
|
+
|
48
|
+
…the files `license.html`, `toc.html`, and `documentation/index.html` are _all_
|
49
|
+
children of the `source` group. The file `source/index.html` is the child of
|
50
|
+
no one; it is the root document.
|
51
|
+
|
52
|
+
Another way to look at this is like this: the directory `documentation/`, i.e.,
|
53
|
+
the group `documentation`, is a member of the `source` group. It’s represented
|
54
|
+
by its `index.html` file.
|
55
|
+
{:.note}
|
56
|
+
|
57
|
+
|
58
|
+
## Nesting
|
59
|
+
|
60
|
+
Groups can be arbitrarily nested as deep as you wish. There’s probably a limit
|
61
|
+
that would cause a stack overflow and crash, but you’re not likely to reach it
|
62
|
+
unless you try deliberately.
|
63
|
+
|
64
|
+
|
65
|
+
## Sort Order
|
66
|
+
|
67
|
+
Although [Front Matter](frontmatter) is an appropriate place to specify a
|
68
|
+
page’s `:order`, it’s sometimes convenient for developers to arrange files in
|
69
|
+
order in their filesystem, too. This is supported by `middleman-pagegroups`,
|
70
|
+
too.
|
71
|
+
|
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`.
|
74
|
+
|
75
|
+
In order to avoid ugly URIs (e.g., `20_directory_organization.html`) make sure
|
76
|
+
that your [`config.rb`](config) file sets `strip_file_prefixes` to `true`, which
|
77
|
+
will rewrite page names without the order specifiers (e.g.,
|
78
|
+
`directory_organization.html`).
|
79
|
+
|
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.
|
83
|
+
{:.note}
|
84
|
+
|
85
|
+
Front matter `:order` will override any order specified by file names.
|