Skip to content

Commit

Permalink
Add Blast.REPLACE_OPEN_TAG_NEWLINE symbol for use in `String#stripT…
Browse files Browse the repository at this point in the history
…ags()`
  • Loading branch information
skerit committed Dec 12, 2018
1 parent 5f5d390 commit ee4aa27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,7 @@
* Add `cast` argument to `Array#unique()`
* `Pledge#_started` is now a timestamp, not a boolean
* Add duration properties to the `Pledge` class
* Add `Blast.REPLACE_OPEN_TAG_NEWLINE` symbol for use in `String#stripTags()`

## 0.6.3 (2018-12-06)

Expand Down
11 changes: 10 additions & 1 deletion lib/string.js
Expand Up @@ -579,6 +579,7 @@ module.exports = function BlastString(Blast, Collection, Bound, Obj) {
STATE_COMMENT = Symbol('comment');

Blast.REPLACE_BR_NEWLINE = Symbol('REPLACE_BR_NEWLINE');
Blast.REPLACE_OPEN_TAG_NEWLINE = Symbol('REPLACE_OPEN_TAG_NEWLINE');

/**
* Get the tag name
Expand All @@ -602,7 +603,7 @@ module.exports = function BlastString(Blast, Collection, Bound, Obj) {
* @author Jelle De Loecker <jelle@develry.be>
* @author Eric Norris
* @since 0.1.2
* @version 0.6.3
* @version 0.6.4
*
* @param {Array} allowed_tags
* @param {Symbol|String} tag_replacement
Expand Down Expand Up @@ -722,9 +723,17 @@ module.exports = function BlastString(Blast, Collection, Bound, Obj) {
} else if (allowed) {
output += allowed;
} else {
if (allowed_tags === Blast.REPLACE_OPEN_TAG_NEWLINE && tag_buffer[1] != '/') {
output += '\n';
}

output += tag_replacement;
}
} else {
if (allowed_tags === Blast.REPLACE_OPEN_TAG_NEWLINE && tag_buffer[1] != '/') {
output += '\n';
}

output += tag_replacement;
}

Expand Down

0 comments on commit ee4aa27

Please sign in to comment.