From 27326a3eb67876dcf3817e5c0dbf42e7028b72b4 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 27 Aug 2003 06:08:34 +0000 Subject: [PATCH] Move Library parsing code into text_to_html --- lib/weblib.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index b44f438f89..f7ba5483be 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -485,12 +485,6 @@ function format_text($text, $format=FORMAT_MOODLE, $options=NULL) { if (!isset($options->para)) { $options->para=true; } - if (!empty($CFG->librarypath)) { - if (file_exists("$CFG->dirroot/$CFG->librarypath/librarylib.php")) { - include_once("$CFG->dirroot/$CFG->librarypath/librarylib.php"); - $text = librarytexttohtml($text); - } - } return text_to_html($text, $options->smiley, $options->para); break; } @@ -597,6 +591,8 @@ function text_to_html($text, $smiley=true, $para=true) { /// Given plain text, makes it into HTML as nicely as possible. /// May contain HTML tags already + global $CFG; + /// Remove any whitespace that may be between HTML tags $text = eregi_replace(">([[:space:]]+)<", "><", $text); @@ -609,6 +605,14 @@ function text_to_html($text, $smiley=true, $para=true) { /// Make returns into HTML newlines. $text = nl2br($text); +/// Insert links to library pages if Library is being used + if (!empty($CFG->librarypath)) { + if (file_exists("$CFG->dirroot/$CFG->librarypath/librarylib.php")) { + include_once("$CFG->dirroot/$CFG->librarypath/librarylib.php"); + $text = librarytexttohtml($text); + } + } + /// Turn smileys into images. if ($smiley) { replace_smilies($text); -- 2.39.5