转盘
This commit is contained in:
parent
2592f502b4
commit
cbdaf866a5
@ -76,18 +76,22 @@ router.get('/text', async (req, res, next) => {
|
||||
function parseText(text) {
|
||||
const result = []
|
||||
const textArr = text.split('\n')
|
||||
const textReg = /^(#+) (.*)(::)*(.*)$/
|
||||
const textReg = /^(#+) (.*)::(.*)$/
|
||||
let lastLevel = 0
|
||||
let lastIdx = 0
|
||||
const posArr = [result]
|
||||
|
||||
textArr.map(item => {
|
||||
if (item.indexOf('::') === -1) {
|
||||
item += '::'
|
||||
}
|
||||
|
||||
const execRes = textReg.exec(item)
|
||||
if (!execRes) return
|
||||
const curLevel = execRes[1].split('').length - 2
|
||||
if (curLevel < 0) return
|
||||
const text = execRes[2]
|
||||
const content = execRes[4]
|
||||
const content = execRes[3]
|
||||
if (curLevel === lastLevel) {
|
||||
const curPos = posArr[curLevel]
|
||||
curPos.push({
|
||||
|
Loading…
x
Reference in New Issue
Block a user