To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 157b21ce authored by vermeul's avatar vermeul
Browse files

bugfix: editing sections of text only

parent 2229ca91
......@@ -139,17 +139,21 @@ EOT;
foreach($annotations as $annotation) {
# if a category has no parent, just show the category name
# in all other cases show parent_category:child_category
$wikitext = preg_replace(
'/{{\s*#annot(?:<end>end)?.*?}}/',
'',
$annotation->wiki_text
);
#$wikitext = preg_replace(
# '/{{\s*#annot(?:<end>end)?.*?}}/',
# '',
# $annotation->wiki_text
#);
#if (strlen($wikitext) > 40) {
# $wikitext = substr($wikitext, 0, 20) . ' ... ';
#}
$cat = $annotation->parent_category ? $annotation->parent_category . "/" . $annotation->category : $annotation->category;
$table .= "|-\n";
$table .= "| ".$cat
." || ".$annotation->comment
." || [[".$annotation->title."#".$annotation->bookmark . "]]"
." || " . $wikitext
#." || <pre>" . $wikitext . "</pre>"
." || "
."\n || " . $annotation->last_edited_by
."\n || " . wfTimestamp( TS_ISO_8601, $annotation->last_modified)
."\n";
......@@ -872,7 +876,12 @@ EOT;
$cat_strs = preg_split("/\s*\,\s*/", $category, -1, PREG_SPLIT_NO_EMPTY);
$cats = array();
foreach($cat_strs as $cat_str) {
$cat = self::get_category($dbw, $cat_str);
if ( preg_match("/^\s*\d*\s*$/", $cat_str) ) {
$cat = self::get_category_and_parent_for_id($dbw, $cat_str);
}
else {
$cat = self::get_category($dbw, $cat_str);
}
if ($cat) {
array_push($cats, $cat);
}
......@@ -1011,7 +1020,8 @@ EOT;
public static function onAlternateEdit($editPage) {
}
// transforms all categories from their internal ID to a text.
// This hook is called after hitting the «edit» button of a page.
// It transforms all categories from their internal ID into readable text.
// This allows us to change the category names later without having
// to change all source code where this category occurs.
public static function onEditFormInitialText($editPage) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment