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
|
||||
/vendor/
|
||||
|
||||
/.idea/
|
||||
|
@ -6,21 +6,51 @@
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* 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
|
||||
{
|
||||
const VERSION = '0.1.0';
|
||||
const VERSION = '0.1.1';
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(isset($block['element']) && ($block['element']['name'] === 'ul') && is_array($block['element']['elements']))
|
||||
) {
|
||||
return $block;
|
||||
}
|
||||
//echo '<pre>';var_dump($block);echo '</pre>';
|
||||
|
||||
foreach ($block['element']['elements'] as &$element) {
|
||||
if (!isset($element['handler']['argument'][0])) {
|
||||
@ -32,20 +62,19 @@ protected function blockListComplete(array $block)
|
||||
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] = '<input type="checkbox" disabled /> '. substr($element['handler']['argument'][0], 4);
|
||||
unset ($element['name']);
|
||||
unset ($block['element']['name']);
|
||||
$element['handler']['argument'][0] = '<input type="checkbox" class="task-list-item-checkbox" disabled /> ' . substr($element['handler']['argument'][0], 4);
|
||||
$element['attributes'] = array('class' => 'task-list-item');
|
||||
|
||||
} elseif ('[x] ' === $begin_line) {
|
||||
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] = '<input type="checkbox" checked disabled /> '. substr($element['handler']['argument'][0], 4);
|
||||
unset ($element['name']);
|
||||
unset ($block['element']['name']);
|
||||
$element['handler']['argument'][0] = '<input type="checkbox" class="task-list-item-checkbox" checked disabled /> ' . substr($element['handler']['argument'][0], 4);
|
||||
$element['attributes'] = array('class' => 'task-list-item');
|
||||
}
|
||||
}
|
||||
unset($element);
|
||||
$block['element']['attributes'] = array('class' => 'contains-task-list');
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
@ -10,13 +10,18 @@
|
||||
"name": "Simon Leblanc",
|
||||
"email": "contact@leblanc-simon.eu",
|
||||
"homepage": "https://www.leblanc-simon.fr"
|
||||
},
|
||||
{
|
||||
"name": "NEYOWO",
|
||||
"email": "mira@neyowo.com",
|
||||
"homepage": "https://neyowo.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"erusev/parsedown-extra": "^0.7.1"
|
||||
"erusev/parsedown": "1.8.0-beta-4",
|
||||
"erusev/parsedown-extra": "0.8.0-beta-1"
|
||||
},
|
||||
"autoload": {
|
||||
"files": ["ParsedownCheckbox.php"]
|
||||
}
|
||||
}
|
||||
|
||||
|
42
composer.lock
generated
42
composer.lock
generated
@ -1,29 +1,32 @@
|
||||
{
|
||||
"_readme": [
|
||||
"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"
|
||||
],
|
||||
"hash": "9736195b93bfa2cec806d78b0c8661aa",
|
||||
"content-hash": "655332acfbe94cf5bf8be89a4df9b70e",
|
||||
"content-hash": "945149d723dda7bfd03e649ff058f8b4",
|
||||
"packages": [
|
||||
{
|
||||
"name": "erusev/parsedown",
|
||||
"version": "1.6.2",
|
||||
"version": "1.8.0-beta-4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown.git",
|
||||
"reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01"
|
||||
"reference": "1f69f7e69797104e73fdceaae22a4b4e3978f0a4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/1bf24f7334fe16c88bf9d467863309ceaf285b01",
|
||||
"reference": "1bf24f7334fe16c88bf9d467863309ceaf285b01",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown/zipball/1f69f7e69797104e73fdceaae22a4b4e3978f0a4",
|
||||
"reference": "1f69f7e69797104e73fdceaae22a4b4e3978f0a4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8.35"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
@ -47,24 +50,30 @@
|
||||
"markdown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2017-03-29 16:04:15"
|
||||
"time": "2018-05-08T21:46:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "erusev/parsedown-extra",
|
||||
"version": "0.7.1",
|
||||
"version": "0.8.0-beta-1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/erusev/parsedown-extra.git",
|
||||
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c"
|
||||
"reference": "e756b1bf8642ab1091403e902b0503f1cec7527d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c",
|
||||
"reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c",
|
||||
"url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/e756b1bf8642ab1091403e902b0503f1cec7527d",
|
||||
"reference": "e756b1bf8642ab1091403e902b0503f1cec7527d",
|
||||
"shasum": ""
|
||||
},
|
||||
"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",
|
||||
"autoload": {
|
||||
@ -91,13 +100,16 @@
|
||||
"parsedown",
|
||||
"parser"
|
||||
],
|
||||
"time": "2015-11-01 10:19:22"
|
||||
"time": "2018-05-08T21:54:32+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"erusev/parsedown": 10,
|
||||
"erusev/parsedown-extra": 10
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
|
Loading…
x
Reference in New Issue
Block a user