NEW Add function dolMd2Html

This commit is contained in:
Laurent Destailleur 2017-03-21 16:02:54 +01:00
parent 68257283e4
commit a5c11dc840
11 changed files with 1762 additions and 25 deletions

View File

@ -22,6 +22,7 @@ Mobiledetect 2.8.17 MIT License Yes
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files
ParseDown 1.6 MIT License Yes Markdown parser
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service

View File

@ -239,7 +239,7 @@ $head[$h][2] = 'desc';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
$head[$h][1] = $langs->trans("Features");
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
$head[$h][2] = 'feature';
$h++;
@ -251,45 +251,38 @@ foreach($orders as $tmpkey => $tmpvalue)
if ($objMod->numero == $id)
{
$key = $i;
$modName = $filename[$tmpkey];
$dirofmodule = $dirmod[$tmpkey];
break;
}
$i++;
}
$value = $orders[$key];
$special = $objMod->special;
$tab=explode('_',$value);
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
// Check filters
$modulename=$objMod->getName();
$moduledesc=$objMod->getDesc();
$moduleauthor=$objMod->getPublisher();
print '<div class="centpercent">';
print load_fiche_titre($objMod->getDesc(),$moreinfo,'object_'.$objMod->picto);
print load_fiche_titre(($modulename?$modulename:$moduledesc), $moreinfo, 'object_'.$objMod->picto);
print '<br>';
dol_fiche_head($head, $mode, $title);
dol_fiche_head($head, $mode, $title, -1);
$tab=explode('_',$value);
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
$modName = $filename[$key];
$objMod = $modules[$key];
$dirofmodule = $dirmod[$key];
$special = $objMod->special;
if (! $objMod->getName())
if (! $modulename)
{
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
}
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
// Check filters
$modulename=$objMod->getName();
$moduledesc=$objMod->getDesc();
$moduledesclong=$objMod->getDescLong();
$moduleauthor=$objMod->getPublisher();
// Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
@ -322,6 +315,8 @@ $text='';
if ($mode == 'desc')
{
if ($moduledesc) $text.=$moduledesc.'<br><br>';
$text.='<strong>'.$langs->trans("Version").':</strong> '.$version;
$textexternal='';
@ -329,7 +324,7 @@ if ($mode == 'desc')
{
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> <a href="'.$objMod->editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
$text.=$textexternal;
$text.='<br>';
}
@ -342,7 +337,8 @@ if ($mode == 'desc')
else $text.=$langs->trans("Disabled");
$text.='<br>';
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>';
$moduledesclong=$objMod->getDescLong();
if ($moduledesclong) $text.='<br><hr><br>'.$moduledesclong.'<br>';
}
if ($mode == 'feature')
@ -360,6 +356,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
@ -372,6 +370,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
@ -384,6 +384,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
@ -391,6 +393,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
@ -398,6 +402,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
@ -410,6 +416,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
@ -417,6 +425,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
@ -429,6 +439,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
@ -441,6 +453,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
{
@ -448,6 +462,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
@ -460,6 +476,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
@ -472,6 +490,8 @@ if ($mode == 'feature')
}
else $text.=$langs->trans("No");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text.=$langs->trans("DetectionNotPossible");
}

View File

@ -0,0 +1,46 @@
<?php
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/lib/parsemd.lib.php
* \brief This file contains functions dedicated to MD parsind.
*/
/**
* Function to parse MD content into HTML
*
* @param string $content MD content
* @param string $parser 'parsedown' or 'nl2br'
* @return string Parsed content
*/
function dolMd2Html($content, $parser='parsedown')
{
if ($parser == 'parsedown')
{
include DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php';
$Parsedown = new Parsedown();
$content = $Parsedown->text($content);
}
else
{
$content = nl2br($content);
}
return $content;
}

View File

@ -69,7 +69,7 @@ class modFacture extends DolibarrModules
$this->conflictwith = array();
$this->langfiles = array("bills","companies","compta","products");
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
$this->warnings_activation_ext = array('CA'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
// Config pages
$this->config_page_url = array("facture.php");

View File

@ -0,0 +1,16 @@
language: php
php:
- 7.1
- 7.0
- 5.6
- 5.5
- 5.4
- 5.3
- hhvm
- hhvm-nightly
matrix:
fast_finish: true
allow_failures:
- php: hhvm-nightly

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2013 Emanuil Rusev, erusev.com
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
> You might also like [Caret](http://caret.io?ref=parsedown) - our Markdown editor for Mac / Windows / Linux.
## Parsedown
[![Build Status](https://img.shields.io/travis/erusev/parsedown/master.svg?style=flat-square)](https://travis-ci.org/erusev/parsedown)
<!--[![Total Downloads](http://img.shields.io/packagist/dt/erusev/parsedown.svg?style=flat-square)](https://packagist.org/packages/erusev/parsedown)-->
Better Markdown Parser in PHP
[Demo](http://parsedown.org/demo) |
[Benchmarks](http://parsedown.org/speed) |
[Tests](http://parsedown.org/tests/) |
[Documentation](https://github.com/erusev/parsedown/wiki/)
### Features
* One File
* Super Fast
* Extensible
* [GitHub flavored](https://help.github.com/articles/github-flavored-markdown)
* Tested in 5.3 to 7.1 and in HHVM
* [Markdown Extra extension](https://github.com/erusev/parsedown-extra)
### Installation
Include `Parsedown.php` or install [the composer package](https://packagist.org/packages/erusev/parsedown).
### Example
``` php
$Parsedown = new Parsedown();
echo $Parsedown->text('Hello _Parsedown_!'); # prints: <p>Hello <em>Parsedown</em>!</p>
```
More examples in [the wiki](https://github.com/erusev/parsedown/wiki/) and in [this video tutorial](http://youtu.be/wYZBY8DEikI).
### Questions
**How does Parsedown work?**
It tries to read Markdown like a human. First, it looks at the lines. Its interested in how the lines start. This helps it recognise blocks. It knows, for example, that if a line starts with a `-` then perhaps it belongs to a list. Once it recognises the blocks, it continues to the content. As it reads, it watches out for special characters. This helps it recognise inline elements (or inlines).
We call this approach "line based". We believe that Parsedown is the first Markdown parser to use it. Since the release of Parsedown, other developers have used the same approach to develop other Markdown parsers in PHP and in other languages.
**Is it compliant with CommonMark?**
It passes most of the CommonMark tests. Most of the tests that don't pass deal with cases that are quite uncommon. Still, as CommonMark matures, compliance should improve.
**Who uses it?**
[phpDocumentor](http://www.phpdoc.org/), [October CMS](http://octobercms.com/), [Bolt CMS](http://bolt.cm/), [Kirby CMS](http://getkirby.com/), [Grav CMS](http://getgrav.org/), [Statamic CMS](http://www.statamic.com/), [Herbie CMS](http://www.getherbie.org/), [RaspberryPi.org](http://www.raspberrypi.org/), [Symfony demo](https://github.com/symfony/symfony-demo) and [more](https://packagist.org/packages/erusev/parsedown/dependents).
**How can I help?**
Use it, star it, share it and if you feel generous, [donate](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=528P3NZQMP8N2).

View File

@ -0,0 +1,21 @@
{
"name": "erusev/parsedown",
"description": "Parser for Markdown.",
"keywords": ["markdown", "parser"],
"homepage": "http://parsedown.org",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Emanuil Rusev",
"email": "hello@erusev.com",
"homepage": "http://erusev.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-0": {"Parsedown": ""}
}
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="test/bootstrap.php" colors="true">
<testsuites>
<testsuite>
<file>test/ParsedownTest.php</file>
</testsuite>
</testsuites>
</phpunit>

View File

@ -1131,6 +1131,7 @@ CompanyIdProfChecker=Rules on Professional Ids
MustBeUnique=Must be unique?
MustBeMandatory=Mandatory to create third parties?
MustBeInvoiceMandatory=Mandatory to validate invoices?
TechnicalServicesProvided=Technical services provided
##### Webcal setup #####
WebCalUrlForVCalExport=An export link to <b>%s</b> format is available at following link: %s
##### Invoices #####