Summary
Splits a sequence of documents into multiple pages.
- Assembly
- Wyam
.Core .dll - Namespace
- Wyam
.Core .Modules .Control - Interfaces
-
- IModule
- IModuleList
- IList
<IModule>
- Base Types
-
- Object
- ContainerModule
graph BT
Type-->Base0["ContainerModule"]
click Base0 "/api/Wyam.Common.Modules/ContainerModule"
Base0-->Base1["Object"]
Type-.->Interface0["IModule"]
click Interface0 "/api/Wyam.Common.Modules/IModule"
Type-.->Interface1["IModuleList"]
click Interface1 "/api/Wyam.Common.Modules/IModuleList"
Type-.->Interface2["IList<IModule>"]
Type["Paginate"]
class Type type-node
Syntax
public class Paginate : ContainerModule, IModule, IModuleList, IList<IModule>
Examples
If your input document is a Razor template for a blog archive, you can use
Paginate to get pages of 10 blog posts each. If you have 50 blog posts, the
result of the Paginate module will be 5 copies of your input archive template,
one for each page. Your configuration file might look something like this:
Pipelines.Add("Posts",
ReadFiles("*.md"),
Markdown(),
WriteFiles("html")
);
Pipelines.Add("Archive",
ReadFiles("archive.cshtml"),
Paginate(10,
Documents("Posts")
),
Razor(),
WriteFiles(string.Format("archive-{0}.html", @doc["CurrentPage"]))
);
Remarks
This module forms pages from the output documents of the specified modules.
Each input document is cloned for each page and metadata related
to the pages, including the sequence of documents for each page,
is added to each clone. For example, if you have 2 input documents
and the result of paging is 3 pages, this module will output 6 documents.
Note that if there are no documents to paginate, this module will still
output an empty page without any documents inside the page.
Constructors
Name | Summary |
---|---|
Paginate |
Partitions the result of the specified modules into the specified number of pages. The input documents to Paginate are used as the initial input documents to the specified modules. |
Paginate |
Partitions the result of the specified modules into the specified number of pages. The input documents to Paginate are used as the initial input documents to the specified modules. |
Properties
Name | Value | Summary |
---|---|---|
Count | int |
Inherited from ContainerModule
|
IsReadOnly | bool |
Inherited from ContainerModule
|
this[int] | IModule |
Inherited from ContainerModule
|
this[string] | IModule |
Gets the module with the specified name.
Inherited from ContainerModule
|
Methods
Name | Value | Summary |
---|---|---|
Add |
void |
Inherited from ContainerModule
|
Add |
void |
Adds modules to the list.
Any
null items in the sequence of modules will be discarded.
Inherited from ContainerModule
|
Add |
void |
Adds a module to the list with a specified name.
Inherited from ContainerModule
|
AsKeyValuePairs |
IEnumerable |
Returns the list as a sequence of key-value pairs with the keys being
the module names and the values being the module instances.
Inherited from ContainerModule
|
Clear |
void |
Inherited from ContainerModule
|
Contains |
bool |
Inherited from ContainerModule
|
Contains |
bool |
Determines if the list contains a module with the specified name.
Inherited from ContainerModule
|
CopyTo |
void |
Inherited from ContainerModule
|
Execute |
IEnumerable |
This should not be called directly, instead call
IExecutionContext.Execute() if you need to execute a module from within another module.
|
GetEnumerator |
IEnumerator |
Inherited from ContainerModule
|
IndexOf |
int |
Inherited from ContainerModule
|
IndexOf |
int |
Gets the index of the module with the specified name.
Inherited from ContainerModule
|
Insert |
void |
Inherited from ContainerModule
|
Insert |
void |
Inserts modules into the list.
Any
null items in the sequence of modules will be discarded.
Inherited from ContainerModule
|
Insert |
void |
Inserts a module into the list with a specified name.
Inherited from ContainerModule
|
Remove |
bool |
Inherited from ContainerModule
|
Remove |
bool |
Removes a module by name.
Inherited from ContainerModule
|
RemoveAt |
void |
Inherited from ContainerModule
|
SkipPages |
Paginate |
Skips a specified number of pages before outputting pages.
|
TakePages |
Paginate |
Only outputs a specific number of pages.
|
TryGetValue |
bool |
Attempts to get a module with the specified name.
Inherited from ContainerModule
|
Where |
Paginate |
Limits the documents to be paged to those that satisfy the supplied predicate.
|
WithPageMetadata |
Paginate |
Adds the specified metadata to each page index document. This must be performed
within the paginate module. If you attempt to process the page index documents
from the paginate module after execution, it will "disconnect" metadata for
those documents like
Wyam.Common.Meta.Keys.NextPage since you're effectivly
creating new documents and the ones those keys refer to will be outdated.
|