"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugin/highlight/plugin.js" between
reveal.js-4.1.1.tar.gz and reveal.js-4.1.2.tar.gz

About: reveal.js is a HTML presentation framework including nested slides, Markdown contents, PDF export, speaker notes and a JavaScript API.

plugin.js  (reveal.js-4.1.1):plugin.js  (reveal.js-4.1.2)
skipping to change at line 32 skipping to change at line 32
* Highlights code blocks withing the given deck. * Highlights code blocks withing the given deck.
* *
* Note that this can be called multiple times if * Note that this can be called multiple times if
* there are multiple presentations on one page. * there are multiple presentations on one page.
* *
* @param {Reveal} reveal the reveal.js instance * @param {Reveal} reveal the reveal.js instance
*/ */
init: function( reveal ) { init: function( reveal ) {
// Read the plugin config options and provide fallbacks // Read the plugin config options and provide fallbacks
var config = reveal.getConfig().highlight || {}; let config = reveal.getConfig().highlight || {};
config.highlightOnLoad = typeof config.highlightOnLoad === 'boole an' ? config.highlightOnLoad : true; config.highlightOnLoad = typeof config.highlightOnLoad === 'boole an' ? config.highlightOnLoad : true;
config.escapeHTML = typeof config.escapeHTML === 'boolean' ? conf ig.escapeHTML : true; config.escapeHTML = typeof config.escapeHTML === 'boolean' ? conf ig.escapeHTML : true;
[].slice.call( reveal.getRevealElement().querySelectorAll( 'pre c Array.from( reveal.getRevealElement().querySelectorAll( 'pre code
ode' ) ).forEach( function( block ) { ' ) ).forEach( block => {
block.parentNode.className = 'code-wrapper';
// Code can optionally be wrapped in script template to a void // Code can optionally be wrapped in script template to a void
// HTML being parsed by the browser (i.e. when you need t o // HTML being parsed by the browser (i.e. when you need t o
// include <, > or & in your code). // include <, > or & in your code).
let substitute = block.querySelector( 'script[type="text/ template"]' ); let substitute = block.querySelector( 'script[type="text/ template"]' );
if( substitute ) { if( substitute ) {
// textContent handles the HTML entity escapes fo r us // textContent handles the HTML entity escapes fo r us
block.textContent = substitute.innerHTML; block.textContent = substitute.innerHTML;
} }
skipping to change at line 59 skipping to change at line 61
block.innerHTML = betterTrim( block ); block.innerHTML = betterTrim( block );
} }
// Escape HTML tags unless the "data-noescape" attrbute i s present // Escape HTML tags unless the "data-noescape" attrbute i s present
if( config.escapeHTML && !block.hasAttribute( 'data-noesc ape' )) { if( config.escapeHTML && !block.hasAttribute( 'data-noesc ape' )) {
block.innerHTML = block.innerHTML.replace( /</g," &lt;").replace(/>/g, '&gt;' ); block.innerHTML = block.innerHTML.replace( /</g," &lt;").replace(/>/g, '&gt;' );
} }
// Re-highlight when focus is lost (for contenteditable c ode) // Re-highlight when focus is lost (for contenteditable c ode)
block.addEventListener( 'focusout', function( event ) { block.addEventListener( 'focusout', function( event ) {
hljs.highlightBlock( event.currentTarget ); hljs.highlightElement( event.currentTarget );
}, false ); }, false );
if( config.highlightOnLoad ) { if( config.highlightOnLoad ) {
Plugin.highlightBlock( block ); Plugin.highlightBlock( block );
} }
} ); } );
// If we're printing to PDF, scroll the code highlights of // If we're printing to PDF, scroll the code highlights of
// all blocks in the deck into view at once // all blocks in the deck into view at once
skipping to change at line 88 skipping to change at line 90
/** /**
* Highlights a code block. If the <code> node has the * Highlights a code block. If the <code> node has the
* 'data-line-numbers' attribute we also generate slide * 'data-line-numbers' attribute we also generate slide
* numbers. * numbers.
* *
* If the block contains multiple line highlight steps, * If the block contains multiple line highlight steps,
* we clone the block and create a fragment for each step. * we clone the block and create a fragment for each step.
*/ */
highlightBlock: function( block ) { highlightBlock: function( block ) {
hljs.highlightBlock( block ); hljs.highlightElement( block );
// Don't generate line numbers for empty code blocks // Don't generate line numbers for empty code blocks
if( block.innerHTML.trim().length === 0 ) return; if( block.innerHTML.trim().length === 0 ) return;
if( block.hasAttribute( 'data-line-numbers' ) ) { if( block.hasAttribute( 'data-line-numbers' ) ) {
hljs.lineNumbersBlock( block, { singleLine: true } ); hljs.lineNumbersBlock( block, { singleLine: true } );
var scrollState = { currentBlock: block }; var scrollState = { currentBlock: block };
// If there is at least one highlight step, generate // If there is at least one highlight step, generate
 End of changes. 4 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)