public function linkref_callback($matches)
    {
        $i = 0;
        if ($url = $this->linkrefs[$matches[1]]) {
            $attrib = (array)$this->options['link_attribs'];
            $attrib['href'] = $url;
            $i = $this->add(html::a($attrib, rcube::Q($matches[1])));
        }

        return $i > 0 ? '['.$this->get_replacement($i).']' : $matches[0];
    }