Skip to content

Commit

Permalink
Suporting unicode id's
Browse files Browse the repository at this point in the history
Don't care about the actual content of id. HTML4 cares, but html5 does not. Even, in html4, is pointless manufacturing a new id to target that indeed it is not there. If the id is not legal searching for it will fail and the effect would be the current behavior.

It fixes  hakimel#2198. About pandoc generated ids based on unicode titles.
  • Loading branch information
vokimon authored Jul 23, 2018
1 parent a82c433 commit de19d08
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3691,12 +3691,8 @@
// assume that this is a named link
if( isNaN( parseInt( bits[0], 10 ) ) && name.length ) {
var element;

// Ensure the named link is a valid HTML ID attribute
if( /^[a-zA-Z][\w:.-]*$/.test( name ) ) {
// Find the slide with the specified ID
element = document.getElementById( name );
}
name = decodeURIComponent(name);
element = document.getElementById( name );

if( element ) {
// Find the position of the named slide and navigate to it
Expand Down Expand Up @@ -3743,9 +3739,6 @@

// Attempt to create a named link based on the slide's ID
var id = currentSlide.getAttribute( 'id' );
if( id ) {
id = id.replace( /[^a-zA-Z0-9\-\_\:\.]/g, '' );
}

// If the current slide has an ID, use that as a named link
if( typeof id === 'string' && id.length ) {
Expand Down

0 comments on commit de19d08

Please sign in to comment.