Update to github style
This commit is contained in:
parent
eaac1f6182
commit
d33dcc9bdc
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
phpunit.xml
|
phpunit.xml
|
||||||
/vendor/
|
/vendor/
|
||||||
|
/.idea/
|
||||||
|
@ -6,47 +6,76 @@
|
|||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
|
*
|
||||||
|
* Update for ParsedownExtra version 0.8.0-beta-1 by ms502040 <mira@neyowo.com>
|
||||||
|
*
|
||||||
|
* If you don't want points before checkbox add to style:
|
||||||
|
* .task-list-item {
|
||||||
|
* list-style-type: none;
|
||||||
|
* }
|
||||||
|
* .task-list-item-checkbox {
|
||||||
|
* margin: 0 0.2em 0.25em -1.6em;
|
||||||
|
* vertical-align: middle;
|
||||||
|
* }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ParsedownCheckbox extends ParsedownExtra
|
class ParsedownCheckbox extends ParsedownExtra
|
||||||
{
|
{
|
||||||
const VERSION = '0.1.0';
|
const VERSION = '0.1.1';
|
||||||
protected function blockListComplete(array $block)
|
|
||||||
|
/**
|
||||||
|
* ParsedownCheckbox constructor.
|
||||||
|
*
|
||||||
|
* @throws \Exception Incompatible parent version
|
||||||
|
*/
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
if (version_compare(parent::version, '0.8.0-beta-1', '<')) {
|
||||||
|
throw new Exception('ParsedownCheckbox requires a minimum version 0.8.0-beta-1 of ParsedownExtra');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
ParsedownExtra::__construct();
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new Exception($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function blockListComplete(array $block)
|
||||||
{
|
{
|
||||||
if (null === $block) {
|
if (null === $block) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(isset($block['element']) && ($block['element']['name'] === 'ul') && is_array($block['element']['elements']))
|
if (!(isset($block['element']) && ($block['element']['name'] === 'ul') && is_array($block['element']['elements']))
|
||||||
) {
|
) {
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
//echo '<pre>';var_dump($block);echo '</pre>';
|
|
||||||
|
|
||||||
foreach ($block['element']['elements'] as &$element) {
|
foreach ($block['element']['elements'] as &$element) {
|
||||||
if (!isset($element['handler']['argument'][0])){
|
if (!isset($element['handler']['argument'][0])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$begin_line = substr(trim($element['handler']['argument'][0]), 0, 4);
|
$begin_line = substr(trim($element['handler']['argument'][0]), 0, 4);
|
||||||
$re = '/.*(\s{2,})$/';
|
$re = '/.*(\s{2,})$/';
|
||||||
if ('[ ] ' === $begin_line) {
|
if ('[ ] ' === $begin_line) {
|
||||||
if(preg_match_all($re, $element['handler']['argument'][0], $matches, PREG_SET_ORDER, 0) > 0){
|
if (preg_match_all($re, $element['handler']['argument'][0], $matches, PREG_SET_ORDER, 0) > 0) {
|
||||||
$element['handler']['argument'][0] = trim($element['handler']['argument'][0]) . '<br>';
|
$element['handler']['argument'][0] = trim($element['handler']['argument'][0]) . '<br>';
|
||||||
}
|
}
|
||||||
$element['handler']['argument'][0] = '<input type="checkbox" disabled /> '. substr($element['handler']['argument'][0], 4);
|
$element['handler']['argument'][0] = '<input type="checkbox" class="task-list-item-checkbox" disabled /> ' . substr($element['handler']['argument'][0], 4);
|
||||||
unset ($element['name']);
|
$element['attributes'] = array('class' => 'task-list-item');
|
||||||
unset ($block['element']['name']);
|
|
||||||
|
|
||||||
} elseif ('[x] ' === $begin_line) {
|
} elseif ('[x] ' === $begin_line) {
|
||||||
if(preg_match_all($re, $element['handler']['argument'][0], $matches, PREG_SET_ORDER, 0) > 0){
|
if (preg_match_all($re, $element['handler']['argument'][0], $matches, PREG_SET_ORDER, 0) > 0) {
|
||||||
$element['handler']['argument'][0] = trim($element['handler']['argument'][0]) . '<br>';
|
$element['handler']['argument'][0] = trim($element['handler']['argument'][0]) . '<br>';
|
||||||
}
|
}
|
||||||
$element['handler']['argument'][0] = '<input type="checkbox" checked disabled /> '. substr($element['handler']['argument'][0], 4);
|
$element['handler']['argument'][0] = '<input type="checkbox" class="task-list-item-checkbox" checked disabled /> ' . substr($element['handler']['argument'][0], 4);
|
||||||
unset ($element['name']);
|
$element['attributes'] = array('class' => 'task-list-item');
|
||||||
unset ($block['element']['name']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($element);
|
unset($element);
|
||||||
|
$block['element']['attributes'] = array('class' => 'contains-task-list');
|
||||||
|
|
||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,18 @@
|
|||||||
"name": "Simon Leblanc",
|
"name": "Simon Leblanc",
|
||||||
"email": "contact@leblanc-simon.eu",
|
"email": "contact@leblanc-simon.eu",
|
||||||
"homepage": "https://www.leblanc-simon.fr"
|
"homepage": "https://www.leblanc-simon.fr"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "NEYOWO",
|
||||||
|
"email": "mira@neyowo.com",
|
||||||
|
"homepage": "https://neyowo.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"erusev/parsedown-extra": "^0.7.1"
|
"erusev/parsedown": "1.8.0-beta-4",
|
||||||
|
"erusev/parsedown-extra": "0.8.0-beta-1"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": ["ParsedownCheckbox.php"]
|
"files": ["ParsedownCheckbox.php"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
42
composer.lock
generated
42
composer.lock
generated
@ -1,29 +1,32 @@
|
|||||||
{
|
{
|
||||||
"_readme": [
|
"_readme": [
|
||||||
"This file locks the dependencies of your project to a known state",
|
"This file locks the dependencies of your project to a known state",
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "9736195b93bfa2cec806d78b0c8661aa",
|
"content-hash": "945149d723dda7bfd03e649ff058f8b4",
|
||||||
"content-hash": "655332acfbe94cf5bf8be89a4df9b70e",
|
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "erusev/parsedown",
|
"name": "erusev/parsedown",
|
||||||
"version": "1.6.2",
|
"version": "1.8.0-beta-4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/erusev/parsedown.git",
|
"url": "https://github.com/erusev/parsedown.git",
|
||||||
"reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01"
|
"reference": "1f69f7e69797104e73fdceaae22a4b4e3978f0a4"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/1bf24f7334fe16c88bf9d467863309ceaf285b01",
|
"url": "https://api.github.com/repos/erusev/parsedown/zipball/1f69f7e69797104e73fdceaae22a4b4e3978f0a4",
|
||||||
"reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01",
|
"reference": "1f69f7e69797104e73fdceaae22a4b4e3978f0a4",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
"ext-mbstring": "*",
|
||||||
"php": ">=5.3.0"
|
"php": ">=5.3.0"
|
||||||
},
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.8.35"
|
||||||
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
@ -47,24 +50,30 @@
|
|||||||
"markdown",
|
"markdown",
|
||||||
"parser"
|
"parser"
|
||||||
],
|
],
|
||||||
"time": "2017-03-29 16:04:15"
|
"time": "2018-05-08T21:46:15+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "erusev/parsedown-extra",
|
"name": "erusev/parsedown-extra",
|
||||||
"version": "0.7.1",
|
"version": "0.8.0-beta-1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/erusev/parsedown-extra.git",
|
"url": "https://github.com/erusev/parsedown-extra.git",
|
||||||
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c"
|
"reference": "e756b1bf8642ab1091403e902b0503f1cec7527d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c",
|
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/e756b1bf8642ab1091403e902b0503f1cec7527d",
|
||||||
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c",
|
"reference": "e756b1bf8642ab1091403e902b0503f1cec7527d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"erusev/parsedown": "~1.4"
|
"erusev/parsedown": "^1.8.0|^1.8.0-beta-4",
|
||||||
|
"ext-dom": "*",
|
||||||
|
"ext-mbstring": "*",
|
||||||
|
"php": ">=5.3.6"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^4.8.35"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -91,13 +100,16 @@
|
|||||||
"parsedown",
|
"parsedown",
|
||||||
"parser"
|
"parser"
|
||||||
],
|
],
|
||||||
"time": "2015-11-01 10:19:22"
|
"time": "2018-05-08T21:54:32+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [],
|
"packages-dev": [],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"erusev/parsedown": 10,
|
||||||
|
"erusev/parsedown-extra": 10
|
||||||
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user