1 | var async = require('async'),
|
2 | cheerio = require('cheerio'),
|
3 | common = require('./common.js');
|
4 |
|
5 | var doFixSnippets = function(file, contents) {
|
6 | var $ = cheerio.load(contents);
|
7 | $("a.thispath").attr('href', "/" + file.path);
|
8 | return $.html();
|
9 | };
|
10 |
|
11 | module.exports = function(config) {
|
12 | return function(files, metalsmith, done) {
|
13 | var metadata = metalsmith.metadata();
|
14 | async.forEachOf(common.htmlfiles(files), function(file, filename, finished) {
|
15 | if (file.snippet) {
|
16 | file.snippet = new Buffer(doFixSnippets(file, file.snippet));
|
17 | }
|
18 | finished();
|
19 | }, function () {
|
20 | done();
|
21 | });
|
22 | }
|
23 | };
|
24 |
|