pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/sethen/markdown-include/commit/152257ed4e8e094821173cee0634fbefe1d15883

" /> Added functionality for adding custom tags · sethen/markdown-include@152257e · GitHub
Skip to content

Commit 152257e

Browse files
author
Sethen Maleno
committed
Added functionality for adding custom tags
1 parent 40dae60 commit 152257e

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

bin/cli.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env node
22

3+
/* eslint-env node */
4+
'use strict';
5+
36
var markdownJson = process.argv[2];
47
var markdownInclude = require('../markdown-include');
58

markdown-include.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,13 @@ exports.compileFiles = function (path) {
134134
self.build[file].parsedData = self.options.tableOfContents.heading + '\n\n' + self.tableOfContents + '\n\n' + self.build[file].parsedData;
135135
}
136136
}
137+
}
137138

138-
deferred.resolve(self.writeFile(self.build[file].parsedData));
139+
if (self.customTags && self.customTags.length) {
140+
self.build[file].parsedData = self.resolveCustomTags(self.build[file].parsedData);
139141
}
142+
143+
deferred.resolve(self.writeFile(self.build[file].parsedData));
140144
});
141145

142146
return deferred.promise;
@@ -336,6 +340,28 @@ exports.replaceWith = function (obj) {
336340
return replaced;
337341
};
338342

343+
exports.resolveCustomTags = function (data) {
344+
if (data) {
345+
var k;
346+
347+
for (k = 0; k < this.customTags.length; k += 1) {
348+
var customTagObj = this.customTags[k];
349+
var replacedData;
350+
351+
if (replacedData) {
352+
customTagObj.data = replacedData;
353+
}
354+
else {
355+
customTagObj.data = data;
356+
}
357+
358+
replacedData = this.stripTagsInFile(customTagObj);
359+
}
360+
361+
return replacedData;
362+
}
363+
};
364+
339365
/**
340366
* For stripping a pattern out of a tag
341367
* @param {Object} obj Key value pair include tag and pattern to strip

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy