This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修正todo语法

old
宇天 2020-02-11 00:15:13 +08:00
parent 36a7f0fbe9
commit d412c011b6
4 changed files with 26 additions and 23 deletions

View File

@ -71,10 +71,12 @@ const compileJs = (entry, output) => {
// 编译样式
function compileScss(code = '') {
try {
return scss.renderSync({
return (
scss.renderSync({
data: BASE_SCSS + code,
outputStyle: 'compressed'
}).css
}).css + ''
).trim()
} catch (err) {
log(err)
}

View File

@ -1,5 +1,5 @@
<template>
<div class="markd-box"><slot /></div>
<div><slot /></div>
</template>
<style lang="scss">
@ -9,9 +9,7 @@
color: nth($cd, 1);
font-size: 14px;
}
.markd-box {
padding: 10px;
}
a {
text-decoration: underline;
color: nth($ct, 2);
@ -257,7 +255,10 @@ import core from './core'
import parser from './parser'
export default class Markd {
props = {}
props = {
toc: false
}
__init__() {
/* render */

View File

@ -7,7 +7,7 @@
'use strict'
const HR_LIST = ['=', '-', '_', '*']
const LIST_REG = /^(([\+\-\*])|(\d+\.))\s/
const TODO_REG = /^\[(x|\s)\]\s/
const TODO_REG = /^\-\s\[(x|\s)\]\s/
const log = console.log
const Helper = {
@ -36,7 +36,7 @@ const Helper = {
isTodo(str) {
var v = str.trim()
if (TODO_REG.test(v)) {
return v[1] === 'x' ? 1 : 0
return v[3] === 'x' ? 1 : 0
}
return -1
},
@ -223,6 +223,17 @@ class Tool {
continue
}
// 任务
let todoChecked = Helper.isTodo(it)
if (~todoChecked) {
let word = it.replace(TODO_REG, '').trim()
let stat = todoChecked === 1 ? 'checked' : ''
let txt = todoChecked === 1 ? `<del>${word}</del>` : word
html += `<section><wc-checkbox readonly ${stat}>${txt}</wc-checkbox></section>`
continue
}
// 列表
let listChecked = Helper.isList(it)
if (~listChecked) {
@ -269,17 +280,6 @@ class Tool {
continue
}
// 任务
let todoChecked = Helper.isTodo(it)
if (~todoChecked) {
let word = it.replace(TODO_REG, '').trim()
let stat = todoChecked === 1 ? 'checked' : ''
let txt = todoChecked === 1 ? `<del>${word}</del>` : word
html += `<section><wc-checkbox readonly ${stat}>${txt}</wc-checkbox></section>`
continue
}
// log('it => ', isParagraph, it)
if (isParagraph) {
html += `${it}<br>`

View File

@ -9,7 +9,7 @@
<style lang="scss"></style>
<script>
import '../markdown/index'
import '../markd/index'
export default class Meditor {
props = {