"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/formatter/class/wackoformatter.php" between
wacko.6.1.14.zip and wacko.6.1.15.zip

About: WackoWiki is a multilingual Wiki-engine that supports WYTIWYG-editing, page rights (ACLs), design themes (skins), file upload, email notification and much more.

wackoformatter.php  (wacko.6.1.14):wackoformatter.php  (wacko.6.1.15)
skipping to change at line 139 skipping to change at line 139
// headers // headers
"\n[ \t]*={2,7}.*?={2,7}|" . "\n[ \t]*={2,7}.*?={2,7}|" .
// separator // separator
"[-]{4,}|" . "[-]{4,}|" .
// line break // line break
"---\n?\s*|" . "---\n?\s*|" .
// strikethrough // strikethrough
"--\S--|" . "--\S--|" .
"--(\S.*?[^- \t\n\r])--|" . "--(\S.*?[^- \t\n\r])--|" .
// list including multilevel // list including multilevel
"\n(\t+|([ ]{2})+)(-|\*|([a-zA-Z]|(\d{1,3}))[\.\)](\#\d{1 ,3})?)?|" . "\n(\t+|([ ]{2})+)(-|\*|([a-zA-Z]{1,3}|[ivIV]+|(\d{1,3})) [\.\)](\#\d{1,3})?)?|" .
// media links // media links
"file:((\.\.|!)?\/)?[\p{L}\p{Nd}][\p{L}\p{Nd}\/\-\_\.]+\. (mp4|ogv|webm|m4a|mp3|ogg|opus|avif|gif|jp(?:eg|e|g)|jxl|png|svg|webp)(\?[[:alnu m:]\&]+)?|" . "file:((\.\.|!)?\/)?[\p{L}\p{Nd}][\p{L}\p{Nd}\/\-\_\.]+\. (mp4|ogv|webm|m4a|mp3|ogg|opus|avif|gif|jp(?:eg|e|g)|jxl|png|svg|webp)(\?[[:alnu m:]\&]+)?|" .
// interwiki links // interwiki links
"\b[[:alnum:]]+:[" . $object->lang['ALPHANUM_P'] . "\!\.] [" . $object->lang['ALPHANUM_P'] . "\(\)\-\_\.\+\&\=\#]+|" . "\b[[:alnum:]]+:[" . $object->lang['ALPHANUM_P'] . "\!\.] [" . $object->lang['ALPHANUM_P'] . "\(\)\-\_\.\+\&\=\#]+|" .
// disabled WikiNames // disabled WikiNames
"~([^ \t\n]+)|" . "~([^ \t\n]+)|" .
// wiki links (beside actions) // wiki links (beside actions)
($this->object->db->disable_wikilinks ($this->object->db->disable_wikilinks
? '' ? ''
: "(~?)(?<=[^\." . $object->lang['ALPHANUM_P'] . "]|^)(((\.\.|!)?\/)?" . $object->lang['UPPER'] . $object->lang['LOWER'] . "+" . $object->lang['UPPERNUM'] . $object->lang['ALPHANUM'] . "*)\b|") . : "(~?)(?<=[^\." . $object->lang['ALPHANUM_P'] . "]|^)(((\.\.|!)?\/)?" . $object->lang['UPPER'] . $object->lang['LOWER'] . "+" . $object->lang['UPPERNUM'] . $object->lang['ALPHANUM'] . "*)\b|") .
skipping to change at line 394 skipping to change at line 394
return '&gt;'; return '&gt;';
} }
// escaped text // escaped text
else if (preg_match('/^<!--escaped-->(.*)<!--escaped-->$/us', $th ing, $matches)) else if (preg_match('/^<!--escaped-->(.*)<!--escaped-->$/us', $th ing, $matches))
{ {
return $matches[1]; return $matches[1];
} }
// escaped html // escaped html
else if (preg_match('/^\<\#(.*)\#\>$/us', $thing, $matches)) else if (preg_match('/^\<\#(.*)\#\>$/us', $thing, $matches))
{ {
if ($this->object->db->disable_safehtml) if ($wacko->db->disable_safehtml)
{ {
return '<!--notypo-->' . $matches[1] . '<!--/noty po-->'; return '<!--notypo-->' . $matches[1] . '<!--/noty po-->';
} }
else else
{ {
return '<!--notypo-->' . $wacko->format($matches[ 1], 'safehtml') . '<!--/notypo-->'; return '<!--notypo-->' . $wacko->format($matches[ 1], 'safehtml') . '<!--/notypo-->';
} }
} }
// table begin // table begin
else if ($thing == '#||') else if ($thing == '#||')
skipping to change at line 612 skipping to change at line 612
{ {
return '<small>' . preg_replace_callback($this->LONG_REGE X, $callback, $matches[1]) . '</small>'; return '<small>' . preg_replace_callback($this->LONG_REGE X, $callback, $matches[1]) . '</small>';
} }
// cite // cite
else if ( preg_match('/^\'\'(.*?)\'\'$/us', $thing, $matches) else if ( preg_match('/^\'\'(.*?)\'\'$/us', $thing, $matches)
|| preg_match('/^\!\!((\((\S*?)\)(.*?\S))|(\S.*?\ S)|(\S))\!\!$/us', $thing, $matches)) || preg_match('/^\!\!((\((\S*?)\)(.*?\S))|(\S.*?\ S)|(\S))\!\!$/us', $thing, $matches))
{ {
$this->br = 1; $this->br = 1;
if (isset($matches[3]) if (isset($matches[3])
&& $color = in_array($matches[3], ($this->object- >db->allow_x11colors ? $this->x11_colors : $this->colors)) ? $matches[3] : '') && $color = in_array($matches[3], ($wacko->db->al low_x11colors ? $this->x11_colors : $this->colors)) ? $matches[3] : '')
{ {
return '<span class="cl-' . $color . '">' . preg_ replace_callback($this->LONG_REGEX, $callback, $matches[4]) . '</span>'; return '<span class="cl-' . $color . '">' . preg_ replace_callback($this->LONG_REGEX, $callback, $matches[4]) . '</span>';
} }
return '<span class="cite">' . preg_replace_callback($thi s->LONG_REGEX, $callback, $matches[1]) . '</span>'; return '<span class="cite">' . preg_replace_callback($thi s->LONG_REGEX, $callback, $matches[1]) . '</span>';
} }
// mark // mark
else if (preg_match('/^\?\?((\((\S*?)\)(.*?\S))|(\S.*?\S)|(\S))\? \?$/us', $thing, $matches)) else if (preg_match('/^\?\?((\((\S*?)\)(.*?\S))|(\S.*?\S)|(\S))\? \?$/us', $thing, $matches))
{ {
$this->br = 1; $this->br = 1;
if (isset($matches[3]) if (isset($matches[3])
&& $color = in_array($matches[3], ($this->object- >db->allow_x11colors ? $this->x11_colors : $this->colors)) ? $matches[3] : '') && $color = in_array($matches[3], ($wacko->db->al low_x11colors ? $this->x11_colors : $this->colors)) ? $matches[3] : '')
{ {
return '<mark class="mark-' . $color . '">' . pre g_replace_callback($this->LONG_REGEX, $callback, $matches[4]) . '</mark>'; return '<mark class="mark-' . $color . '">' . pre g_replace_callback($this->LONG_REGEX, $callback, $matches[4]) . '</mark>';
} }
return '<mark>' . preg_replace_callback($this->LONG_REGEX , $callback, $matches[1]) . '</mark>'; return '<mark>' . preg_replace_callback($this->LONG_REGEX , $callback, $matches[1]) . '</mark>';
} }
// urls // urls
else if ( preg_match('/^([[:alpha:]]+:\/\/\S+?)([^[:alnum:]^\/\( \)\-\_\=]?)$/u', $thing, $matches) else if ( preg_match('/^([[:alpha:]]+:\/\/\S+?)([^[:alnum:]^\/\( \)\-\_\=]?)$/u', $thing, $matches)
|| preg_match('/^(mailto\:[[:alnum:]\-\_\.]+\@[[: alnum:]\-\.\_]+?|xmpp\:[[:alnum:]\-\_\.]+\@[[:alnum:]\-\.\_]+?)([^[:alnum:]^\/\- \_\=]?)$/u', $thing, $matches)) || preg_match('/^(mailto\:[[:alnum:]\-\_\.]+\@[[: alnum:]\-\.\_]+?|xmpp\:[[:alnum:]\-\_\.]+\@[[:alnum:]\-\.\_]+?)([^[:alnum:]^\/\- \_\=]?)$/u', $thing, $matches))
{ {
skipping to change at line 717 skipping to change at line 717
$h_level = substr_count($matches[1], '=') - 1; $h_level = substr_count($matches[1], '=') - 1;
$result = $this->indent_close(); $result = $this->indent_close();
$this->br = 0; $this->br = 0;
$wacko->header_count++; $wacko->header_count++;
$header_id = 'h' . $this->page_id . '-' . $wacko->he ader_count; $header_id = 'h' . $this->page_id . '-' . $wacko->he ader_count;
return $result . return $result .
'<h' . $h_level . ' id="' . $header_id . '" class ="heading">' . '<h' . $h_level . ' id="' . $header_id . '" class ="heading">' .
preg_replace_callback($this->LONG_REGEX, $callback, $matches[2]) . preg_replace_callback($this->LONG_REGEX, $callback, $matches[2]) .
'<a class="self-link" href="#' . $header_ id . '"></a>' . '<a class="self-link" href="#' . $header_ id . '"></a>' .
// non-static section edit link via actio
n
($wacko->db->section_edit
&& in_array($wacko->method, ['sho
w', 'edit'])
&& $h_level > 1
? '<!--notypo--><!--action:begin-
->' .
'editsection ' .
'page=' . '/' . $
wacko->page['tag'] . ' ' .
'section=' . $wac
ko->header_count .
'<!--action:end--><!--/no
typo-->'
: '') .
'</h' . $h_level . '>'; '</h' . $h_level . '>';
} }
// separators // separators
else if (preg_match('/^-{4,}$/u', $thing)) else if (preg_match('/^-{4,}$/u', $thing))
{ {
$this->br = 0; $this->br = 0;
return "<hr>\n"; return "<hr>\n";
} }
// forced line breaks // forced line breaks
skipping to change at line 915 skipping to change at line 927
$text = preg_replace('/<!--markup:1:[\w ]+-->|<!--markup:2:[\w]+-->|\[\[|\(\(/u', '', $text); $text = preg_replace('/<!--markup:1:[\w ]+-->|<!--markup:2:[\w]+-->|\[\[|\(\(/u', '', $text);
#Diag::dbg('GOLD', ' ::forced:: ' . $thin g . ' => ' . $url . ' -> ' . $text); #Diag::dbg('GOLD', ' ::forced:: ' . $thin g . ' => ' . $url . ' -> ' . $text);
return $result . $wacko->pre_link($url, $ text); return $result . $wacko->pre_link($url, $ text);
} }
} }
return ''; return '';
} }
// indented text // indented text
else if (preg_match('/(\n)(\t+|(?:[ ]{2})+)(-|\*|([a-zA-Z]|\d{1,3 })[\.\)](\#\d{1,3})?)?(\n|$)/us', $thing, $matches)) else if (preg_match('/(\n)(\t+|(?:[ ]{2})+)(-|\*|([a-zA-Z]{1,3}|[ ivIV]+|\d{1,3})[\.\)](\#\d{1,3})?)?(\n|$)/us', $thing, $matches))
{ {
// new line // new line
$result .= ($this->br ? "<br>\n" : "\n"); $result .= ($this->br ? "<br>\n" : "\n");
// intable or not? // intable or not?
if ($this->intable) if ($this->intable)
{ {
$closers = &$this->tdindent_closers; $closers = &$this->tdindent_closers;
$old_level = &$this->tdold_indent_level; $old_level = &$this->tdold_indent_level;
$old_type = &$this->tdold_indent_type; $old_type = &$this->tdold_indent_type;
skipping to change at line 948 skipping to change at line 960
if ($matches[5]) if ($matches[5])
{ {
$start = mb_substr($matches[5], 1); $start = mb_substr($matches[5], 1);
} }
else else
{ {
$start = ''; $start = '';
} }
// find out which indent type we want // find out which indent type we want
$new_indent_type = $matches[3][0] ?? ''; $indent_type = $matches[3][0] ?? '';
// TODO: set list-style-type via predefined CSS class, e.
g. for 'lower-greek'
// the order matters for Roman numerals
$new_indent_type = match(1){
preg_match('/[*-]/', $indent_type) => '*',
preg_match('/\d/', $indent_type) =
> '1', // numbers
preg_match('/[iv]/', $indent_type) => 'i', /
/ lowercase Roman numerals
preg_match('/[IV]/', $indent_type) => 'I', /
/ uppercase Roman numerals
preg_match('/[a-z]/', $indent_type) => 'a', /
/ lowercase letters
preg_match('/[A-Z]/', $indent_type) => 'A', /
/ uppercase letters
default
=> '',
};
if (!$new_indent_type) if (!$new_indent_type)
{ {
$opener = '<div class="indent">'; $opener = '<div class="indent">';
$closer = '</div>' . "\n"; $closer = '</div>' . "\n";
$this->br = 1; $this->br = 1;
$new_type = 'i'; $new_type = 'i';
} }
else if ($new_indent_type == '-' || $new_indent_type == ' *') else if ($new_indent_type == '*')
{ {
$opener = '<ul><li>'; $opener = '<ul><li>';
$closer = '</li></ul>' . "\n"; $closer = '</li></ul>' . "\n";
$new_type = '*'; $new_type = '*';
$li = 1; $li = 1;
} }
else else
{ {
$opener = '<ol type="' . $new_indent_type . '">' . $opener = '<ol type="' . $new_indent_type . '">' .
'<li' . ($start ? ' val ue="' . $start . '"' : '') . '>'; '<li' . ($start ? ' val ue="' . $start . '"' : '') . '>';
 End of changes. 8 change blocks. 
7 lines changed or deleted 45 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)