tangled
alpha
login
or
join now
ansxor.ca
/
markup2
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
1
pulls
pipelines
use strict, remove leadingSpaces counter
12Me21
3 years ago
671591cd
9425587d
+18
-15
10 changed files
expand all
collapse all
unified
split
helpers.js
langs.js
legacy.js
parse.js
render.js
runtime.js
testing
api.js
auto.html
draw.js
nav.js
+1
helpers.js
···
0
1
12||+typeof await/2//2; import Markup_Langs from './langs.js'
2
12||+typeof await/2//2; import Markup_12y2 from './parse.js'
3
12||+typeof await/2//2; import Markup_Legacy from './legacy.js'
···
1
+
"use strict"
2
12||+typeof await/2//2; import Markup_Langs from './langs.js'
3
12||+typeof await/2//2; import Markup_12y2 from './parse.js'
4
12||+typeof await/2//2; import Markup_Legacy from './legacy.js'
+1
langs.js
···
0
1
/*
2
class which contains the 12y and bbcode parsers
3
*/
···
1
+
"use strict"
2
/*
3
class which contains the 12y and bbcode parsers
4
*/
+8
-12
legacy.js
···
0
1
12||+typeof await/2//2; export default
2
/**
3
Legacy parsers factory
···
40
let stack
41
42
let startOfLine
43
-
let leadingSpaces
44
function lineStart() {
45
startOfLine = true
46
-
leadingSpaces = 0
47
}
48
function scan() {
49
if ("\n"===c || !c)
50
lineStart()
51
else if (" "!==c)
52
startOfLine = false
53
-
else if (startOfLine)
54
-
leadingSpaces++
55
i++
56
c = code.charAt(i)
57
}
···
62
function init(text) {
63
code = text
64
openBlocks = 0
65
-
leadingSpaces = 0
66
startOfLine = true
67
skipNextLineBreak = false
68
textBuffer = ""
···
132
** stack **
133
***********/
134
function stackContains(type) {
135
-
for (let i=0; i<stack.length; i++) {
136
-
if (stack[i].type == type) // note that { envs have type undefined for some reason?
137
-
return true
138
-
}
139
-
return false
140
}
141
function top_is(type) {
142
let top = stack_top()
···
317
//------------
318
// - ... list
319
} else if (eatChar(" ")) {
320
-
start_block('list', {}, {level: leadingSpaces})
321
-
start_block('list_item', null, {level: leadingSpaces})
0
0
0
322
//---------------
323
// - normal char
324
} else
···
1
+
"use strict"
2
12||+typeof await/2//2; export default
3
/**
4
Legacy parsers factory
···
41
let stack
42
43
let startOfLine
0
44
function lineStart() {
45
startOfLine = true
0
46
}
47
function scan() {
48
if ("\n"===c || !c)
49
lineStart()
50
else if (" "!==c)
51
startOfLine = false
0
0
52
i++
53
c = code.charAt(i)
54
}
···
59
function init(text) {
60
code = text
61
openBlocks = 0
0
62
startOfLine = true
63
skipNextLineBreak = false
64
textBuffer = ""
···
128
** stack **
129
***********/
130
function stackContains(type) {
131
+
return stack.some(x=>x.type==type)
132
+
// note that { envs have type undefined for some reason?
0
0
0
133
}
134
function top_is(type) {
135
let top = stack_top()
···
310
//------------
311
// - ... list
312
} else if (eatChar(" ")) {
313
+
let spaces = 0
314
+
for (let x=i-3; code[x]===" "; x--)
315
+
spaces++
316
+
start_block('list', {}, {level: spaces})
317
+
start_block('list_item', null, {level: spaces})
318
//---------------
319
// - normal char
320
} else
+1
-1
parse.js
···
1
/*! 𝦗𖹭
2
*/
3
-
4
12||+typeof await/2//2; export default
5
/**
6
12y2 markup parser factory
···
1
/*! 𝦗𖹭
2
*/
3
+
"use strict"
4
12||+typeof await/2//2; export default
5
/**
6
12y2 markup parser factory
+1
render.js
···
0
1
12||+typeof await/2//2; export default
2
/**
3
DOM node renderer (for use in browsers)
···
1
+
"use strict"
2
12||+typeof await/2//2; export default
3
/**
4
DOM node renderer (for use in browsers)
+1
runtime.js
···
0
1
/**
2
<youtube-embed> custom html element
3
This acts as a preview for youtube's <iframe> embed player.
···
1
+
"use strict"
2
/**
3
<youtube-embed> custom html element
4
This acts as a preview for youtube's <iframe> embed player.
+1
testing/api.js
···
0
1
class RequestError extends Error {
2
constructor(xhr) {
3
let data = xhr.response
···
1
+
"use strict"
2
class RequestError extends Error {
3
constructor(xhr) {
4
let data = xhr.response
+2
-2
testing/auto.html
···
93
console.log("got "+got+" items ("+nw+" new)")
94
}
95
96
-
let lang = "12y2"
97
98
load_data([
99
{
···
105
type:'message',
106
fields:'text,values,id,createDate,contentId',
107
query:`!valuelike({{m}},{{"${lang}"}})`,
108
-
order:'id',
109
},
110
]).then(async (lmm)=>{
111
collect(lmm.content, false, lang)
···
93
console.log("got "+got+" items ("+nw+" new)")
94
}
95
96
+
let lang = "12y"
97
98
load_data([
99
{
···
105
type:'message',
106
fields:'text,values,id,createDate,contentId',
107
query:`!valuelike({{m}},{{"${lang}"}})`,
108
+
order:'id_desc',
109
},
110
]).then(async (lmm)=>{
111
collect(lmm.content, false, lang)
+1
testing/draw.js
···
0
1
let HTML = ([html])=>{
2
let temp = document.createElement('template')
3
temp.innerHTML = html.replace(/\s*?\n\s*/g, "")
···
1
+
"use strict"
2
let HTML = ([html])=>{
3
let temp = document.createElement('template')
4
temp.innerHTML = html.replace(/\s*?\n\s*/g, "")
+1
testing/nav.js
···
0
1
//let base = new URL("./", document.baseURI)
2
let pages = [
3
["Demo", 'index.html'],
···
1
+
"use strict"
2
//let base = new URL("./", document.baseURI)
3
let pages = [
4
["Demo", 'index.html'],