$attributes = ' data-attributes="' . base64_encode(JSON::encode($tag['attributes'])) . '"';
}
- return '<woltlab-metacode-marker data-name="' . $name . '" data-uuid="' . $uuid . '"' . $attributes . ' />';
+ return '<woltlab-metacode-marker data-name="' . $name . '" data-uuid="' . $uuid . '" data-source="' . base64_encode($tag['source']) . '"' . $attributes . ' />';
}
/**
return '';
}
- return '<woltlab-metacode-marker data-uuid="' . $data['uuid'] . '" />';
+ return '<woltlab-metacode-marker data-uuid="' . $data['uuid'] . '" data-source="' . base64_encode($tag['source']) . '" />';
}
/**
$attributes = $element->getAttribute('data-attributes');
$name = $element->getAttribute('data-name');
$uuid = $element->getAttribute('data-uuid');
+ $source = @base64_decode($element->getAttribute('data-source'));
if (!isset($pairs[$uuid])) {
$pairs[$uuid] = [
$pairs[$uuid]['attributes'] = $attributes;
$pairs[$uuid]['name'] = $name;
$pairs[$uuid]['open'] = $element;
+ $pairs[$uuid]['openSource'] = $source;
}
else {
$pairs[$uuid]['close'] = $element;
+ $pairs[$uuid]['closeSource'] = $source;
}
}
$groups[$name][] = [
'attributes' => $data['attributes'],
'close' => $data['close'],
- 'open' => $data['open']
+ 'closeSource' => $data['closeSource'],
+ 'open' => $data['open'],
+ 'openSource' => $data['openSource']
];
}
$end = $pair['close'];
$attributes = (isset($pair['attributes'])) ? $pair['attributes'] : '';
- $textNode = $start->ownerDocument->createTextNode(HtmlBBCodeParser::getInstance()->buildBBCodeTag($name, $attributes, true));
+ $textNode = $start->ownerDocument->createTextNode(($pair['openSource']) ?: HtmlBBCodeParser::getInstance()->buildBBCodeTag($name, $attributes, true));
DOMUtil::insertBefore($textNode, $start);
DOMUtil::removeNode($start);
- $textNode = $end->ownerDocument->createTextNode('[/' . $name . ']');
+ $textNode = $end->ownerDocument->createTextNode(($pair['closeSource']) ?: '[/' . $name . ']');
DOMUtil::insertBefore($textNode, $end);
DOMUtil::removeNode($end);
}