mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-14 00:18:40 +00:00
Started bugfixing
There is a bug with the state. calling parse two times with a header causes different result on none header parsing.
This commit is contained in:
parent
0ddc559b0d
commit
c505dedb22
|
|
@ -1,6 +1,6 @@
|
||||||
|
// todo: strict type not possible because of octal escape, fix!
|
||||||
(function (jsOMS)
|
(function (jsOMS)
|
||||||
{
|
{
|
||||||
"use strict";
|
|
||||||
/** @namespace jsOMS.Views */
|
/** @namespace jsOMS.Views */
|
||||||
jsOMS.Autoloader.defineNamespace('jsOMS.Utils.Parser.Markdown');
|
jsOMS.Autoloader.defineNamespace('jsOMS.Utils.Parser.Markdown');
|
||||||
|
|
||||||
|
|
@ -20,7 +20,6 @@
|
||||||
'8': ['List'],
|
'8': ['List'],
|
||||||
'9': ['List'],
|
'9': ['List'],
|
||||||
':': ['Table'],
|
':': ['Table'],
|
||||||
'<': [],
|
|
||||||
'=': ['SetextHeader'],
|
'=': ['SetextHeader'],
|
||||||
'>': ['Quote'],
|
'>': ['Quote'],
|
||||||
'[': ['Reference'],
|
'[': ['Reference'],
|
||||||
|
|
@ -152,7 +151,7 @@
|
||||||
text = indent > 0 ? line.substr(indent) : line;
|
text = indent > 0 ? line.substr(indent) : line;
|
||||||
let lineArray = {body: line, indent: indent, text: text};
|
let lineArray = {body: line, indent: indent, text: text};
|
||||||
|
|
||||||
if (typeof currentBlock['continuable'] !== 'undefined') {
|
if (typeof currentblock !== 'undefined' && typeof currentBlock['continuable'] !== 'undefined') {
|
||||||
let block = jsOMS.Utils.Parser.Markdown['block' + currentBlock['type'] + 'Continue'](lineArray, currentBlock);
|
let block = jsOMS.Utils.Parser.Markdown['block' + currentBlock['type'] + 'Continue'](lineArray, currentBlock);
|
||||||
|
|
||||||
if (typeof block !== 'undefined') {
|
if (typeof block !== 'undefined') {
|
||||||
|
|
@ -174,10 +173,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let blockType in blockTypes) {
|
for (let blockType in blockTypes) {
|
||||||
|
blockType = blockTypes[blockType];
|
||||||
|
|
||||||
let block = jsOMS.Utils.Parser.Markdown['block' + blockType](lineArray, currentBlock);
|
let block = jsOMS.Utils.Parser.Markdown['block' + blockType](lineArray, currentBlock);
|
||||||
|
|
||||||
if (typeof block !== 'undefined') {
|
if (typeof block !== 'undefined') {
|
||||||
block['type'] = blocktype;
|
block['type'] = blockType;
|
||||||
|
|
||||||
if (typeof block['identified'] === 'undefined') {
|
if (typeof block['identified'] === 'undefined') {
|
||||||
blocks.push(currentBlock);
|
blocks.push(currentBlock);
|
||||||
|
|
@ -185,7 +186,7 @@
|
||||||
block['identified'] = true;
|
block['identified'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jsOMS.Utils.Parser.Markdown.continuable.indexof(blockType) !== -1) {
|
if (jsOMS.Utils.Parser.Markdown.continuable.indexOf(blockType) !== -1) {
|
||||||
block['continuable'] = true;
|
block['continuable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -195,7 +196,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof currentBlock !== 'undefined'
|
if (jsOMS.isset(currentBlock)
|
||||||
&& typeof currentBlock['type'] === 'undefined'
|
&& typeof currentBlock['type'] === 'undefined'
|
||||||
&& typeof currentBlock['interrupted'] === 'undefined'
|
&& typeof currentBlock['interrupted'] === 'undefined'
|
||||||
) {
|
) {
|
||||||
|
|
@ -207,7 +208,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof currentBlock['continuable'] !== 'undefined' && jsOMS.Utils.Parser.Markdown.completable.indexOf(currentBlock['type']) !== -1) {
|
if (currentBlock !== null && typeof currentBlock['continuable'] !== 'undefined' && jsOMS.Utils.Parser.Markdown.completable.indexOf(currentBlock['type']) !== -1) {
|
||||||
currentBlock = jsOMS.Utils.Parser.Markdown['block' + currentBlock['type'] + 'Complete'](currentBlock);
|
currentBlock = jsOMS.Utils.Parser.Markdown['block' + currentBlock['type'] + 'Complete'](currentBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -233,7 +234,7 @@
|
||||||
|
|
||||||
jsOMS.Utils.Parser.Markdown.blockCode = function(lineArray, block)
|
jsOMS.Utils.Parser.Markdown.blockCode = function(lineArray, block)
|
||||||
{
|
{
|
||||||
if (typeof block !== 'undefined' && typeof block['type'] === 'undefined' && typeof block['interrputed'] === 'undefined') {
|
if (jsOMS.isset(block) && typeof block['type'] === 'undefined' && typeof block['interrputed'] === 'undefined') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1100,7 +1101,7 @@
|
||||||
|
|
||||||
jsOMS.Utils.Parser.Markdown.escape = function (text, allowQuotes)
|
jsOMS.Utils.Parser.Markdown.escape = function (text, allowQuotes)
|
||||||
{
|
{
|
||||||
allowQuotes = typeof allowQuotes === 'undefined' ? false : true;
|
allowQuotes = typeof allowQuotes !== 'undefined';
|
||||||
|
|
||||||
return jsOMS.htmlspecialchars(text, allowQuotes);
|
return jsOMS.htmlspecialchars(text, allowQuotes);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user