app/blog/static/js/common/reveal/markdown.js
function slidify( markdown, options ) {

		options = getSlidifyOptions( options );

		var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
			horizontalSeparatorRegex = new RegExp( options.separator );

		var matches,
			lastIndex = 0,
			isHorizontal,
			wasHorizontal = true,
			content,
			sectionStack = [];

		// iterate until all blocks between separators are stacked up
		while( matches = separatorRegex.exec( markdown ) ) {
			notes = null;

			// determine direction (horizontal by default)
			isHorizontal = horizontalSeparatorRegex.test( matches[0] );

			if( !isHorizontal && wasHorizontal ) {
				// create vertical stack
				sectionStack.push( [] );
			}

			// pluck slide content from markdown input
			content = markdown.substring( lastIndex, matches.index );

			if( isHorizontal && wasHorizontal ) {
				// add to horizontal stack
				sectionStack.push( content );
			}
			else {
				// add to vertical stack
				sectionStack[sectionStack.length-1].push( content );
			}

			lastIndex = separatorRegex.lastIndex;
			wasHorizontal = isHorizontal;
		}

		// add the remaining slide
		( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );

		var markdownSections = '';

		// flatten the hierarchical stack, and insert <section data-markdown> tags
		for( var i = 0, len = sectionStack.length; i < len; i++ ) {
			// vertical
			if( sectionStack[i] instanceof Array ) {
				markdownSections += '<section '+ options.attributes +'>';

				sectionStack[i].forEach( function( child ) {
					markdownSections += '<section data-markdown>' +  createMarkdownSlide( child, options ) + '</section>';
				} );

				markdownSections += '</section>';
			}
			else {
				markdownSections += '<section '+ options.attributes +' data-markdown>' + createMarkdownSlide( sectionStack[i], options ) + '</section>';
			}
		}

		return markdownSections;

	}
function slidify( markdown, options ) {

		options = getSlidifyOptions( options );

		var separatorRegex = new RegExp( options.separator + ( options.verticalSeparator ? '|' + options.verticalSeparator : '' ), 'mg' ),
			horizontalSeparatorRegex = new RegExp( options.separator );

		var matches,
			lastIndex = 0,
			isHorizontal,
			wasHorizontal = true,
			content,
			sectionStack = [];

		// iterate until all blocks between separators are stacked up
		while( matches = separatorRegex.exec( markdown ) ) {
			notes = null;

			// determine direction (horizontal by default)
			isHorizontal = horizontalSeparatorRegex.test( matches[0] );

			if( !isHorizontal && wasHorizontal ) {
				// create vertical stack
				sectionStack.push( [] );
			}

			// pluck slide content from markdown input
			content = markdown.substring( lastIndex, matches.index );

			if( isHorizontal && wasHorizontal ) {
				// add to horizontal stack
				sectionStack.push( content );
			}
			else {
				// add to vertical stack
				sectionStack[sectionStack.length-1].push( content );
			}

			lastIndex = separatorRegex.lastIndex;
			wasHorizontal = isHorizontal;
		}

		// add the remaining slide
		( wasHorizontal ? sectionStack : sectionStack[sectionStack.length-1] ).push( markdown.substring( lastIndex ) );

		var markdownSections = '';

		// flatten the hierarchical stack, and insert <section data-markdown> tags
		for( var i = 0, len = sectionStack.length; i < len; i++ ) {
			// vertical
			if( sectionStack[i] instanceof Array ) {
				markdownSections += '<section '+ options.attributes +'>';

				sectionStack[i].forEach( function( child ) {
					markdownSections += '<section data-markdown>' +  createMarkdownSlide( child, options ) + '</section>';
				} );

				markdownSections += '</section>';
			}
			else {
				markdownSections += '<section '+ options.attributes +' data-markdown>' + createMarkdownSlide( sectionStack[i], options ) + '</section>';
			}
		}

		return markdownSections;

	}
function slidify ( markdown , options ) { options = getSlidifyOptions ( options ) ; var separatorRegex = new RegExp ( options . separator + ( options . verticalSeparator ? '|' + options . verticalSeparator : '' ) , 'mg' ) , horizontalSeparatorRegex = new RegExp ( options . separator ) ; var matches , lastIndex = 0 , isHorizontal , wasHorizontal = true , content , sectionStack = [ ] ; // iterate until all blocks between separators are stacked up while ( matches = separatorRegex . exec ( markdown ) ) { notes = null ; // determine direction (horizontal by default) isHorizontal = horizontalSeparatorRegex . test ( matches [ 0 ] ) ; if ( ! isHorizontal && wasHorizontal ) { // create vertical stack sectionStack . push ( [ ] ) ; } // pluck slide content from markdown input content = markdown . substring ( lastIndex , matches . index ) ; if ( isHorizontal && wasHorizontal ) { // add to horizontal stack sectionStack . push ( content ) ; } else { // add to vertical stack sectionStack [ sectionStack . length - 1 ] . push ( content ) ; } lastIndex = separatorRegex . lastIndex ; wasHorizontal = isHorizontal ; } // add the remaining slide ( wasHorizontal ? sectionStack : sectionStack [ sectionStack . length - 1 ] ) . push ( markdown . substring ( lastIndex ) ) ; var markdownSections = '' ; // flatten the hierarchical stack, and insert <section data-markdown> tags for ( var i = 0 , len = sectionStack . length ; i < len ; i ++ ) { // vertical if ( sectionStack [ i ] instanceof Array ) { markdownSections += '<section ' + options . attributes + '>' ; sectionStack [ i ] . forEach ( function ( child ) { markdownSections += '<section data-markdown>' + createMarkdownSlide ( child , options ) + '</section>' ; } ) ; markdownSections += '</section>' ; } else { markdownSections += '<section ' + options . attributes + ' data-markdown>' + createMarkdownSlide ( sectionStack [ i ] , options ) + '</section>' ; } } return markdownSections ; }
Parses a data string into multiple slides based
on the passed in separator arguments.
Parses a data string into multiple slides based on the passed in separator arguments .