public function build($node, $matches, $options = array()) { $img = new node('img'); $img->set_attribute('src', $matches[1][0]); $alt = isset($matches[2]) ? $matches[2][0] : ''; $img->set_attribute('alt', preg_replace('/~(.)/', '$1', $alt)); $node->append($img); }
public function build($node, $matches, $options = array()) { $link = new node('a'); $link->set_attribute('href', rawurldecode($matches[1][0])); $this->apply($link, $matches[2][0], $options); $node->append($link); }
public function build($node, $matches, $options = array()) { if (isset($options['interwiki'])) { preg_match('/(.*?):(.*)/', $matches[1][0], $m); } if (!isset($m[1]) || !isset($options['interwiki'][$m[1]])) { return parent::build($node, $matches, $options); } $format = $options['interwiki'][$m[1]]; $link = new node('a'); $link->set_attribute('href', $this->format_link(preg_replace('/~(.)/', '$1', $m[2]), $format)); $this->apply($link, $matches[2][0], $options); $node->append($link); }