From 6c8319355431d27e736b110bacd7c19a5ae2a718 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 3 Jul 2019 00:23:33 -0400 Subject: [PATCH] init --- .gitignore | 1 + Parser.php | 18 ++++ WikiParsedown.php | 33 ++++++ composer.json | 16 +++ composer.lock | 260 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 328 insertions(+) create mode 100644 .gitignore create mode 100644 Parser.php create mode 100644 WikiParsedown.php create mode 100644 composer.json create mode 100644 composer.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..48b8bf9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +vendor/ diff --git a/Parser.php b/Parser.php new file mode 100644 index 0000000..3cd0224 --- /dev/null +++ b/Parser.php @@ -0,0 +1,18 @@ +mdparser = new WikiParsedown(); + } + + public function parse($markdown) { + return $this->mdparser->text($markdown); + } + + public static function factory() { + return new FrontYAML\Parser(null, new MDParser()); + } +} diff --git a/WikiParsedown.php b/WikiParsedown.php new file mode 100644 index 0000000..3f0024c --- /dev/null +++ b/WikiParsedown.php @@ -0,0 +1,33 @@ + ' + . $header['element']['text']; + + return $header; + } + + protected function blockTable($line, array $block = null) { + $table = parent::blockTable($line, $block); + + if (!isset($table)) { + return null; + } + + $table['element']['attributes']['class'] = "table table-striped"; + + return $table; + } +} \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..94f0a6c --- /dev/null +++ b/composer.json @@ -0,0 +1,16 @@ +{ + "name": "tildeverse/wiki", + "description": "parsedown extensions for tilde wikis", + "type": "library", + "require": { + "erusev/parsedown-extra": "^0.7.1", + "mnapoli/front-yaml": "^1.6" + }, + "license": "GPLv3", + "authors": [ + { + "name": "Ben Harris", + "email": "ben@tilde.team" + } + ] +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..20128c3 --- /dev/null +++ b/composer.lock @@ -0,0 +1,260 @@ +{ + "_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#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "81370fc8c2bc5b8d445fa858d3ec9107", + "packages": [ + { + "name": "erusev/parsedown", + "version": "1.7.3", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/6d893938171a817f4e9bc9e86f2da1e370b7bcd7", + "reference": "6d893938171a817f4e9bc9e86f2da1e370b7bcd7", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2019-03-17T18:48:37+00:00" + }, + { + "name": "erusev/parsedown-extra", + "version": "0.7.1", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown-extra.git", + "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c", + "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c", + "shasum": "" + }, + "require": { + "erusev/parsedown": "~1.4" + }, + "type": "library", + "autoload": { + "psr-0": { + "ParsedownExtra": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "An extension of Parsedown that adds support for Markdown Extra.", + "homepage": "https://github.com/erusev/parsedown-extra", + "keywords": [ + "markdown", + "markdown extra", + "parsedown", + "parser" + ], + "time": "2015-11-01T10:19:22+00:00" + }, + { + "name": "mnapoli/front-yaml", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/mnapoli/FrontYAML.git", + "reference": "24070ace8b741247bb3161cbb38ecc541268b296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mnapoli/FrontYAML/zipball/24070ace8b741247bb3161cbb38ecc541268b296", + "reference": "24070ace8b741247bb3161cbb38ecc541268b296", + "shasum": "" + }, + "require": { + "erusev/parsedown": "~1.0", + "php": ">=5.4.0", + "symfony/yaml": "~2.1|^3.0|^4.0" + }, + "require-dev": { + "league/commonmark": "~0.7", + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Mni\\FrontYAML\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "time": "2017-10-29T19:29:55+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "82ebae02209c21113908c229e9883c419720738a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/yaml", + "version": "v4.3.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "c60ecf5ba842324433b46f58dc7afc4487dbab99" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c60ecf5ba842324433b46f58dc7afc4487dbab99", + "reference": "c60ecf5ba842324433b46f58dc7afc4487dbab99", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2019-04-06T14:04:46+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +}