You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tasks: Change build-pages to build-posts and handle all post types
Changes preprocessPost() export to postPreprocessors hash.
Allows specifying the target file name via a preprocessor. This was needed by
meetings.jquery.org to support the custom directory structure.
Fixesgh-35
This multi-task takes a list of html or markdown files, copies them to `[wordpress.dir]/posts/page/`, processes `@partial` entries and highlights the syntax in each.
31
+
This multi-task takes a list of html or markdown files, copies them to `[wordpress.dir]/posts/[post-type]/`, processes `@partial` entries and highlights the syntax in each. The keys are the post types for each set of posts.
32
32
33
-
See the [`preprocessPost()` export](#preprocesspost-post-filename-callback-) for a hook to implement custom processing.
33
+
See the [`postPreprocessors` export](#postpreprocessors) for a hook to implement custom processing.
34
34
35
35
#### markdown
36
36
@@ -124,12 +124,21 @@ Syntax highlights content.
124
124
125
125
*`content` String: The string the highlight.
126
126
127
-
### preprocessPost( post, fileName, callback )
127
+
### postPreprocessors
128
128
129
-
Hook for modifying the posts before they're processed in the [`build-pages`](#build-pages) task.
129
+
Hooks for modifying the posts before they're processed in the [`build-posts`](#build-posts) task.
130
+
131
+
`postPreprocessors` is a hash of preprocessors, where the key is the post type and the value is a function which modifies the post.
132
+
133
+
The functions must be in the form of:
134
+
`function( post, fileName, callback )`
130
135
131
136
*`post` Object: The post being processed.
132
137
*`fileName` String: The name of the file used to generate the post object.
133
138
*`callback` function( error, post ): Callback to invoke after modifying the post.
134
139
*`error`: An `Error` instance, if there was an error while modifying the post.
135
140
*`post` The modified post.
141
+
142
+
By default, posts are placed in the `[wordpress.dir]/[post-type]` directory using the same relative path and file name as the source file. The relative path can be changed by setting the `fileName` property on the post.
143
+
144
+
If a preprocessor is not defined for the given post type, then the `_default` preprocessor will be used.
0 commit comments