diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index f28df995c45..16834e7837b 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -134,6 +134,27 @@ Change also file Luracast/Restler/explorer/index.html PARSEDOWN --------- +* Add support of css by adding in Parsedown.php: + + // @CHANGE LDR + 'class' => $Link['element']['attributes']['class'] + + ... + + // @CHANGE LDR + if (preg_match('/{([^}]+)}/', $remainder, $matches2)) + { + $Element['attributes']['class'] = $matches2[1]; + $remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder); + } + + + // @CHANGE LDR + //$markup .= $this->{$Element['handler']}($Element['text']); + $markup .= preg_replace('/>{[^}]+}/', '>', $this->{$Element['handler']}($Element['text'])); + + + * Fix to avoid fatal error when mb_strlen not available: // @CHANGE LDR Fix when mb_strlen is not available diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index c8fd99339e7..eaf674d5eea 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -641,6 +641,7 @@ class DolibarrModules // Can not be abstract, because we need to insta if ((float) DOL_VERSION >= 6.0) { @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php'; + $content = dolMd2Html($content, 'parsedown', array( 'doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1), diff --git a/htdocs/includes/parsedown/Parsedown.php b/htdocs/includes/parsedown/Parsedown.php index a1ec563683f..df718bce111 100644 --- a/htdocs/includes/parsedown/Parsedown.php +++ b/htdocs/includes/parsedown/Parsedown.php @@ -1180,7 +1180,9 @@ class Parsedown 'name' => 'img', 'attributes' => array( 'src' => $Link['element']['attributes']['href'], - 'alt' => $Link['element']['text'], + 'alt' => $Link['element']['text'], + // @CHANGE LDR + 'class' => $Link['element']['attributes']['class'] ), ), ); @@ -1231,6 +1233,13 @@ class Parsedown } $extent += strlen($matches[0]); + + // @CHANGE LDR + if (preg_match('/{([^}]+)}/', $remainder, $matches2)) + { + $Element['attributes']['class'] = $matches2[1]; + $remainder = preg_replace('/{'.preg_quote($matches2[1],'/').'}/', '', $remainder); + } } else { @@ -1426,7 +1435,9 @@ class Parsedown if (isset($Element['handler'])) { - $markup .= $this->{$Element['handler']}($Element['text']); + // @CHANGE LDR + //$markup .= $this->{$Element['handler']}($Element['text']); + $markup .= preg_replace('/>{[^}]+}/', '>', $this->{$Element['handler']}($Element['text'])); } else { diff --git a/htdocs/modulebuilder/template/README.md b/htdocs/modulebuilder/template/README.md index 1eb5ffe771a..d745c808bf4 100644 --- a/htdocs/modulebuilder/template/README.md +++ b/htdocs/modulebuilder/template/README.md @@ -3,6 +3,10 @@ ## Features Description... + + Other modules are available on Dolistore.com. @@ -25,44 +29,44 @@ There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module- Install ------- -### Manually +### From the ZIP file and GUI interface -- Make sure Dolibarr is already installed and configured on your workstation or development server. +- If you get the module in a zip file (like when downloading it from the market place [Dolistore](https://www.dolistore.com)), go into +menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file. -- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file -- Find the following lines: +Note: If this screen tell you there is no custom directory, check your setup is correct: + +- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented: + ```php //$dolibarr_main_url_root_alt ... //$dolibarr_main_document_root_alt ... ``` -- And uncomment these lines (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation +- Uncomment them if necessary (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation For example : - UNIX: ```php - $dolibarr_main_url_root = 'http://localhost/Dolibarr/htdocs'; - $dolibarr_main_document_root = '/var/www/Dolibarr/htdocs'; $dolibarr_main_url_root_alt = '/custom'; $dolibarr_main_document_root_alt = '/var/www/Dolibarr/htdocs/custom'; ``` - Windows: ```php - $dolibarr_main_url_root = 'http://localhost/Dolibarr/htdocs'; - $dolibarr_main_document_root = 'C:/My Web Sites/Dolibarr/htdocs'; $dolibarr_main_url_root_alt = '/custom'; $dolibarr_main_document_root_alt = 'C:/My Web Sites/Dolibarr/htdocs/custom'; ``` - - For more information about the ```conf.php``` file take a look at the conf.php.example file. + +### From a GIT repository - Clone the repository in ```$dolibarr_main_document_root_alt/mymodule``` ```sh -git clone git@github.com:Dolibarr/dolibarr-module-template.git mymodule +cd ....../custom +git clone git@github.com:gitlogin/mymodule.git mymodule ``` ### Final steps @@ -75,11 +79,6 @@ From your browser: -## Publishing the module -The de-facto standard for publishing and marketing modules for Dolibarr is the [Dolistore](https://www.dolistore.com). -Templates for required images and texts are [provided](dev/dolistore). -Check the dedicated [README](dev/dolistore/README.md) for more informations. - --> diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 41cf3da2090..037c6a0f069 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4575,6 +4575,15 @@ dl.dropdown { } +/* ============================================================================== */ +/* Mardown rendering */ +/* ============================================================================== */ + +.imgmd { + width: 90%; +} + + /* ============================================================================== */ /* JMobile */ /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index d6833d7e444..8ab38157947 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4558,6 +4558,16 @@ dl.dropdown { } + +/* ============================================================================== */ +/* Mardown rendering */ +/* ============================================================================== */ + +.imgmd { + width: 90%; +} + + /* ============================================================================== */ /* JMobile */ /* ============================================================================== */