Skip to content

Commit

Permalink
feat(names): remove parenthesed portion of names
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink authored and orangejulius committed Sep 24, 2021
1 parent 0ec1829 commit 0a0f349
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 78 deletions.
4 changes: 3 additions & 1 deletion stream/tag_mapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = function(){

// use one of the preferred name tags listed above
if ( defaultName ){
doc.setName('default', defaultName);
doc.setName('default', trim( defaultName ) );
}

// else try to use an available two-letter language name tag
Expand Down Expand Up @@ -128,7 +128,9 @@ module.exports = function(){
};

// Clean string of leading/trailing junk chars
// note: parenthesed text is removed
function trim( str ){
str = str.replace(/\([^)]*\) */g, ''); // remove parenthesed portions of text
return _.trim( str, '#$%^*<>-=_{};:",./?\t\n\' ' );
}

Expand Down
Loading

0 comments on commit 0a0f349

Please sign in to comment.