mirror of
https://github.com/typemill/typemill.git
synced 2025-10-16 07:06:07 +02:00
Version 1.2.15: Math refactored
This commit is contained in:
@@ -195,12 +195,12 @@ abstract class ContentController
|
||||
{
|
||||
$contentFolder = Folder::scanFolderFlat($this->settings['rootPath'] . $this->settings['contentFolder']);
|
||||
|
||||
if(array_search('index.md', $contentFolder))
|
||||
if(in_array('index.md', $contentFolder))
|
||||
{
|
||||
$md = true;
|
||||
$status = 'published';
|
||||
}
|
||||
if(array_search('index.txt', $contentFolder))
|
||||
if(in_array('index.txt', $contentFolder))
|
||||
{
|
||||
$txt = true;
|
||||
$status = 'unpublished';
|
||||
|
@@ -42,7 +42,7 @@ class PageController extends Controller
|
||||
{
|
||||
$structure = $this->getCachedStructure($cache);
|
||||
}
|
||||
else
|
||||
if(!isset($structure) OR !$structure)
|
||||
{
|
||||
/* if not, get a fresh structure of the content folder */
|
||||
$structure = $this->getFreshStructure($pathToContent, $cache, $uri);
|
||||
|
@@ -1,165 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Typemill\Extensions;
|
||||
|
||||
class ParsedownMath extends \ParsedownExtra
|
||||
{
|
||||
const VERSION = '1.0';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
if (version_compare(parent::version, '1.7.1') < 0) {
|
||||
# die('need version 1.7.1');
|
||||
# throw new Exception('ParsedownMath requires a later version of Parsedown');
|
||||
}
|
||||
|
||||
// Blocks
|
||||
$this->BlockTypes['\\'][] = 'Math';
|
||||
$this->BlockTypes['$'][] = 'Math';
|
||||
|
||||
// Inline
|
||||
$this->InlineTypes['\\'][] = 'Math';
|
||||
$this->inlineMarkerList .= '\\';
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
||||
protected $mathMode = true;
|
||||
|
||||
public function enableMath($input = true)
|
||||
{
|
||||
$this->mathMode = $input;
|
||||
|
||||
if ($input == false) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ----------------------- Inline --------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
//
|
||||
// Inline Math
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected function inlineMath($Excerpt)
|
||||
{
|
||||
if (!$this->mathMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (preg_match('/^(?<!\\\\)((?<!\\\\\()\\\\\((?!\\\\\())(.*?)(?<!\\\\)(?<!\\\\\()((?<!\\\\\))\\\\\)(?!\\\\\)))(?!\\\\\()/s', $Excerpt['text'], $matches)) {
|
||||
if (preg_match('/^(?<!\\\\)(?<!\\\\\()\\\\\((.*?)(?<!\\\\\()\\\\\)(?!\\\\\))/s', $Excerpt['text'], $matches)) {
|
||||
return array(
|
||||
'extent' => strlen($matches[0]),
|
||||
'element' => array(
|
||||
'text' => $matches[0]
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected $specialCharacters = array(
|
||||
'\\', '`', '*', '_', '{', '}', '[', ']', '(', ')', '<', '>', '#', '+', '-', '.', '!', '|', '~', '^', '='
|
||||
);
|
||||
|
||||
|
||||
//
|
||||
// Inline Escape
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
protected function inlineEscapeSequence($Excerpt)
|
||||
{
|
||||
$Element = array(
|
||||
'element' => array(
|
||||
'rawHtml' => $Excerpt['text'][1],
|
||||
),
|
||||
'extent' => 2,
|
||||
);
|
||||
|
||||
if ($this->mathMode) {
|
||||
if (isset($Excerpt['text'][1]) && in_array($Excerpt['text'][1], $this->specialCharacters) && !preg_match('/(?<!\\\\)((?<!\\\\\()\\\\\((?!\\\\\())(.*?)(?<!\\\\)(?<!\\\\\()((?<!\\\\\))\\\\\)(?!\\\\\)))(?!\\\\\()/s', $Excerpt['text'])) {
|
||||
return $Element;
|
||||
}
|
||||
} else {
|
||||
if (isset($Excerpt['text'][1]) && in_array($Excerpt['text'][1], $this->specialCharacters)) {
|
||||
return $Element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// ----------------------- Blocks --------------------------
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
||||
//
|
||||
// Block Math
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
protected function blockMath($Line)
|
||||
{
|
||||
$Block = array(
|
||||
'element' => array(
|
||||
'text' => '',
|
||||
),
|
||||
);
|
||||
|
||||
if (preg_match('/^(?<!\\\\)(\\\\\[)(?!.)$/', $Line['text'])) {
|
||||
$Block['end'] = '\]';
|
||||
return $Block;
|
||||
} elseif (preg_match('/^(?<!\\\\)(\$\$)(?!.)$/', $Line['text'])) {
|
||||
$Block['end'] = '$$';
|
||||
return $Block;
|
||||
}
|
||||
}
|
||||
|
||||
// ~
|
||||
|
||||
protected function blockMathContinue($Line, $Block)
|
||||
{
|
||||
if (isset($Block['complete'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($Block['interrupted'])) {
|
||||
$Block['element']['text'] .= str_repeat("\n", $Block['interrupted']);
|
||||
|
||||
unset($Block['interrupted']);
|
||||
}
|
||||
|
||||
if (preg_match('/^(?<!\\\\)(\\\\\])$/', $Line['text']) && $Block['end'] === '\]') {
|
||||
$Block['complete'] = true;
|
||||
$Block['latex'] = true;
|
||||
$Block['element']['text'] = "\\[".$Block['element']['text']."\\]";
|
||||
return $Block;
|
||||
} elseif (preg_match('/^(?<!\\\\)(\$\$)$/', $Line['text']) && $Block['end'] === '$$') {
|
||||
$Block['complete'] = true;
|
||||
$Block['latex'] = true;
|
||||
$Block['element']['text'] = "$$".$Block['element']['text']."$$";
|
||||
return $Block;
|
||||
}
|
||||
|
||||
|
||||
$Block['element']['text'] .= "\n" . $Line['body'];
|
||||
|
||||
// ~
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
// ~
|
||||
|
||||
protected function blockMathComplete($Block)
|
||||
{
|
||||
return $Block;
|
||||
}
|
||||
}
|
20
system/Extensions/license-parsedownattributes.md
Normal file
20
system/Extensions/license-parsedownattributes.md
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright <20> 2016 Taufik Nurrohman, latitudu.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the <20>Software<72>), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED <20>AS IS<49>, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
system/Extensions/license-parsedownmath.md
Normal file
21
system/Extensions/license-parsedownmath.md
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Benjamin H<>egh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@@ -43,7 +43,7 @@ class Settings
|
||||
'contentFolder' => 'content',
|
||||
'cache' => true,
|
||||
'cachePath' => $rootPath . 'cache',
|
||||
'version' => '1.2.14',
|
||||
'version' => '1.2.15',
|
||||
'setup' => true,
|
||||
'welcome' => true,
|
||||
'images' => ['live' => ['width' => 820], 'mlibrary' => ['width' => 50, 'height' => 50]],
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190604" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/color-picker.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -35,7 +35,7 @@
|
||||
</article>
|
||||
<footer></footer>
|
||||
</div>
|
||||
<script src="{{ base_url }}/system/author/js/color-picker.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/author.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/color-picker.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/author.js?20190604"></script>
|
||||
</body>
|
||||
</html>
|
@@ -19,7 +19,7 @@
|
||||
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190605" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/color-picker.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -29,6 +29,6 @@
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
</div>
|
||||
<script src="{{ base_url }}/system/author/js/auth.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/auth.js?20190604"></script>
|
||||
</body>
|
||||
</html>
|
@@ -16,9 +16,9 @@
|
||||
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{ base_url }}/system/author/img/apple-touch-icon-144x144.png" />
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ base_url }}/system/author/img/apple-touch-icon-152x152.png" />
|
||||
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190604" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190604" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="main-header">
|
||||
|
@@ -17,9 +17,9 @@
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ base_url }}/system/author/img/apple-touch-icon-152x152.png" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190604" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190604" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/color-picker.min.css" />
|
||||
|
||||
{{ assets.renderCSS() }}
|
||||
@@ -39,15 +39,15 @@
|
||||
</article>
|
||||
<footer></footer>
|
||||
</div>
|
||||
<script src="{{ base_url }}/system/author/js/vue.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/autosize.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/sortable.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/author.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-blox.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-navi.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/lazy-video.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/autosize.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/sortable.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/author.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-blox.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-navi.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/lazy-video.js?20190604"></script>
|
||||
|
||||
{{ assets.renderJS() }}
|
||||
|
||||
|
@@ -17,9 +17,9 @@
|
||||
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="{{ base_url }}/system/author/img/apple-touch-icon-152x152.png" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/fontello/css/fontello.css?20190604" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190517" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20190604" />
|
||||
<link rel="stylesheet" href="{{ base_url }}/system/author/css/color-picker.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
@@ -36,13 +36,13 @@
|
||||
</article>
|
||||
<footer></footer>
|
||||
</div>
|
||||
<script src="{{ base_url }}/system/author/js/vue.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/autosize.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/sortable.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/author.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-editor.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-navi.js?20190517"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/autosize.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/sortable.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/author.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-editor.js?20190604"></script>
|
||||
<script src="{{ base_url }}/system/author/js/vue-navi.js?20190604"></script>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user