fluentTranslationParser.js
// common logic for pushing a child node onto a list
common logic for pushing a child node onto a list
common logic for pushing a child node onto a list
function pushTextNode(list, html, level, start, ignoreWhitespace, ignoreCollapse) {
    var end = html.indexOf('<', start);
    var content = html.slice(start, end === -1 ? undefined : end); 
    if (!ignoreCollapse && /^\s*$/.test(content)) {
      content = ' ';
    } 
    if (!ignoreWhitespace && end > -1 && level + list.length >= 0 || content !== ' ') {
      list.push({
        type: 'text',
        content: content
      });
    }
  }
function pushTextNode ( list , html , level , start , ignoreWhitespace , ignoreCollapse ) { var end = html . indexOf ( '<' , start ) ; var content = html . slice ( start , end === - 1 ? undefined : end ) ; if ( ! ignoreCollapse && / ^\s*$ / . test ( content ) ) { content = ' ' ; } if ( ! ignoreWhitespace && end > - 1 && level + list . length >= 0 || content !== ' ' ) { list . push ( { type : 'text' , content : content } ) ; } }
common logic for pushing a child node onto a list
common logic for pushing a child node onto a list
// calculate correct end of the content slice in case there's // no tag after the text node. // if a node is nothing but whitespace, collapse it as the spec states: // https://www.w3.org/TR/html4/struct/text.html#h-9.1 // don't add whitespace-only text nodes if they would be trailing text nodes // or if they would be leading whitespace-only text nodes: //  * end > -1 indicates this is not a trailing text node //  * leading node is when level is -1 and list has length 0