Skip to content

Commit

Permalink
Fixing internal docs task.
Browse files Browse the repository at this point in the history
  • Loading branch information
cowboy committed Aug 3, 2012
1 parent ffaa657 commit 664963c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions docs/helpers_directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ Take a look at the [built-in tasks source code](../tasks) for more examples.

## Built-in Directives <a name="built-in-directives" href="#built-in-directives" title="Link to this section">⚑</a>

### `<config:prop.subprop>`
### `<config:prop.subprop>` <a name="config-prop-subprop" href="#config-prop-subprop" title="Link to this section">⚑</a>
Expands to the value of the `prop.subprop` config property. This can be any number of objects deep, `prop.subprop.otherprop.whatever` is totally valid. Great for DRYing up file lists.

### `<json:file.json>`
### `<json:file.json>` <a name="json-file-json" href="#json-file-json" title="Link to this section">⚑</a>
Expand to the object parsed from file.json via [grunt.file.parseJSON](api_file.md).

### `<banner:prop.subprop>`
### `<banner:prop.subprop>` <a name="banner-prop-subprop" href="#banner-prop-subprop" title="Link to this section">⚑</a>
Expand to the string in config property `prop.subprop`, parsed via [grunt.template.process](api_template.md), using `<% %>` delimiters. If the config property isn't specified like `<banner>`, defaults to the `meta.banner` property.

### `<file_strip_banner:file.js>`
### `<file_strip_banner:file.js>` <a name="file-strip-banner-file-js" href="#file-strip-banner-file-js" title="Link to this section">⚑</a>
Expand to the given file, with any leading `/*...*/` banner (excluding `/*!...*/` comments) stripped. Flags can be passed to instruct which banners to strip. The `line` flag (eg. `<file_strip_banner:file.js:line>`) will remove a continguous block of leading `//` line comments, while the `block` flag (eg. `<file_strip_banner:file.js:block>`) will strip _all_ block comments.

### `<file_template:file.js>`
### `<file_template:file.js>` <a name="file-template-file-js" href="#file-template-file-js" title="Link to this section">⚑</a>
Expand to the given file, parsed as a template via [grunt.template.process](api_template.md), using `<% %>` delimiters.

Take a look at the [api documentation](api.md) and [example gruntfiles](example_gruntfiles.md) for directive creation and usage examples.
4 changes: 2 additions & 2 deletions grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ module.exports = function(grunt) {
// Copying the file to itself allows it to be processed in-place.
grunt.file.copy(filepath, filepath, {process: function(src) {
// Add anchor links to all H2+ headers in .md document files.
var newSrc = src.replace(/(##+)\s+(.*?)\s*<a name=.*<\/a>/g, function(_, h, title) {
var newSrc = src.replace(/(##+)\s+(.*?)\s*(?:<a name=.*?<\/a>)?\n/g, function(_, h, title) {
// Slugify the title text.
var slug = grunt.utils._.slugify(title.replace(/\./g, '-'));
// Put everything back together.
return h + ' ' + title + ' <a name="' + slug + '" href="#' + slug +
'" title="Link to this section">⚑</a>';
'" title="Link to this section">⚑</a>\n';
});
// Don't copy file if it didn't change.
if (newSrc === src) { return false; }
Expand Down

0 comments on commit 664963c

Please sign in to comment.