2
0
forked from Wavyzz/dolibarr

NEW Generation of doc by modulebuilder can include README and CHANGELOG

This commit is contained in:
Laurent Destailleur
2019-03-17 19:33:25 +01:00
parent 39b9ca2397
commit b3dc6d7d1d
7 changed files with 160 additions and 107 deletions

View File

@@ -53,3 +53,35 @@ function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null)
return $content;
}
/**
* Function to parse MD content into ASCIIDOC
*
* @param string $content MD content
* @param string $parser 'dolibarr'
* @param string $replaceimagepath Replace path to image with another path. Exemple: ('doc/'=>'xxx/aaa/')
* @return string Parsed content
*/
function dolMd2Asciidoc($content, $parser = 'dolibarr', $replaceimagepath = null)
{
if (is_array($replaceimagepath))
{
foreach($replaceimagepath as $key => $val)
{
$keytoreplace = ']('.$key;
$valafter = ']('.$val;
$content = preg_replace('/'.preg_quote($keytoreplace, '/').'/m', $valafter, $content);
}
}
//if ($parser == 'dolibarr')
//{
$content = preg_replace('/<!--.*-->/msU', '', $content);
//}
//else
//{
// $content = $content;
//}
return $content;
}