Browse Source

more forgiving code highlight line number format, add Promise polyfill

Hakim El Hattab 5 năm trước cách đây
mục cha
commit
5301a9ea03

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 0
lib/js/promise.js


+ 5 - 3
plugin/highlight/highlight.js

@@ -97,8 +97,7 @@ c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{b:/\{/,e:/\}/,i:/:/}]}});
 				}
 			} );
 
-			// lofi xbrowser Promise.resolve()
-			return { then: function( resolve ) { resolve(); }};
+			return Promise.resolve();
 
 		},
 
@@ -139,10 +138,13 @@ c:[{cN:"comment",b:/\(\*/,e:/\*\)/},e.ASM,e.QSM,e.CNM,{b:/\{/,e:/\}/,i:/:/}]}});
 
 				linesToHighlight.split( ',' ).forEach( function( lineNumbers ) {
 
+					// Avoid failures becase of whitespace
+					lineNumbers = lineNumbers.replace( /\s/g, '' );
+
 					// 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 lineEnd = lineNumbers[1] || lineStart;

+ 1 - 2
plugin/math/math.js

@@ -84,8 +84,7 @@ var RevealMath = window.RevealMath || (function(){
 
 			} );
 
-			// lofi xbrowser Promise.resolve()
-			return { then: function( resolve ) { resolve(); }};
+			return Promise.resolve();
 
 		}
 	}

+ 1 - 2
plugin/notes/notes.js

@@ -168,8 +168,7 @@ var RevealNotes = (function() {
 
 			}
 
-			// lofi xbrowser Promise.resolve()
-			return { then: function( resolve ) { resolve(); }};
+			return Promise.resolve();
 
 		},
 

+ 1 - 2
plugin/zoom-js/zoom.js

@@ -22,8 +22,7 @@ var RevealZoom = (function(){
 				}
 			} );
 
-			// lofi xbrowser Promise.resolve()
-			return { then: function( resolve ) { resolve(); }};
+			return Promise.resolve();
 
 		}
 	}