I’ve found the error. There were line breaks in the image title, they have been pasted from the original source into the WordPress image description field by our editors.
In class-frontend.php (function add_gallery_lightbox_selector) in line 150 (in version 1.6.8) is the code where the data-rel attribute gets inserted into the $link markup. But the preg_match-functions expect a single line, while the $title variable inserts a line break into the markup. I’ve patched the code to match as single lines by introducing a ‘s’ modifier to the regex.
original:
$link = ( preg_match( '/<a.*? (?:data-rel)=("|\').*?("|\')>/', $link ) === 1 ? preg_replace( '/(<a.*? data-rel=(?:"|\').*?)((?:"|\').*?>)/', '$1 ' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '$2', $link ) : preg_replace( '/(<a.*?)>/', '$1 data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '">', $link ) );
patched:
$link = ( preg_match( '/<a.*? (?:data-rel)=("|\').*?("|\')>/s', $link ) === 1 ? preg_replace( '/(<a.*? data-rel=(?:"|\').*?)((?:"|\').*?>)/s', '$1 ' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '$2', $link ) : preg_replace( '/(<a.*?)>/s', '$1 data-rel="' . Responsive_Lightbox()->options['settings']['selector'] . '-gallery-' . $this->gallery_no . '">', $link ) );
This seems to work so far without problems. Perhaps you could test this modifications and introduce it in your next release.