Gregwar\RST\Span::process PHP Метод

process() публичный Метод

Processes some data in the context of the span, this will process the **emphasis**, the nbsp, replace variables and end-of-line brs
public process ( $data )
    public function process($data)
    {
        $self = $this;
        $environment = $this->parser->getEnvironment();
        $span = $this->escape($data);
        // Emphasis
        $span = preg_replace_callback('/\\*\\*(.+)\\*\\*/mUsi', function ($matches) use($self) {
            return $self->strongEmphasis($matches[1]);
        }, $span);
        $span = preg_replace_callback('/\\*(.+)\\*/mUsi', function ($matches) use($self) {
            return $self->emphasis($matches[1]);
        }, $span);
        // Nbsp
        $span = preg_replace('/~/', $this->nbsp(), $span);
        // Replacing variables
        $span = preg_replace_callback('/\\|(.+)\\|/mUsi', function ($match) use($environment) {
            return $environment->getVariable($match[1]);
        }, $span);
        // Adding brs when a space is at the end of a line
        $span = preg_replace('/ \\n/', $this->br(), $span);
        return $span;
    }