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