validate code line numbers to highlight
parent
8690858b6f
commit
da53b3a637
|
@ -115,10 +115,13 @@ var RevealHighlight = (function() {
|
||||||
|
|
||||||
linesToHighlight = linesToHighlight || block.getAttribute( 'data-line-numbers' );
|
linesToHighlight = linesToHighlight || block.getAttribute( 'data-line-numbers' );
|
||||||
|
|
||||||
if( typeof linesToHighlight === 'string' ) {
|
if( typeof linesToHighlight === 'string' && linesToHighlight !== '' ) {
|
||||||
|
|
||||||
linesToHighlight.split( ',' ).forEach( function( lineNumbers ) {
|
linesToHighlight.split( ',' ).forEach( function( lineNumbers ) {
|
||||||
|
|
||||||
|
// Ensure that we looking at a valid slide number (1 or 1-2)
|
||||||
|
if( /^[\d-]+$/.test( lineNumbers ) ) {
|
||||||
|
|
||||||
lineNumbers = lineNumbers.split( '-' )
|
lineNumbers = lineNumbers.split( '-' )
|
||||||
|
|
||||||
var lineStart = lineNumbers[0];
|
var lineStart = lineNumbers[0];
|
||||||
|
@ -128,6 +131,8 @@ var RevealHighlight = (function() {
|
||||||
lineElement.classList.add( 'highlight-line' );
|
lineElement.classList.add( 'highlight-line' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue