reveal-atom-highlights.js
/**
   * Parses and formats a user-defined string of line
   * numbers to highlight.
   *
   * @example
   * deserializeHighlightSteps('1,2|3,5-10')
   * // [
   * //   [ 1, 2 ],
   * //   [ 3, 5, 6, 7, 8, 9, 10 ]
   * // ]
   */
Parses and formats a user-defined string of line
numbers to highlight.


Parses and formats a user - defined string of line numbers to highlight .
function deserializeHighlightSteps(highlightSteps) {
    var highlightLinesStepsWithoutWhiteSpace =
      highlightSteps.replace(/\s/g, '');
    var highlightLinesFragments = highlightSteps.split('|');
    return highlightLinesFragments.map(function(highlightLineGroups) {
      var indicesForFragment = [];
      highlightLineGroups.split(',').forEach(function(highlightLineGroup) {
        var parsed = highlightLineGroup.match(/(\d+)(?:-(\d+))?/);
        var startLine = parseInt(parsed[1], 10);
        var endLine = parseInt(parsed[2] || startLine, 10);
        for (var i = startLine; i <= endLine; i++) {
          indicesForFragment.push(i);
        }
      });
      return indicesForFragment;
    });
  }
function deserializeHighlightSteps ( highlightSteps ) { var highlightLinesStepsWithoutWhiteSpace = highlightSteps . replace ( / \s / g , '' ) ; var highlightLinesFragments = highlightSteps . split ( '|' ) ; return highlightLinesFragments . map ( function ( highlightLineGroups ) { var indicesForFragment = [ ] ; highlightLineGroups . split ( ',' ) . forEach ( function ( highlightLineGroup ) { var parsed = highlightLineGroup . match ( / (\d+)(?:-(\d+))? / ) ; var startLine = parseInt ( parsed [ 1 ] , 10 ) ; var endLine = parseInt ( parsed [ 2 ] || startLine , 10 ) ; for ( var i = startLine ; i <= endLine ; i ++ ) { indicesForFragment . push ( i ) ; } } ) ; return indicesForFragment ; } ) ; }
Parses and formats a user-defined string of line
 numbers to highlight.
Parses and formats a user - defined string of line numbers to highlight .