From d6774a94d223f0e87a9f0aab02f4de05deada86f Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Tue, 22 Sep 2020 22:18:33 +0200 Subject: Get php-markdown via composer --- .gitignore | 1 - INSTALL.md | 10 ++------ build.sh | 6 ----- composer.json | 3 ++- composer.lock | 51 ++++++++++++++++++++++++++++++++++++++- ratatoeskr/libs/INFO | 10 ++------ ratatoeskr/sys/textprocessors.php | 5 ++-- setup.php | 1 - 8 files changed, 59 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 383163b..c04d68f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ ratatoeskr/templates/src/plugintemplates/* ratatoeskr/templates/src/usertemplates/* ratatoeskr/templates/transc/* ratatoeskr/libs/ste -ratatoeskr/libs/markdown.php ratatoeskr/libs/kses.php ratatoeskr/libs/jquery.min.js ratatoeskr/config.php diff --git a/INSTALL.md b/INSTALL.md index ff57a80..e9be995 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -20,19 +20,13 @@ Step 2: Get additional libraries You need these libraries to run Ratatöskr (it is probably already bundled with these): -1. PHP Markdown - - Place "markdown.php" from the archive directly into this directory. - - PHP Markdown can be found here: - -2. kses +1. kses Place "kses.php" from the archive directly into this directory. kses can be found at -3. jQuery +2. jQuery Place jquery.min.js into this folder. diff --git a/build.sh b/build.sh index 8a6bbcd..7e3389d 100755 --- a/build.sh +++ b/build.sh @@ -18,12 +18,6 @@ install_dependencies() { cd ratatoeskr/libs - wget http://michelf.com/docs/projets/php-markdown-1.0.1o.zip - unzip php-markdown-*.zip - mv PHP\ Markdown\ */markdown.php . - rm -rf PHP\ Markdown\ * - rm php-markdown-*.zip - wget -O kses.zip http://sourceforge.net/projects/kses/files/kses/0.2.2/kses-0.2.2.zip/download?use_mirror=optimate unzip kses.zip mv kses-*/kses.php . diff --git a/composer.json b/composer.json index f2c4b37..fed18c1 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,8 @@ "type": "project", "require": { "php": ">=7.3", - "r7r/ste": "^2.0.1" + "r7r/ste": "^2.0.1", + "michelf/php-markdown": "^1.9" }, "config": { "vendor-dir": "ratatoeskr/vendor" diff --git a/composer.lock b/composer.lock index 7dda3d4..7e40506 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,57 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ae4ab914ba9041a5c34281d8b34f769d", + "content-hash": "b24fa722b1b134feabc31603beda3933", "packages": [ + { + "name": "michelf/php-markdown", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "c83178d49e372ca967d1a8c77ae4e051b3a3c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/c83178d49e372ca967d1a8c77ae4e051b3a3c75c", + "reference": "c83178d49e372ca967d1a8c77ae4e051b3a3c75c", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.3 <5.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Michelf\\": "Michelf/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "https://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ], + "time": "2019-12-02T02:32:27+00:00" + }, { "name": "r7r/ste", "version": "2.0.1", diff --git a/ratatoeskr/libs/INFO b/ratatoeskr/libs/INFO index 80a47e3..f1ef415 100644 --- a/ratatoeskr/libs/INFO +++ b/ratatoeskr/libs/INFO @@ -1,18 +1,12 @@ This directory will hold some libraries Ratatöskr needs. -1. PHP Markdown - - Place "markdown.php" from the archive directly into this directory. - - PHP Markdown can be found here: - -2. kses +1. kses Place "kses.php" from the archive directly into this directory. kses can be found at -3. jQuery +2. jQuery Place jquery.min.js into this folder. diff --git a/ratatoeskr/sys/textprocessors.php b/ratatoeskr/sys/textprocessors.php index 7ff3bbb..f195ef7 100644 --- a/ratatoeskr/sys/textprocessors.php +++ b/ratatoeskr/sys/textprocessors.php @@ -9,7 +9,8 @@ * See "ratatoeskr/licenses/ratatoeskr" for more information. */ -require_once(dirname(__FILE__) . "/../libs/markdown.php"); +use Michelf\Markdown; + require_once(dirname(__FILE__) . "/utils.php"); /* @@ -70,7 +71,7 @@ function textprocessor_apply_translation($translationobj) if (!isset($textprocessors)) { $textprocessors = [ - "Markdown" => ["Markdown", true], + "Markdown" => [Closure::fromCallable([Markdown::class, "defaultTransform"]), true], "Plain Text" => [function ($text) { return str_replace(["\r\n", "\n"], ["
", "
"], htmlesc($text)); }, true], diff --git a/setup.php b/setup.php index cbb58f4..2f57ce9 100644 --- a/setup.php +++ b/setup.php @@ -59,7 +59,6 @@ $files = [ "/ratatoeskr/translations/de.php", "/ratatoeskr/translations/en.php", "/ratatoeskr/backend.php", - "/ratatoeskr/libs/markdown.php", "/ratatoeskr/libs/kses.php", "/ratatoeskr/vendor/autoload.php", "/ratatoeskr/.htaccess", -- cgit v1.2.3-70-g09d2