Browse Source

Merge pull request #4231 from MrPetovan/bug/3639-fix-diaspora-lf-in-code-blocks

Fix Diaspora LF in code blocks/Move php-markdown to composer
pull/4238/head
Michael Vogel 4 years ago
committed by GitHub
parent
commit
448ae08dd5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      composer.json
  2. 55
      composer.lock
  3. 18
      include/bb2diaspora.php
  4. 3
      include/html2bbcode.php
  5. 38
      library/markdown.php
  6. 12
      mod/admin.php
  7. 20
      mod/babel.php
  8. 7
      mod/help.php
  9. 39
      src/Content/Text/Markdown.php
  10. BIN
      util/composer.phar
  11. 4
      vendor/composer/ClassLoader.php
  12. 4
      vendor/composer/autoload_classmap.php
  13. 2
      vendor/composer/autoload_files.php
  14. 1
      vendor/composer/autoload_namespaces.php
  15. 2
      vendor/composer/autoload_real.php
  16. 13
      vendor/composer/autoload_static.php
  17. 6
      vendor/composer/include_paths.php
  18. 651
      vendor/composer/installed.json
  19. 0
      vendor/michelf/php-markdown/License.md
  20. 0
      vendor/michelf/php-markdown/Michelf/Markdown.inc.php
  21. 168
      vendor/michelf/php-markdown/Michelf/Markdown.php
  22. 0
      vendor/michelf/php-markdown/Michelf/MarkdownExtra.inc.php
  23. 2
      vendor/michelf/php-markdown/Michelf/MarkdownExtra.php
  24. 0
      vendor/michelf/php-markdown/Michelf/MarkdownInterface.inc.php
  25. 0
      vendor/michelf/php-markdown/Michelf/MarkdownInterface.php
  26. 2
      vendor/michelf/php-markdown/Readme.md
  27. 0
      vendor/michelf/php-markdown/Readme.php
  28. 5
      vendor/michelf/php-markdown/composer.json
  29. 6
      vendor/pear-pear.php.net/PEAR/bin/pear.bat
  30. 6
      vendor/pear-pear.php.net/PEAR/bin/peardev.bat
  31. 6
      vendor/pear-pear.php.net/PEAR/bin/pecl.bat
  32. 4
      vendor/pear-pear.php.net/PEAR/pearcmd.php
  33. 4
      vendor/pear-pear.php.net/PEAR/peclcmd.php
  34. 2
      vendor/pear-pear.php.net/Text_Highlighter/bin/generate.bat
  35. 16
      vendor/pear/text_languagedetect/phpcs.xml

3
composer.json

@ -20,7 +20,8 @@
"pear/Text_LanguageDetect": "1.*",
"pear-pear.php.net/Text_Highlighter": "*",
"paragonie/random_compat": "^2.0",
"smarty/smarty": "^3.1"
"smarty/smarty": "^3.1",
"michelf/php-markdown": "^1.7"
},
"repositories": [
{

55
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "40fc48f9b1e36f9f4960eb0ccf51a3c4",
"content-hash": "9eeabb43bd9f244c3e293ae6f4a33ffc",
"packages": [
{
"name": "defuse/php-encryption",
@ -159,6 +159,57 @@
],
"time": "2017-03-16T00:45:59+00:00"
},
{
"name": "michelf/php-markdown",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/michelf/php-markdown.git",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/1f51cc520948f66cd2af8cbc45a5ee175e774220",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-lib": "1.4.x-dev"
}
},
"autoload": {
"psr-0": {
"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": "2016-10-29T18:58:20+00:00"
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.30",
@ -315,7 +366,7 @@
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of \"getopt\" supporting both\nshort and long options."
"description": "This is a PHP implementation of "getopt" supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/PEAR",

18
include/bb2diaspora.php

@ -1,14 +1,12 @@
<?php
use Friendica\App;
use Friendica\Content\Text\Markdown;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use League\HTMLToMarkdown\HtmlConverter;
require_once 'include/event.php';
require_once 'library/markdown.php';
require_once 'include/html2bbcode.php';
require_once 'include/bbcode.php';
@ -58,7 +56,7 @@ function diaspora2bb($s) {
// Escaping the hash tags
$s = preg_replace('/\#([^\s\#])/', '&#35;$1', $s);
$s = Markdown($s);
$s = Markdown::convert($s);
$regexp = "/@\{(?:([^\}]+?); )?([^\} ]+)\}/";
$s = preg_replace_callback($regexp, 'diaspora_mention2bb', $s);
@ -146,12 +144,16 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
// Extracting multi-line code blocks before the whitespace processing/code highlighter in bbcode()
$codeblocks = [];
$Text = preg_replace_callback('#\[code(?:=([^\]]*))?\](?=\n)(.*?)\[\/code\]#is',
$Text = preg_replace_callback("#\[code(?:=([^\]]*))?\](.*?)\[\/code\]#is",
function ($matches) use (&$codeblocks) {
$return = '#codeblock-' . count($codeblocks) . '#';
$return = $matches[0];
if (strpos($matches[2], "\n") !== false) {
$return = '#codeblock-' . count($codeblocks) . '#';
$prefix = '````' . $matches[1] . PHP_EOL;
$codeblocks[] = $prefix . trim($matches[2]) . PHP_EOL . '````';
$prefix = '````' . $matches[1] . PHP_EOL;
$codeblocks[] = $prefix . trim($matches[2]) . PHP_EOL . '````';
}
return $return;
}
, $Text);

3
include/html2bbcode.php

@ -95,7 +95,7 @@ function html2bbcode($message, $basepath = '')
if ($matches[1] != '') {
$prefix = '[code=' . $matches[1] . ']';
}
$codeblocks[] = $prefix . $matches[2] . '[/code]';
$codeblocks[] = $prefix . trim($matches[2]) . '[/code]';
return $return;
},
$message
@ -247,6 +247,7 @@ function html2bbcode($message, $basepath = '')
node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), '[iframe]$1', '[/iframe]');
node2bbcode($doc, 'key', array(), '[code]', '[/code]');
node2bbcode($doc, 'code', array(), '[code]', '[/code]');
$message = $doc->saveHTML();

38
library/markdown.php

@ -1,38 +0,0 @@
<?php
/**
* @file library/markdown.php
*
* @brief Parser for Markdown files
*/
require_once "library/php-markdown/Michelf/MarkdownExtra.inc.php";
use \Michelf\MarkdownExtra;
/**
* @brief This function parses a text using php-markdown library to render Markdown syntax to HTML
*
* This function is using the php-markdown library by Michel Fortin to parse a
* string ($text).It returns the rendered HTML code from that text. The optional
* $hardwrap parameter is used to switch between inserting hard breaks after
* every linefeed, which is required for Diaspora compatibility, or not. The
* later is used for parsing documentation and README.md files.
*
* @param string $text
* @param boolean $hardwrap
* @return string
*/
function Markdown($text, $hardwrap = true) {
$a = get_app();
$stamp1 = microtime(true);
$MarkdownParser = new MarkdownExtra();
$MarkdownParser->hard_wrap = $hardwrap;
$html = $MarkdownParser->transform($text);
$a->save_timestamp($stamp1, "parser");
return $html;
}

12
mod/admin.php

@ -4,10 +4,12 @@
*
* @brief Friendica admin
*/
use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\System;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Database\DBStructure;
@ -1777,9 +1779,7 @@ function admin_page_plugins(App $a)
$readme = Null;
if (is_file("addon/$plugin/README.md")) {
require_once 'library/markdown.php';
$readme = file_get_contents("addon/$plugin/README.md");
$readme = Markdown($readme, false);
$readme = Markdown::convert(file_get_contents("addon/$plugin/README.md"), false);
} elseif (is_file("addon/$plugin/README")) {
$readme = "<pre>" . file_get_contents("addon/$plugin/README") . "</pre>";
}
@ -2028,9 +2028,7 @@ function admin_page_themes(App $a)
$readme = null;
if (is_file("view/theme/$theme/README.md")) {
require_once 'library/markdown.php';
$readme = file_get_contents("view/theme/$theme/README.md");
$readme = Markdown($readme, false);
$readme = Markdown::convert(file_get_contents("view/theme/$theme/README.md"), false);
} elseif (is_file("view/theme/$theme/README")) {
$readme = "<pre>" . file_get_contents("view/theme/$theme/README") . "</pre>";
}

20
mod/babel.php

@ -1,11 +1,11 @@
<?php
use Friendica\App;
use Friendica\Content\Text\Markdown;
require_once 'include/bbcode.php';
require_once 'library/markdown.php';
require_once 'include/bb2diaspora.php';
require_once 'include/html2bbcode.php';
require_once 'include/pgettext.php';
function visible_lf($s)
{
@ -36,31 +36,31 @@ function babel_content()
$o .= visible_lf($text) . EOL . EOL;
$html = bbcode($text);
$o .= '<h2>' . t('bb2html (raw HTML): ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode (raw HTML): ') . '</h2>' . EOL . EOL;
$o .= htmlspecialchars($html) . EOL . EOL;
//$html = bbcode($text);
$o .= '<h2>' . t('bb2html: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL;
$bbcode = html2bbcode($html);
$o .= '<h2>' . t('bb2html2bb: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
$diaspora = bb2diaspora($text);
$o .= '<h2>' . t('bb2md: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bb2diaspora: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($diaspora) . EOL . EOL;
$html = Markdown($diaspora);
$o .= '<h2>' . t('bb2md2html: ') . '</h2>' . EOL . EOL;
$html = Markdown::convert($diaspora);
$o .= '<h2>' . t('bb2diaspora => Markdown: ') . '</h2>' . EOL . EOL;
$o .= $html . EOL . EOL;
$bbcode = diaspora2bb($diaspora);
$o .= '<h2>' . t('bb2dia2bb: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bb2diaspora => diaspora2bb: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
$bbcode = html2bbcode($html);
$o .= '<h2>' . t('bb2md2html2bb: ') . '</h2>' . EOL . EOL;
$o .= '<h2>' . t('bbcode => html2bbcode: ') . '</h2>' . EOL . EOL;
$o .= visible_lf($bbcode) . EOL . EOL;
}

7
mod/help.php

@ -1,10 +1,9 @@
<?php
use Friendica\App;
use Friendica\Content\Text\Markdown;
use Friendica\Core\System;
require_once('library/markdown.php');
if (!function_exists('load_doc_file')) {
function load_doc_file($s) {
@ -50,7 +49,7 @@ function help_content(App $a) {
$filename = "Home";
$a->page['title'] = t('Help');
} else {
$a->page['aside'] = Markdown($home, false);
$a->page['aside'] = Markdown::convert($home, false);
}
if (!strlen($text)) {
@ -61,7 +60,7 @@ function help_content(App $a) {
));
}
$html = Markdown($text, false);
$html = Markdown::convert($text, false);
if ($filename !== "Home") {
// create TOC but not for home

39
src/Content/Text/Markdown.php

@ -0,0 +1,39 @@
<?php
/**
* @file src/Content/Text/Markdown.php
*/
namespace Friendica\Content\Text;
use Friendica\BaseObject;
use Michelf\MarkdownExtra;
/**
* Friendica-specific usage of Markdown
*
* @author Hypolite Petovan <mrpetovan@gmail.com>
*/
class Markdown extends BaseObject
{
/**
* Converts a Markdown string into HTML. The hardwrap parameter maximizes
* compatibility with Diaspora in spite of the Markdown standard.
*
* @brief Converts a Markdown string into HTML
* @param string $text
* @param bool $hardwrap
* @return string
*/
public static function convert($text, $hardwrap = true) {
$stamp1 = microtime(true);
$MarkdownParser = new MarkdownExtra();
$MarkdownParser->hard_wrap = $hardwrap;
$html = $MarkdownParser->transform($text);
self::getApp()->save_timestamp($stamp1, "parser");
return $html;
}
}

BIN
util/composer.phar

4
vendor/composer/ClassLoader.php

@ -379,9 +379,9 @@ class ClassLoader
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}

4
vendor/composer/autoload_classmap.php

@ -22,6 +22,7 @@ return array(
'Friendica\\Core\\NotificationsManager' => $baseDir . '/src/Core/NotificationsManager.php',
'Friendica\\Core\\PConfig' => $baseDir . '/src/Core/PConfig.php',
'Friendica\\Core\\System' => $baseDir . '/src/Core/System.php',
'Friendica\\Core\\UserImport' => $baseDir . '/src/Core/UserImport.php',
'Friendica\\Core\\Worker' => $baseDir . '/src/Core/Worker.php',
'Friendica\\Database\\DBM' => $baseDir . '/src/Database/DBM.php',
'Friendica\\Database\\DBStructure' => $baseDir . '/src/Database/DBStructure.php',
@ -354,6 +355,9 @@ return array(
'League\\HTMLToMarkdown\\ElementInterface' => $vendorDir . '/league/html-to-markdown/src/ElementInterface.php',
'League\\HTMLToMarkdown\\Environment' => $vendorDir . '/league/html-to-markdown/src/Environment.php',
'League\\HTMLToMarkdown\\HtmlConverter' => $vendorDir . '/league/html-to-markdown/src/HtmlConverter.php',
'Michelf\\Markdown' => $vendorDir . '/michelf/php-markdown/Michelf/Markdown.php',
'Michelf\\MarkdownExtra' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownExtra.php',
'Michelf\\MarkdownInterface' => $vendorDir . '/michelf/php-markdown/Michelf/MarkdownInterface.php',
'Mobile_Detect' => $vendorDir . '/mobiledetect/mobiledetectlib/Mobile_Detect.php',
'OS_Guess' => $vendorDir . '/pear-pear.php.net/PEAR/OS/Guess.php',
'PEAR' => $vendorDir . '/pear-pear.php.net/PEAR/PEAR.php',

2
vendor/composer/autoload_files.php

@ -6,8 +6,8 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'8170285c807a9f24f165f37b15bc9a36' => $vendorDir . '/defuse/php-encryption/Crypto.php',
'2cffec82183ee1cea088009cef9a6fc3' => $vendorDir . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
'f084d01b0a599f67676cffef638aa95b' => $vendorDir . '/smarty/smarty/libs/bootstrap.php',
);

1
vendor/composer/autoload_namespaces.php

@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir);
return array(
'Text' => array($vendorDir . '/pear/text_languagedetect'),
'Michelf' => array($vendorDir . '/michelf/php-markdown'),
'HTMLPurifier' => array($vendorDir . '/ezyang/htmlpurifier/library'),
'Detection' => array($vendorDir . '/mobiledetect/mobiledetectlib/namespaced'),
);

2
vendor/composer/autoload_real.php

@ -24,7 +24,7 @@ class ComposerAutoloaderInitFriendica
spl_autoload_unregister(array('ComposerAutoloaderInitFriendica', 'loadClassLoader'));
$includePaths = require __DIR__ . '/include_paths.php';
array_push($includePaths, get_include_path());
$includePaths[] = get_include_path();
set_include_path(implode(PATH_SEPARATOR, $includePaths));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());

13
vendor/composer/autoload_static.php

@ -7,8 +7,8 @@ namespace Composer\Autoload;
class ComposerStaticInitFriendica
{
public static $files = array (
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'8170285c807a9f24f165f37b15bc9a36' => __DIR__ . '/..' . '/defuse/php-encryption/Crypto.php',
'2cffec82183ee1cea088009cef9a6fc3' => __DIR__ . '/..' . '/ezyang/htmlpurifier/library/HTMLPurifier.composer.php',
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
'f084d01b0a599f67676cffef638aa95b' => __DIR__ . '/..' . '/smarty/smarty/libs/bootstrap.php',
);
@ -43,6 +43,13 @@ class ComposerStaticInitFriendica
0 => __DIR__ . '/..' . '/pear/text_languagedetect',
),
),
'M' =>
array (
'Michelf' =>
array (
0 => __DIR__ . '/..' . '/michelf/php-markdown',
),
),
'H' =>
array (
'HTMLPurifier' =>
@ -76,6 +83,7 @@ class ComposerStaticInitFriendica
'Friendica\\Core\\NotificationsManager' => __DIR__ . '/../..' . '/src/Core/NotificationsManager.php',
'Friendica\\Core\\PConfig' => __DIR__ . '/../..' . '/src/Core/PConfig.php',
'Friendica\\Core\\System' => __DIR__ . '/../..' . '/src/Core/System.php',
'Friendica\\Core\\UserImport' => __DIR__ . '/../..' . '/src/Core/UserImport.php',
'Friendica\\Core\\Worker' => __DIR__ . '/../..' . '/src/Core/Worker.php',
'Friendica\\Database\\DBM' => __DIR__ . '/../..' . '/src/Database/DBM.php',
'Friendica\\Database\\DBStructure' => __DIR__ . '/../..' . '/src/Database/DBStructure.php',
@ -408,6 +416,9 @@ class ComposerStaticInitFriendica
'League\\HTMLToMarkdown\\ElementInterface' => __DIR__ . '/..' . '/league/html-to-markdown/src/ElementInterface.php',
'League\\HTMLToMarkdown\\Environment' => __DIR__ . '/..' . '/league/html-to-markdown/src/Environment.php',
'League\\HTMLToMarkdown\\HtmlConverter' => __DIR__ . '/..' . '/league/html-to-markdown/src/HtmlConverter.php',
'Michelf\\Markdown' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/Markdown.php',
'Michelf\\MarkdownExtra' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/MarkdownExtra.php',
'Michelf\\MarkdownInterface' => __DIR__ . '/..' . '/michelf/php-markdown/Michelf/MarkdownInterface.php',
'Mobile_Detect' => __DIR__ . '/..' . '/mobiledetect/mobiledetectlib/Mobile_Detect.php',
'OS_Guess' => __DIR__ . '/..' . '/pear-pear.php.net/PEAR/OS/Guess.php',
'PEAR' => __DIR__ . '/..' . '/pear-pear.php.net/PEAR/PEAR.php',

6
vendor/composer/include_paths.php

@ -6,12 +6,12 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
$vendorDir . '/pear-pear.php.net/Archive_Tar',
$vendorDir . '/pear-pear.php.net/Console_Getopt',
$vendorDir . '/pear-pear.php.net/PEAR',
$vendorDir . '/pear-pear.php.net/Structures_Graph',
$vendorDir . '/pear-pear.php.net/XML_Parser',
$vendorDir . '/pear-pear.php.net/Text_Highlighter',
$vendorDir . '/pear-pear.php.net/XML_Parser',
$vendorDir . '/pear-pear.php.net/XML_Util',
$vendorDir . '/pear-pear.php.net/Archive_Tar',
$vendorDir . '/pear-pear.php.net/PEAR',
$vendorDir . '/pear/text_languagedetect',
);

651
vendor/composer/installed.json

@ -1,4 +1,51 @@
[
{
"name": "defuse/php-encryption",
"version": "v1.2.1",
"version_normalized": "1.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/defuse/php-encryption.git",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/b87737b2eec06b13f025cabea847338fa203d1b4",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4",
"shasum": ""
},
"require": {
"ext-mcrypt": "*",
"ext-openssl": "*",
"php": ">=5.4.0"
},
"time": "2015-03-14T20:27:45+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"Crypto.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Hornby",
"email": "havoc@defuse.ca"
}
],
"description": "Secure PHP Encryption Library",
"keywords": [
"aes",
"cipher",
"encryption",
"mcrypt",
"security"
]
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.7.0",
@ -45,134 +92,6 @@
"html"
]
},
{
"name": "pear-pear.php.net/Console_Getopt",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Console_Getopt-1.4.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/console_getopt": "== 1.4.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of \"getopt\" supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/Structures_Graph",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Structures_Graph-1.1.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.3.0.0"
},
"replace": {
"pear-pear/structures_graph": "== 1.1.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"LGPL-3.0+"
],
"description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology."
},
{
"name": "pear-pear.php.net/XML_Parser",
"version": "1.3.7",
"version_normalized": "1.3.7.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Parser-1.3.7.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/pear": "*",
"php": ">=4.2.0.0"
},
"replace": {
"pear-pear/xml_parser": "== 1.3.7.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD License"
],
"description": "This is an XML parser based on PHPs built-in xml extension.\nIt supports two basic modes of operation: \"func\" and \"event\". In \"func\" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in \"event\" mode it uses a set of generic callbacks.\n\nSince version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements.\nFurthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it."
},
{
"name": "pear-pear.php.net/Text_Highlighter",
"version": "0.8.0",
"version_normalized": "0.8.0.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Text_Highlighter-0.8.0.tgz",
"reference": null,
"shasum": null
},
"require": {
"pear-pear.php.net/console_getopt": ">=1.4.1.0",
"pear-pear.php.net/pear": ">=1.10.3.0",
"pear-pear.php.net/xml_parser": ">=1.3.7.0",
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/text_highlighter": "== 0.8.0.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"PHP License"
],
"description": "Text_Highlighter is a package for syntax highlighting.\n\nIt provides a base class provining all the functionality,\nand a descendent classes geneator class.\n\nThe main idea is to simplify creation of subclasses\nimplementing syntax highlighting for particular language.\nSubclasses do not implement any new functioanality,\nthey just provide syntax highlighting rules.\nThe rules sources are in XML format.\n\nTo create a highlighter for a language, there is no need\nto code a new class manually. Simply describe the rules\nin XML file and use Text_Highlighter_Generator to create\na new class."
},
{
"name": "league/html-to-markdown",
"version": "4.4.1",
@ -240,68 +159,224 @@
]
},
{
"name": "pear-pear.php.net/XML_Util",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"name": "michelf/php-markdown",
"version": "1.7.0",
"version_normalized": "1.7.0.0",
"source": {
"type": "git",
"url": "https://github.com/michelf/php-markdown.git",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220"
},
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Util-1.4.3.tgz",
"reference": null,
"shasum": null
"type": "zip",
"url": "https://api.github.com/repos/michelf/php-markdown/zipball/1f51cc520948f66cd2af8cbc45a5ee175e774220",
"reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"php": ">=5.4.0.0"
"php": ">=5.3.0"
},
"replace": {
"pear-pear/xml_util": "== 1.4.3.0"
"time": "2016-10-29T18:58:20+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-lib": "1.4.x-dev"
}
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
"psr-0": {
"Michelf": ""
}
},
"include-path": [
"/"
],
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD License"
"BSD-3-Clause"
],
"description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more."
"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"
]
},
{
"name": "pear-pear.php.net/Archive_Tar",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.30",
"version_normalized": "2.8.30.0",
"source": {
"type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git",
"reference": "5500bbbf312fe77ef0c7223858dad84fe49ee0c3"
},
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Archive_Tar-1.4.3.tgz",
"reference": null,
"shasum": null
"type": "zip",
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/5500bbbf312fe77ef0c7223858dad84fe49ee0c3",
"reference": "5500bbbf312fe77ef0c7223858dad84fe49ee0c3",
"shasum": ""
},
"require": {
"php": ">=5.2.0.0"
"php": ">=5.0.0"
},
"replace": {
"pear-pear/archive_tar": "== 1.4.3.0"
"require-dev": {
"phpunit/phpunit": "~4.8.35||~5.7"
},
"type": "pear-library",
"time": "2017-12-18T10:38:51+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
"Mobile_Detect.php"
],
"psr-0": {
"Detection": "namespaced/"
}
},
"include-path": [
"/"
],
"notification-url": "https://packagist.org/downloads/",
"license": [
"New BSD License"
"MIT"
],
"authors": [
{
"name": "Serban Ghita",
"email": "serbanghita@gmail.com",
"homepage": "http://mobiledetect.net",
"role": "Developer"
}
],
"description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
"homepage": "https://github.com/serbanghita/Mobile-Detect",
"keywords": [
"detect mobile devices",
"mobile",
"mobile detect",
"mobile detector",
"php mobile detect"
]
},
{
"name": "paragonie/random_compat",
"version": "v2.0.11",
"version_normalized": "2.0.11.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
"shasum": ""
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
},
"time": "2017-09-27T21:40:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/random.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
]
},
{
"name": "pear-pear.php.net/Archive_Tar",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Archive_Tar-1.4.3.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.2.0.0"
},
"replace": {
"pear-pear/archive_tar": "== 1.4.3.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"New BSD License"
],
"description": "This class provides handling of tar files in PHP.\nIt supports creating, listing, extracting and adding to tar files.\nGzip support is available if PHP has the zlib extension built-in or\nloaded. Bz2 compression is also supported with the bz2 extension loaded."
},
{
"name": "pear-pear.php.net/Console_Getopt",
"version": "1.4.1",
"version_normalized": "1.4.1.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/Console_Getopt-1.4.1.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/console_getopt": "== 1.4.1.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"license": [
"BSD-2-Clause"
],
"description": "This is a PHP implementation of &quot;getopt&quot; supporting both\nshort and long options."
},
{
"name": "pear-pear.php.net/PEAR",
"version": "1.10.5",
@ -344,201 +419,179 @@
"description": "The PEAR package contains:\n * the PEAR installer, for creating, distributing\n and installing packages\n * the PEAR_Exception PHP5 error handling mechanism\n * the PEAR_ErrorStack advanced error handling mechanism\n * the PEAR_Error error handling mechanism\n * the OS_Guess class for retrieving info about the OS\n where PHP is running on\n * the System class for quick handling of common operations\n with files and directories\n * the PEAR base class\n Features in a nutshell:\n * full support for channels\n * pre-download dependency validation\n * new package.xml 2.0 format allows tremendous flexibility while maintaining BC\n * support for optional dependency groups and limited support for sub-packaging\n * robust dependency support\n * full dependency validation on uninstall\n * remote install for hosts with only ftp access - no more problems with\n restricted host installation\n * full support for mirroring\n * support for bundling several packages into a single tarball\n * support for static dependencies on a url-based package\n * support for custom file roles and installation tasks"
},
{
"name": "pear/text_languagedetect",
"version": "v1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/pear/Text_LanguageDetect.git",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6"
},
"name": "pear-pear.php.net/Structures_Graph",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pear/Text_LanguageDetect/zipball/bb9ff6f4970f686fac59081e916b456021fe7ba6",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6",
"shasum": ""
"type": "file",
"url": "https://pear.php.net/get/Structures_Graph-1.1.1.tgz",
"reference": null,
"shasum": null
},
"require-dev": {
"phpunit/phpunit": "*"
"require": {
"php": ">=5.3.0.0"
},
"suggest": {
"ext-mbstring": "May require the mbstring PHP extension"
"replace": {
"pear-pear/structures_graph": "== 1.1.1.0"
},
"time": "2017-03-02T16:14:08+00:00",
"type": "library",
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"psr-0": {
"Text": "./"
}
"classmap": [
""
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"./"
"/"
],
"license": [
"BSD-2-Clause"
],
"authors": [
{
"name": "Nicholas Pisarro",
"email": "taak@php.net",
"role": "Lead"
}
"LGPL-3.0+"
],
"description": "Identify human languages from text samples",
"homepage": "http://pear.php.net/package/Text_LanguageDetect"
"description": "Structures_Graph is a package for creating and manipulating graph datastructures. It allows building of directed\nand undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing\nas well as for characteristic extraction from the graph topology."
},
{
"name": "defuse/php-encryption",
"version": "v1.2.1",
"version_normalized": "1.2.1.0",
"source": {
"type": "git",
"url": "https://github.com/defuse/php-encryption.git",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4"
},
"name": "pear-pear.php.net/Text_Highlighter",
"version": "0.8.0",
"version_normalized": "0.8.0.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/defuse/php-encryption/zipball/b87737b2eec06b13f025cabea847338fa203d1b4",
"reference": "b87737b2eec06b13f025cabea847338fa203d1b4",
"shasum": ""
"type": "file",
"url": "https://pear.php.net/get/Text_Highlighter-0.8.0.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-mcrypt": "*",
"ext-openssl": "*",
"php": ">=5.4.0"
"pear-pear.php.net/console_getopt": ">=1.4.1.0",
"pear-pear.php.net/pear": ">=1.10.3.0",
"pear-pear.php.net/xml_parser": ">=1.3.7.0",
"php": ">=5.4.0.0"
},
"time": "2015-03-14T20:27:45+00:00",
"type": "library",
"replace": {
"pear-pear/text_highlighter": "== 0.8.0.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"files": [
"Crypto.php"
"classmap": [
""
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
"include-path": [
"/"
],
"authors": [
{
"name": "Taylor Hornby",
"email": "havoc@defuse.ca"
}
"license": [
"PHP License"
],
"description": "Secure PHP Encryption Library",
"keywords": [
"aes",
"cipher",
"encryption",
"mcrypt",
"security"
]
"description": "Text_Highlighter is a package for syntax highlighting.\n\nIt provides a base class provining all the functionality,\nand a descendent classes geneator class.\n\nThe main idea is to simplify creation of subclasses\nimplementing syntax highlighting for particular language.\nSubclasses do not implement any new functioanality,\nthey just provide syntax highlighting rules.\nThe rules sources are in XML format.\n\nTo create a highlighter for a language, there is no need\nto code a new class manually. Simply describe the rules\nin XML file and use Text_Highlighter_Generator to create\na new class."
},
{
"name": "paragonie/random_compat",
"version": "v2.0.11",
"version_normalized": "2.0.11.0",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
},
"name": "pear-pear.php.net/XML_Parser",
"version": "1.3.7",
"version_normalized": "1.3.7.0",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
"reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
"shasum": ""
"type": "file",
"url": "https://pear.php.net/get/XML_Parser-1.3.7.tgz",
"reference": null,
"shasum": null
},
"require": {
"php": ">=5.2.0"
},
"require-dev": {
"phpunit/phpunit": "4.*|5.*"
"pear-pear.php.net/pear": "*",
"php": ">=4.2.0.0"
},
"suggest": {
"ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
"replace": {
"pear-pear/xml_parser": "== 1.3.7.0"
},
"time": "2017-09-27T21:40:39+00:00",
"type": "library",
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/random.php"
"classmap": [
""
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"/"
],
"license": [
"MIT"
"BSD License"
],
"authors": [
{
"name": "Paragon Initiative Enterprises",
"email": "security@paragonie.com",
"homepage": "https://paragonie.com"
}
"description": "This is an XML parser based on PHPs built-in xml extension.\nIt supports two basic modes of operation: \"func\" and \"event\". In \"func\" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in \"event\" mode it uses a set of generic callbacks.\n\nSince version 1.2.0 there's a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements.\nFurthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it."
},
{
"name": "pear-pear.php.net/XML_Util",
"version": "1.4.3",
"version_normalized": "1.4.3.0",
"dist": {
"type": "file",
"url": "https://pear.php.net/get/XML_Util-1.4.3.tgz",
"reference": null,
"shasum": null
},
"require": {
"ext-pcre": "*",
"php": ">=5.4.0.0"
},
"replace": {
"pear-pear/xml_util": "== 1.4.3.0"
},
"type": "pear-library",
"installation-source": "dist",
"autoload": {
"classmap": [
""
]
},
"include-path": [
"/"
],
"description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
"keywords": [
"csprng",
"pseudorandom",
"random"
]
"license": [
"BSD License"
],
"description": "Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more."
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.30",
"version_normalized": "2.8.30.0",
"name": "pear/text_languagedetect",
"version": "v1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/serbanghita/Mobile-Detect.git",
"reference": "5500bbbf312fe77ef0c7223858dad84fe49ee0c3"
"url": "https://github.com/pear/Text_LanguageDetect.git",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/5500bbbf312fe77ef0c7223858dad84fe49ee0c3",
"reference": "5500bbbf312fe77ef0c7223858dad84fe49ee0c3",
"url": "https://api.github.com/repos/pear/Text_LanguageDetect/zipball/bb9ff6f4970f686fac59081e916b456021fe7ba6",
"reference": "bb9ff6f4970f686fac59081e916b456021fe7ba6",
"shasum": ""
},
"require": {
"php": ">=5.0.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8.35||~5.7"
"phpunit/phpunit": "*"
},
"time": "2017-12-18T10:38:51+00:00",
"suggest": {
"ext-mbstring": "May require the mbstring PHP extension"
},
"time": "2017-03-02T16:14:08+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"Mobile_Detect.php"
],
"psr-0": {
"Detection": "namespaced/"
"Text": "./"
}
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
"./"
],
"license": [
"MIT"
"BSD-2-Clause"
],
"authors": [
{
"name": "Serban Ghita",
"email": "serbanghita@gmail.com",
"homepage": "http://mobiledetect.net",
"role": "Developer"
"name": "Nicholas Pisarro",
"email": "taak@php.net",
"role": "Lead"
}
],
"description": "Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.",
"homepage": "https://github.com/serbanghita/Mobile-Detect",
"keywords": [
"detect mobile devices",
"mobile",
"mobile detect",
"mobile detector",
"php mobile detect"
]
"description": "Identify human languages from text samples",
"homepage": "http://pear.php.net/package/Text_LanguageDetect"
},
{
"name": "smarty/smarty",

0
library/php-markdown/License.md → vendor/michelf/php-markdown/License.md

0
library/php-markdown/Michelf/Markdown.inc.php → vendor/michelf/php-markdown/Michelf/Markdown.inc.php

168
library/php-markdown/Michelf/Markdown.php → vendor/michelf/php-markdown/Michelf/Markdown.php

@ -61,14 +61,14 @@ class Markdown implements MarkdownInterface {
* @var int
*/
public $tab_width = 4;
/**
* Change to `true` to disallow markup or entities.
* @var boolean
*/
public $no_markup = false;
public $no_entities = false;
/**
* Change to `true` to enable line breaks on \n without two trailling spaces
@ -94,7 +94,7 @@ class Markdown implements MarkdownInterface {
* @var callable
*/
public $header_id_func = null;
/**
* Optional function for converting code block content to HTML
* @var callable
@ -111,7 +111,7 @@ class Markdown implements MarkdownInterface {
* Class attribute to toggle "enhanced ordered list" behaviour
* setting this to true will allow ordered lists to start from the index
* number that is defined first.
*
*
* For example:
* 2. List item two
* 3. List item three
@ -155,17 +155,17 @@ class Markdown implements MarkdownInterface {
public function __construct() {
$this->_initDetab();
$this->prepareItalicsAndBold();
$this->nested_brackets_re =
$this->nested_brackets_re =
str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
str_repeat('\])*', $this->nested_brackets_depth);
$this->nested_url_parenthesis_re =
$this->nested_url_parenthesis_re =
str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
$this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
// Sort document, block, and span gamut in ascendent priority order.
asort($this->document_gamut);
asort($this->block_gamut);
@ -180,13 +180,13 @@ class Markdown implements MarkdownInterface {
protected $urls = array();
protected $titles = array();
protected $html_hashes = array();
/**
* Status flag to avoid invalid nesting.
* @var boolean
*/
protected $in_anchor = false;
/**
* Called before the transformation process starts to setup parser states.
* @return void
@ -198,7 +198,7 @@ class Markdown implements MarkdownInterface {
$this->html_hashes = array();
$this->in_anchor = false;
}
/**
* Called after the transformation process to clear any variable which may
* be taking up memory unnecessarly.
@ -221,7 +221,7 @@ class Markdown implements MarkdownInterface {
*/
public function transform($text) {
$this->setup();
# Remove UTF-8 BOM and marker character in input, if present.
$text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
@ -248,7 +248,7 @@ class Markdown implements MarkdownInterface {
foreach ($this->document_gamut as $method => $priority) {
$text = $this->$method($text);
}
$this->teardown();
return $text . "\n";
@ -271,7 +271,7 @@ class Markdown implements MarkdownInterface {
* @return string
*/
protected function stripLinkDefinitions($text) {
$less_than_tab = $this->tab_width - 1;
// Link defs are in the form: ^[id]: url "optional title"
@ -338,8 +338,8 @@ class Markdown implements MarkdownInterface {
* for is hard-coded:
*
* * List "a" is made of tags which can be both inline or block-level.
* These will be treated block-level when the start tag is alone on
* its line, otherwise they're not matched here and will be taken as
* These will be treated block-level when the start tag is alone on
* its line, otherwise they're not matched here and will be taken as
* inline later.
* * List "b" is made of tags which are always block-level;
*/
@ -363,7 +363,7 @@ class Markdown implements MarkdownInterface {
|
\'[^\']*\' # text inside single quotes (tolerate ">")
)*
)?
)?
';
$content =
str_repeat('
@ -380,7 +380,7 @@ class Markdown implements MarkdownInterface {
str_repeat('
</\2\s*> # closing nested tag
)
|
|
<(?!/\2\s*> # other tags with a different name
)
)*',
@ -409,9 +409,9 @@ class Markdown implements MarkdownInterface {
)
( # save in $1
# Match from `\n<tag>` to `</tag>\n`, handling nested tags
# Match from `\n<tag>` to `</tag>\n`, handling nested tags
# in between.
[ ]{0,'.$less_than_tab.'}
<('.$block_tags_b_re.')# start tag = $2
'.$attr.'> # attributes followed by > and \n
@ -429,28 +429,28 @@ class Markdown implements MarkdownInterface {
</\3> # the matching end tag
[ ]* # trailing spaces/tabs
(?=\n+|\Z) # followed by a newline or end of document
| # Special case just for <hr />. It was easier to make a special
| # Special case just for <hr />. It was easier to make a special
# case than to make the other regex more complicated.
[ ]{0,'.$less_than_tab.'}
<(hr) # start tag = $2
'.$attr.' # attributes
/?> # the matching end tag
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
| # Special case for standalone HTML comments:
[ ]{0,'.$less_than_tab.'}
(?s:
<!-- .*? -->
)
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
| # PHP and ASP-style processor instructions (<? and <%)
[ ]{0,'.$less_than_tab.'}
(?s:
<([?%]) # $2
@ -459,7 +459,7 @@ class Markdown implements MarkdownInterface {
)
[ ]*
(?=\n{2,}|\Z) # followed by a blank line or end of document
)
)}Sxmi',
array($this, '_hashHTMLBlocks_callback'),
@ -479,9 +479,9 @@ class Markdown implements MarkdownInterface {
$key = $this->hashBlock($text);
return "\n\n$key\n\n";
}
/**
* Called whenever a tag must be hashed when a function insert an atomic
* Called whenever a tag must be hashed when a function insert an atomic
* element in the text stream. Passing $text to through this function gives
* a unique text-token which will be reverted back when calling unhash.
*
@ -498,7 +498,7 @@ class Markdown implements MarkdownInterface {
// Swap back any tag hash found in $text so we do not have to `unhash`
// multiple times at the end.
$text = $this->unhash($text);
// Then hash the block.
static $i = 0;
$key = "$boundary\x1A" . ++