Browse Source

Merge pull request #25847 from lamrani002/addChangeLogToDoc

NEW functionality add section changeLog to Doc in MB
Laurent Destailleur 1 year ago
parent
commit
575aa4af43
1 changed files with 21 additions and 0 deletions
  1. 21 0
      htdocs/modulebuilder/index.php

+ 21 - 0
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';