in js/controllers/location.js [43:97]
getIndicesFromHash( hash=window.location.hash, options={} ) {
// Attempt to parse the hash as either an index or name
let name = hash.replace( /^#\/?/, '' );
let bits = name.split( '/' );
// If the first bit is not fully numeric and there is a name we
// can assume that this is a named link
if( !/^[0-9]*$/.test( bits[0] ) && name.length ) {
let slide;
let f;
// Parse named links with fragments (#/named-link/2)
if( /\/[-\d]+$/g.test( name ) ) {
f = parseInt( name.split( '/' ).pop(), 10 );
f = isNaN(f) ? undefined : f;
name = name.split( '/' ).shift();
}
// Ensure the named link is a valid HTML ID attribute
try {
slide = document
.getElementById( decodeURIComponent( name ) )
.closest('.slides>section, .slides>section>section');
}
catch ( error ) { }
if( slide ) {
return { ...this.Reveal.getIndices( slide ), f };
}
}
else {
const config = this.Reveal.getConfig();
let hashIndexBase = config.hashOneBasedIndex || options.oneBasedIndex ? 1 : 0;
// Read the index components of the hash
let h = ( parseInt( bits[0], 10 ) - hashIndexBase ) || 0,
v = ( parseInt( bits[1], 10 ) - hashIndexBase ) || 0,
f;
if( config.fragmentInURL ) {
f = parseInt( bits[2], 10 );
if( isNaN( f ) ) {
f = undefined;
}
}
return { h, v, f };
}
// The hash couldn't be parsed or no matching named link was found
return null
}