diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-07-17 19:00:01 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-07-17 19:00:01 +0100 |
| commit | 8081ee3564956e1af9ac5d93a25953633f099ef9 (patch) | |
| tree | 4ba5b5b5965b03b1c18b00fe112ef384c11610fb /lib/transforms.js | |
| parent | 4457936b892dc622030f22d70935a69456aa3eb6 (diff) | |
Add mammoth.transforms.paragraph
Diffstat (limited to 'lib/transforms.js')
| -rw-r--r-- | lib/transforms.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/transforms.js b/lib/transforms.js new file mode 100644 index 0000000..988b456 --- /dev/null +++ b/lib/transforms.js @@ -0,0 +1,15 @@ +exports.paragraph = function(transform) { + function transformElement(element) { + if (element.children) { + for (var i = 0; i < element.children.length; i++) { + element.children[i] = transformElement(element.children[i]); + } + } + if (element.type === "paragraph") { + return transform(element); + } else { + return element; + } + } + return transformElement; +}; |
