Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Remove $this->in_anchor #125

Closed
yuanzhou opened this Issue · 5 comments

2 participants

@yuanzhou

$this->in_anchor is used as a status flag to avoid invalid nesting in doAnchors(). The problem I see is this variable does nothing.

@michelf
Owner

What do you mean by "this variable does nothing", you've just explained what it does.

@yuanzhou

Here is my understanding:

protected function doAnchors($text) {
    if ($this->in_anchor) return $text;
    $this->in_anchor = true;

    // code

    $this->in_anchor = false;
    return $text;
}

By default, $this->in_anchor is defined as protected and it's set to false, so this function will never change the value of $this->in_anchor.

@michelf
Owner

But note that this function is called recursively when processing the textual content of the link. See the call to $this->runSpanGamut($link_text) in the two callbacks below it, which, in turn, will call doAnchor again.

@yuanzhou

Got it. Thanks a lot for the explanation. I had this question when I thought to change $in_anchor to a local variable. Now I'll put it back as a class property.

@michelf
Owner

You're welcome.

@michelf michelf closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.