editlink.href = '';
editlink.onclick = undefined;
pagebody.setAttribute('contenteditable', true);
- pagebody.innerHTML = pagebody.innerHTML
- .replace(/<!--BLOCK:(.*?)-->[^]*?<!--\/-->/g, '$1');
+ pagebody.querySelectorAll('[data-dyn]').forEach(function (el) {
+ el.outerHTML = '[[' + el.getAttribute('data-dyn') + ']]';
+ });
CKEDITOR.inline(pagebody, { customConfig: '' });
document.body.className = 'edit';
return false;
$doc = preg_replace('{\s*<([a-z]+) class="'.$hideclass.'">.*?</\1>}s', '', $doc);
return preg_replace_callback(
- '{ (?<! <!--BLOCK: ) \[\[ ([^] ]+) ([^]]*) \]\] }x',
+ '{ \[\[ ([^] ]+) ([^]]*) \]\] }x',
function ($sub) use ($blocks) {
list ($placeholder, $name, $params) = $sub;
- if (isset($blocks[$name])) {
- $html = $blocks[$name];
+ $html = $blocks[$name] ??
+ placeholder_include($name, explode(' ', $params));
+ if (empty($html) or $html[0] != '<') {
+ $html = "<span>$html</span>";
}
- else {
- $html = placeholder_include($name, explode(' ', $params));
- }
- return sprintf('<!--BLOCK:%s-->%s<!--/-->',
- is_numeric($name) ? '' : $placeholder, # edit replacement
- preg_replace('{<!--[^-]*-->}', '', $html) # contents
- );
+ $attr = sprintf(' data-dyn="%s"', is_numeric($name) ? '' : $name.$params);
+ # contents with identifier in first tag
+ return preg_replace( '/(?=>)/', $attr, $html, 1);
},
$doc
);
function shownews($input, $limit = 1000)
{
if (!is_array($input)) $input = glob("$input/*.html");
+ print "<div>\n";
foreach (array_reverse($input) as $filename) {
$article = new ArchiveArticle($filename);
print '<article class="left">';
if (--$limit <= 0) break;
}
+ print "</div>\n";
}
function printtoc($input, $class = FALSE)
$articles = (ltrim($Args, '/') ?: 'nieuws');
if (strpos($articles, '/') === FALSE) {
if (@$Place['view'] === 'toc') {
+ print "<div>\n";
foreach (array_reverse(glob("$articles/2???")) as $page) {
$year = basename($page, '.html');
printf('<h3><a href="/%s">%s</a></h3>'."\n", $page, $year);
printtoc($page, 'gallery');
}
+ print "</div>\n";
return;
}
$articles .= '/????';