idmillington / undum

A client-side framework for narrative hypertext interactive fiction.
https://idmillington.github.com/undum
MIT License
336 stars 80 forks source link

Ambiguous code on transient links #51

Closed Oreolek closed 5 years ago

Oreolek commented 7 years ago

Line 1615:

//  Remove links and transient sections.
$('#content a').each(function(index, element) {
  var a = $(element);
  if (a.hasClass('sticky') || a.attr("href").match(/[?&]sticky[=&]?/))
    return;
  a.replaceWith($("<span>").addClass("ex_link").html(a.html()));
});
var contentToHide = $('#content .transient, #content ul.options');
contentToHide.add($("#content a").filter(function(){
  return $(this).attr("href").match(/[?&]transient[=&]?/);
}));

It replaces every link with a <span> tag and only then it scans the content for the <a> links that have "transient" in their URL. But there are no <a> tags anymore.

I remember this code and it was made when I was tinkering with Markdown (see issue #27), so that an author could do a simple transient link-block without HTML, i.e. instead of <span class="transient">[go left](left)</span> do something like [go left](left?transient=true) or even [text here](?transient=true).