From f2b72ec15a8356130de60f355ac8fe2ca3908144 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Fri, 8 Sep 2023 14:45:59 +0200 Subject: [PATCH] NEW functionality add section changeLog to Doc in MB --- htdocs/modulebuilder/index.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 668991818b5..a3d20c1179d 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -818,6 +818,27 @@ if ($dirins && $action == 'initdoc' && !empty($module)) { writeApiUrlsInDoc($apiFile, $destfile); } + // add ChangeLog in Doc + if (file_exists($dirins.'/'.strtolower($module).'/ChangeLog.md')) { + $changeLog = $dirins.'/'.strtolower($module).'/ChangeLog.md'; + $string = file_get_contents($changeLog); + + $replace = explode("\n", $string); + $strreplace = array(); + foreach ($replace as $line) { + if ($line === '') { + continue; + } + if (strpos($line, '##') !== false) { + $strreplace[$line] = str_replace('##', '', $line); + } else { + $strreplace[$line] = $line; + } + } + $stringLog = implode("\n", $strreplace); + dolREplaceInFile($destfile, array('//include::ChangeLog.md[]' => '','__CHANGELOG__' => $stringLog)); + } + // Delete old documentation files $FILENAMEDOC = $modulelowercase.'.html'; $FILENAMEDOCPDF = $modulelowercase.'.pdf';