From 03c8df24275b8aae37112a3ce348bfe6d1cd36b8 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Thu, 12 Sep 2019 15:50:06 +0800
Subject: [PATCH 01/11] log
---
public/react/src/common/util/ShareUtil.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/public/react/src/common/util/ShareUtil.js b/public/react/src/common/util/ShareUtil.js
index c4ec8a62a..9a83db552 100644
--- a/public/react/src/common/util/ShareUtil.js
+++ b/public/react/src/common/util/ShareUtil.js
@@ -32,6 +32,7 @@ export function configShareForIndex (path) {
}
export function configShareForPaths () {
if (!wx) return;
+ console.log('configShareForPaths', host)
var shareData = {
title: 'EduCoder - 实践课程',
desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。',
@@ -43,6 +44,8 @@ export function configShareForPaths () {
}
export function configShareForShixuns () {
if (!wx) return;
+ console.log('configShareForShixuns', host)
+
var shareData = {
title: 'EduCoder - 实训项目',
desc: '覆盖不同专业的IT实验和实训,每周更新,无需配置本机实验环境,随时随地开启企业级真实实训。',
@@ -54,6 +57,8 @@ export function configShareForShixuns () {
}
export function configShareForCourses () {
if (!wx) return;
+ console.log('configShareForCourses', host)
+
var shareData = {
title: 'EduCoder - 翻转课堂',
desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
@@ -67,6 +72,8 @@ export function configShareForCourses () {
// detail
export function configShareForCustom (title, desc, path, imgUrl) {
if (!wx) return;
+ console.log('configShareForCustom', host)
+
var shareData = {
title: title,
desc: desc,
From 830af28f587492a04f83f031de8ee998f2fa762e Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Mon, 16 Sep 2019 09:31:25 +0800
Subject: [PATCH 02/11] console.log('configShareForPaths')
---
public/react/src/modules/paths/ShixunPaths.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/public/react/src/modules/paths/ShixunPaths.js b/public/react/src/modules/paths/ShixunPaths.js
index c2bc0d869..d943634b3 100644
--- a/public/react/src/modules/paths/ShixunPaths.js
+++ b/public/react/src/modules/paths/ShixunPaths.js
@@ -8,6 +8,7 @@ class ShixunPath extends Component{
super(props)
}
componentDidMount() {
+ console.log('configShareForPaths')
configShareForPaths()
}
From 377c261d09556430b7581a8477a85e63eb78e5b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Mon, 16 Sep 2019 11:12:39 +0800
Subject: [PATCH 03/11] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?=
=?UTF-8?q?=E8=B0=83=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../shixunHomework/ShixunWorkDetails.js | 42 +++++++++-
.../Shixunworkdetails/ShixunCustomsPass.js | 76 ++++++++++++++++++-
2 files changed, 110 insertions(+), 8 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js
index 967a6ca61..a5a3b5408 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js
@@ -35,10 +35,15 @@ class ShixunWorkDetails extends Component {
}
}).then((result) => {
if (result.status === 200) {
- this.setState({
- data:result.data,
- spinning:false
- })
+ if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) {
+
+ }else{
+ this.setState({
+ data:result.data,
+ spinning:false
+ })
+ }
+
}
}).catch((error) => {
console.log(error)
@@ -50,7 +55,33 @@ class ShixunWorkDetails extends Component {
shixuntypes:type[3]
})
}
+ updatas=()=>{
+ this.setState({
+ spinning:true
+ })
+ let homeworkid=this.props.match.params.homeworkid;
+ let userid=this.props.match.params.userid;
+ let url = "/homework_commons/"+homeworkid+"/code_review_detail.json";
+ axios.get(url,{
+ params: {
+ user_id:userid,
+ }
+ }).then((result) => {
+ if (result.status === 200) {
+ if (result.data.status === 403 || result.data.status === 401 || result.data.status === 407 || result.data.status === 408|| result.data.status === 409 || result.data.status === 500) {
+ }else{
+ this.setState({
+ data:result.data,
+ spinning:false
+ })
+ }
+
+ }
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
goback=(sum)=>{
// let{data}=this.state
// if(sum===1){
@@ -110,6 +141,9 @@ class ShixunWorkDetails extends Component {
this.updatas()}
data={data}
/>
diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
index 8ffa8a1dd..d03453c40 100644
--- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
+++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
@@ -1,10 +1,10 @@
import React, {Component} from "react";
import {WordsBtn} from 'educoder';
-import {Table} from "antd";
+import {Table,InputNumber} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom';
import moment from 'moment';
import { MonacoDiffEditor } from 'react-monaco-editor';
-
+import axios from 'axios';
class ShixunCustomsPass extends Component {
constructor(props) {
@@ -18,10 +18,51 @@ class ShixunCustomsPass extends Component {
componentDidMount() {
}
+ editgame_scores=(e,id,maxsum,code_rate,copy_user_id)=>{
+
+ let{datas}=this.state;
+ let newdatas=datas;
+ let score=e.target.value;
+
+ if(score!=null&&score!=undefined&&score!=""){
+ if(score<0){
+ this.props.showNotification("不能小于0");
+ this.setState({
+ customsids:id
+ })
+ }else if(score>maxsum){
+ this.props.showNotification(`不能大于关卡分值${maxsum}`);
+ this.setState({
+ customsids:id
+ })
+ }else{
+ let work_id=this.props.data.work_id;
+ let url=`/student_works/${work_id}/adjust_review_score.json`
+ axios.post(url,{
+ type:"review",
+ score:score,
+ challenge_id:id,
+ code_rate:code_rate,
+ copy_user_id:copy_user_id
+ }).then((result)=>{
+ if(result.data.status===0){
+ this.props.updatas();
+ this.props.showNotification(result.data.message);
+ }else{
+ this.props.showNotification(result.data.message);
+ }
+ }).catch((error)=>{
+ })
+ }
+ }else{
+ this.props.showNotification("调分为空将不会修改之前的分数");
+ }
+ }
render() {
let {data}=this.props;
- console.log(data)
+ let {customsids}=this.state;
+ // console.log(data)
let datas=[];
data&&data.challenge_list.forEach((item,key)=>{
@@ -33,6 +74,8 @@ class ShixunCustomsPass extends Component {
finishtime:item.copy_username,
elapsedtime:item.copy_end_time===null?"无":item.copy_end_time===undefined?"无":item.copy_end_time===""?"无":moment(item.copy_end_time).format('YYYY-MM-DD HH:mm:ss'),
empvalue:item.code_rate,
+ challenge_id:{id:item.id},
+ copy_user_id:item.copy_user_id
// adjustmentminute:asdasd
})
})
@@ -112,6 +155,20 @@ class ShixunCustomsPass extends Component {
render: (text, record) => (
{record.elapsedtime}
+
+ ),
+ },{
+ title: '调分',
+ key: 'adjustmentminute',
+ dataIndex: 'adjustmentminute',
+
+ render: (text, record) => (
+
+ this.editgame_scores(e,record.challenge_id.id,record.evaluating.all_score,record.empvalue,record.copy_user_id)}
+ // min={0} max={record.game_scores.game_score_full}
+ />
+ {/*查看*/}
),
}, {
@@ -138,7 +195,15 @@ class ShixunCustomsPass extends Component {
// },
-
+ if(this.props.isAdmin()===false){
+ columns.some((item,key)=> {
+ if (item.title === "调分") {
+ columns.splice(key, 1)
+ return true
+ }
+ }
+ )
+ }
return (
@@ -177,6 +242,9 @@ class ShixunCustomsPass extends Component {
.customsPass{
text-align: left !important;
}
+ .ant-table-thead > tr > th, .ant-table-tbody > tr > td {
+ padding: 16px 12px;
+ }
`}
{datas===undefined?"":
Date: Mon, 16 Sep 2019 14:32:36 +0800
Subject: [PATCH 04/11] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?=
=?UTF-8?q?=E8=B0=83=E5=88=86=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/shixunHomework/ShixunWorkDetails.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js
index a5a3b5408..8254b148e 100644
--- a/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js
+++ b/public/react/src/modules/courses/shixunHomework/ShixunWorkDetails.js
@@ -133,8 +133,9 @@ class ShixunWorkDetails extends Component {
非编程类型任务,不参与查重
被查作品:
- {data&&data.username}
- {data&&data.final_score}分
+ {data&&data.username}
+ {data&&data.eff_score===null||data&&data.eff_score===undefined||data&&data.eff_score_full===null||data&&data.eff_score_full===undefined?"":效率分:{data&&data.eff_score}/{data&&data.eff_score_full}}
+ 最终成绩:{data&&data.final_score}分
From c1a6354ec66ee509df7d303ad1c5b5a22742c0d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Mon, 16 Sep 2019 14:47:16 +0800
Subject: [PATCH 05/11] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9F=A5=E9=87=8D?=
=?UTF-8?q?=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../shixunHomework/Shixunworkdetails/ShixunCustomsPass.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
index d03453c40..0b5b04cfc 100644
--- a/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
+++ b/public/react/src/modules/courses/shixunHomework/Shixunworkdetails/ShixunCustomsPass.js
@@ -164,10 +164,12 @@ class ShixunCustomsPass extends Component {
render: (text, record) => (
-
+ {record.copy_user_id===null?"": this.editgame_scores(e,record.challenge_id.id,record.evaluating.all_score,record.empvalue,record.copy_user_id)}
// min={0} max={record.game_scores.game_score_full}
- />
+ />}
+
{/*查看*/}
),
From 4b1066d73aa1a78312ba0d82b5383f1ae8a68dd4 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Mon, 16 Sep 2019 17:35:58 +0800
Subject: [PATCH 06/11] isWeiXin
---
public/react/public/index.html | 5 +++--
public/react/src/common/Env.js | 4 +++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/public/react/public/index.html b/public/react/public/index.html
index 166760eab..4fd2c4356 100755
--- a/public/react/public/index.html
+++ b/public/react/public/index.html
@@ -34,8 +34,9 @@
// location.href = './compatibility'
location.href = '/compatibility.html'
}
- const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
- if (isMobile) {
+ // const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
+ const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));
+ if (isWeiXin) {
document.write('
diff --git a/public/react/src/common/Env.js b/public/react/src/common/Env.js
index 283e82c48..c80497509 100644
--- a/public/react/src/common/Env.js
+++ b/public/react/src/common/Env.js
@@ -3,4 +3,6 @@ export function isDev() {
}
// const isMobile
-export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
\ No newline at end of file
+export const isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
+
+// const isWeiXin = (/MicroMessenger/i.test(navigator.userAgent.toLowerCase()));
From fd90587a0d827b40d56deecd6d03371e1c5b290d Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 17 Sep 2019 10:10:21 +0800
Subject: [PATCH 07/11] share
---
public/react/src/App.js | 59 +---------
public/react/src/common/util/ShareUtil.js | 136 +++++++++++++++-------
2 files changed, 93 insertions(+), 102 deletions(-)
diff --git a/public/react/src/App.js b/public/react/src/App.js
index 17ee34255..e243553bb 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -9,7 +9,7 @@ import {
Route,
Switch
} from 'react-router-dom';
-import axios from 'axios';
+
import '@icedesign/base/dist/ICEDesignBase.css';
import '@icedesign/base/index.scss';
@@ -37,7 +37,7 @@ import {MuiThemeProvider, createMuiTheme} from 'material-ui/styles';
import history from './history';
-import {SnackbarHOC, configShareForIndex} from 'educoder'
+import {SnackbarHOC} from 'educoder'
import {initAxiosInterceptors} from './AppConfig'
@@ -298,61 +298,7 @@ class App extends Component {
mydisplay:true,
})
};
- initWXShare = () => {
- if (window.wx) {
- const wx = window.wx
- const url = '/wechats/js_sdk_signature.json'
- const currentUrl = window.location.href.split('#')[0]
- // window.encodeURIComponent()
- axios.post(url, {
- url: window.__testUrl || currentUrl,
- }).then((response) => {
- console.log('got res')
- const data = response.data;
- wx.config({
- debug: false,
- appId: data.appid,
- timestamp: data.timestamp,
- nonceStr: data.noncestr,
- signature: data.signature,
- jsApiList: [
- 'onMenuShareTimeline',//
- 'onMenuShareAppMessage',
- 'onMenuShareQQ',
- 'onMenuShareWeibo',
- 'onMenuShareQZone'
- ]
- });
- wx.ready(function () {
- console.log('wx is ready')
- // var shareData = {
- // title: 'EduCoder - 首页',
- // desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
- // link: currentUrl,
- // imgUrl: window.__testImageUrl
- // || (currentUrl.endsWith('/') ? currentUrl : currentUrl + '/') + 'react/build/images/share_logo_icon.jpg'
- // };
-
- // wx.onMenuShareAppMessage(shareData);//分享给好友
- // wx.onMenuShareTimeline(shareData);//分享到朋友圈
- // wx.onMenuShareQQ(shareData);//分享给手机QQ
- // wx.onMenuShareWeibo(shareData);//分享腾讯微博
- // wx.onMenuShareQZone(shareData);//分享到QQ空间
-
- configShareForIndex('/')
- });
- wx.error(function (res) {
- console.log('wx is error')
- console.log(res)
- //alert(res.errMsg);//错误提示
-
- });
- }).catch((error) => {
- console.log(error)
- })
- }
- }
disableVideoContextMenu = () => {
window.$( "body" ).on( "mousedown", "video", function(event) {
if(event.which === 3) {
@@ -374,7 +320,6 @@ class App extends Component {
});
initAxiosInterceptors(this.props)
- this.initWXShare()
//
// axios.interceptors.response.use((response) => {
// // console.log("response"+response);
diff --git a/public/react/src/common/util/ShareUtil.js b/public/react/src/common/util/ShareUtil.js
index 9a83db552..4e6c06d59 100644
--- a/public/react/src/common/util/ShareUtil.js
+++ b/public/react/src/common/util/ShareUtil.js
@@ -1,3 +1,4 @@
+import axios from 'axios'
const host = window.location.protocol + '//' + window.location.host
const wx = window.wx
function share(shareData) {
@@ -11,7 +12,47 @@ function share(shareData) {
console.log(e)
}
}
+const urlDoneMap = {}
+function requestForSignatrue (callback) {
+ const currentUrl = window.location.href.split('#')[0]
+ if (window.wx && !urlDoneMap[currentUrl]) {
+ const wx = window.wx
+ const url = '/wechats/js_sdk_signature.json'
+ urlDoneMap[currentUrl] = true
+ // window.encodeURIComponent()
+ axios.post(url, {
+ url: window.__testUrl || currentUrl,
+ }).then((response) => {
+ console.log('got res')
+ const data = response.data;
+ wx.config({
+ debug: false,
+ appId: data.appid,
+ timestamp: data.timestamp,
+ nonceStr: data.noncestr,
+ signature: data.signature,
+ jsApiList: [
+ 'onMenuShareTimeline',//
+ 'onMenuShareAppMessage',
+ 'onMenuShareQQ',
+ 'onMenuShareWeibo',
+ 'onMenuShareQZone'
+ ]
+ });
+ wx.ready(function () {
+ callback && callback()
+ });
+ wx.error(function (res) {
+ console.log('wx is error')
+ console.log(res)
+ //alert(res.errMsg);//错误提示
+ });
+ }).catch((error) => {
+ console.log(error)
+ })
+ }
+}
/**
实践课程 平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。
实训项目 覆盖不同专业的IT实验和实训,每周更新,无需配置本机实验环境,随时随地开启企业级真实实训。
@@ -19,67 +60,72 @@ function share(shareData) {
单个课程和实训 获取课程/实训的简介 该课程或者实训展示的缩略图
*/
-export function configShareForIndex (path) {
- if (!wx) return;
- var shareData = {
+export function configShareForIndex (path) {
+ requestForSignatrue(() => {
+ var shareData = {
title: 'EduCoder - 首页',
desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
link: host + (path || ''),
imgUrl: window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
- };
- share(shareData)
+ };
+ share(shareData)
+ })
}
export function configShareForPaths () {
- if (!wx) return;
- console.log('configShareForPaths', host)
- var shareData = {
- title: 'EduCoder - 实践课程',
- desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。',
- link: `${host}/paths`,
- imgUrl: window.__testImageUrl
- || host + '/react/build/images/share_logo_icon.jpg'
- };
- share(shareData)
+ requestForSignatrue(() => {
+ console.log('configShareForPaths', host)
+ var shareData = {
+ title: 'EduCoder - 实践课程',
+ desc: '平台提供涵盖基础入门、案例实践和创新应用的完整实训项目体系,通过由浅入深的实训路径,帮助学生快速提升实战能力。',
+ link: `${host}/paths`,
+ imgUrl: window.__testImageUrl
+ || host + '/react/build/images/share_logo_icon.jpg'
+ };
+ share(shareData)
+ })
}
export function configShareForShixuns () {
- if (!wx) return;
- console.log('configShareForShixuns', host)
+ requestForSignatrue(() => {
+ console.log('configShareForShixuns', host)
- var shareData = {
- title: 'EduCoder - 实训项目',
- desc: '覆盖不同专业的IT实验和实训,每周更新,无需配置本机实验环境,随时随地开启企业级真实实训。',
- link: `${host}/shixuns`,
- imgUrl: window.__testImageUrl
- || host + '/react/build/images/share_logo_icon.jpg'
- };
- share(shareData)
+ var shareData = {
+ title: 'EduCoder - 实训项目',
+ desc: '覆盖不同专业的IT实验和实训,每周更新,无需配置本机实验环境,随时随地开启企业级真实实训。',
+ link: `${host}/shixuns`,
+ imgUrl: window.__testImageUrl
+ || host + '/react/build/images/share_logo_icon.jpg'
+ };
+ share(shareData)
+ })
}
export function configShareForCourses () {
- if (!wx) return;
- console.log('configShareForCourses', host)
+ requestForSignatrue(() => {
+ console.log('configShareForCourses', host)
- var shareData = {
- title: 'EduCoder - 翻转课堂',
- desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
- link: `${host}/courses`,
- imgUrl: window.__testImageUrl
- || host + '/react/build/images/share_logo_icon.jpg'
- };
- share(shareData)
+ var shareData = {
+ title: 'EduCoder - 翻转课堂',
+ desc: '自动评测实训任务,支持技能统计,提供教学活动分析报告,减轻教师和助教的辅导压力,免去作业发布和批改的困扰,实时了解学生学习情况,全面提升教师施教效率和水平。',
+ link: `${host}/courses`,
+ imgUrl: window.__testImageUrl
+ || host + '/react/build/images/share_logo_icon.jpg'
+ };
+ share(shareData)
+ })
}
// detail
export function configShareForCustom (title, desc, path, imgUrl) {
- if (!wx) return;
- console.log('configShareForCustom', host)
+ requestForSignatrue(() => {
+ console.log('configShareForCustom', host)
- var shareData = {
- title: title,
- desc: desc,
- link: `${host}/${path}`,
- imgUrl: imgUrl || window.__testImageUrl
- || host + '/react/build/images/share_logo_icon.jpg'
- };
- share(shareData)
+ var shareData = {
+ title: title,
+ desc: desc,
+ link: `${host}/${path}`,
+ imgUrl: imgUrl || window.__testImageUrl
+ || host + '/react/build/images/share_logo_icon.jpg'
+ };
+ share(shareData)
+ })
}
From 7fdc9df090f598c73fb2230e463a0c99f0f830d1 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 17 Sep 2019 10:25:36 +0800
Subject: [PATCH 08/11] path
---
public/react/src/modules/tpm/challengesnew/TPMMDEditor.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
index ba4f1bc21..3c4b48fc0 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
@@ -16,8 +16,8 @@ require('codemirror/lib/codemirror.css');
let origin = getUrl();
-let path = getUrl("/editormd/lib/")
-
+let path = '/editormd/lib/'
+ path = getUrl("/editormd/lib/")
const $ = window.$;
let timeout;
From c8abe26abb0b7ce627a19921cd21d1ee4593c12d Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 17 Sep 2019 10:29:42 +0800
Subject: [PATCH 09/11] s
---
public/react/src/common/util/ShareUtil.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/public/react/src/common/util/ShareUtil.js b/public/react/src/common/util/ShareUtil.js
index 4e6c06d59..e591effaf 100644
--- a/public/react/src/common/util/ShareUtil.js
+++ b/public/react/src/common/util/ShareUtil.js
@@ -63,11 +63,11 @@ function requestForSignatrue (callback) {
export function configShareForIndex (path) {
requestForSignatrue(() => {
var shareData = {
- title: 'EduCoder - 首页',
- desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
- link: host + (path || ''),
- imgUrl: window.__testImageUrl
- || host + '/react/build/images/share_logo_icon.jpg'
+ title: 'EduCoder - 首页',
+ desc: 'Educoder是一个面向计算机类的互联网IT教育和实战平台,提供企业级工程实训,以实现工程化专业教学的自动化和智能化。高校和企业人员可以在此开展计算机实践性教学活动,将传统的知识传授和时兴的工程实战一体化。',
+ link: host + (path || ''),
+ imgUrl: window.__testImageUrl
+ || host + '/react/build/images/share_logo_icon.jpg'
};
share(shareData)
})
From d01666c793f0a4e4eed8d90dc4dfd4e6c52ffbdb Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 17 Sep 2019 10:29:57 +0800
Subject: [PATCH 10/11] =?UTF-8?q?=E5=85=89=E6=A0=87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/tpm/challengesnew/TPMMDEditor.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
index 3c4b48fc0..c4a08e171 100644
--- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
+++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js
@@ -171,7 +171,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
$("#" + _id + " [type=\"inline\"]").bind("click", function () {
_editorName.cm.replaceSelection("`$$$$`");
var __Cursor = _editorName.cm.getDoc().getCursor();
- _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
+ _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3);
_editorName.cm.focus();
});
$("[type=\"inline\"]").attr("title", "行内公式");
From 27b9217fc8fcf30900a1f6e320781a4eb9da2d85 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Tue, 17 Sep 2019 10:54:31 +0800
Subject: [PATCH 11/11] =?UTF-8?q?marked=E5=8D=87=E7=BA=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/editormd/lib/marked.min.js | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/public/editormd/lib/marked.min.js b/public/editormd/lib/marked.min.js
index 4db085adb..88ec3e856 100644
--- a/public/editormd/lib/marked.min.js
+++ b/public/editormd/lib/marked.min.js
@@ -10,7 +10,5 @@
out+=this.renderer.em(this.output(cap[2]||cap[1])) -->
out+=this.renderer.em(this.output(cap[2]||cap[1]), cap.input)
*/
-(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment *(?:\n|\s*$)|closed *(?:\n{2,}|\s*$)|closing *(?:\n{2,}|\s*$))/,def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose){loose=next}}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);
-this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if((!bq&&top)&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else{if(this.options.pedantic){this.rules=inline.pedantic}}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]), cap.input);continue
-}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants){return text}return text.replace(/--/g,"\u2014").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201c").replace(/"/g,"\u201d").replace(/\.{3}/g,"\u2026")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i0.5){ch="x"+ch.toString(16)}out+=""+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return""+(escaped?code:escape(code,true))+"\n
"}return''+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"\n"+quote+"
\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+""+type+">\n"};Renderer.prototype.listitem=function(text){return""+text+"\n"};Renderer.prototype.paragraph=function(text){return""+text+"
\n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
\n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"
\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+""+type+">\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+"
"};Renderer.prototype.br=function(){return this.options.xhtml?"
":"
"};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0||prot.indexOf("vbscript:")===0){return""}}var out='"+text+"";return out};Renderer.prototype.image=function(href,title,text){var out='
":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon"){return":"}if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name){return new RegExp(regex,opt)}val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:"+escape(e.message+"",true)+"
"}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else{if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}}).call(function(){return this||(typeof window!=="undefined"?window:global)}());
+// 0.4.0 /^ *(#{1,6}) ——》/^ *(#{1,6}) 去掉了一个空格 TODO 行内公式带_
+!function(e){"use strict";var t={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:d,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6})*([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:d,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$)|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=\\h*\\n)[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:d,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function n(e){this.tokens=[],this.tokens.links={},this.options=e||m.defaults,this.rules=t.normal,this.options.pedantic?this.rules=t.pedantic:this.options.gfm&&(this.options.tables?this.rules=t.tables:this.rules=t.gfm)}t._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,t._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,t.def=p(t.def).replace("label",t._label).replace("title",t._title).getRegex(),t.bullet=/(?:[*+-]|\d+\.)/,t.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,t.item=p(t.item,"gm").replace(/bull/g,t.bullet).getRegex(),t.list=p(t.list).replace(/bull/g,t.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+t.def.source+")").getRegex(),t._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",t._comment=//,t.html=p(t.html,"i").replace("comment",t._comment).replace("tag",t._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),t.paragraph=p(t.paragraph).replace("hr",t.hr).replace("heading",t.heading).replace("lheading",t.lheading).replace("tag",t._tag).getRegex(),t.blockquote=p(t.blockquote).replace("paragraph",t.paragraph).getRegex(),t.normal=f({},t),t.gfm=f({},t.normal,{fences:/^ *(`{3,}|~{3,})[ \.]*(\S+)? *\n([\s\S]*?)\n? *\1 *(?:\n+|$)/,paragraph:/^/,heading:/^ *(#{1,6})+([^\n]+?) *#* *(?:\n+|$)/}),t.gfm.paragraph=p(t.paragraph).replace("(?!","(?!"+t.gfm.fences.source.replace("\\1","\\2")+"|"+t.list.source.replace("\\1","\\3")+"|").getRegex(),t.tables=f({},t.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),t.pedantic=f({},t.normal,{html:p("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",t._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),n.rules=t,n.lex=function(e,t){return new n(t).lex(e)},n.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},n.prototype.token=function(e,n){var r,s,i,l,o,a,h,p,u,c,g,d,f;for(e=e.replace(/^ +$/gm,"");e;)if((i=this.rules.newline.exec(e))&&(e=e.substring(i[0].length),i[0].length>1&&this.tokens.push({type:"space"})),i=this.rules.code.exec(e))e=e.substring(i[0].length),i=i[0].replace(/^ {4}/gm,""),this.tokens.push({type:"code",text:this.options.pedantic?i:i.replace(/\n+$/,"")});else if(i=this.rules.fences.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"code",lang:i[2],text:i[3]||""});else if(i=this.rules.heading.exec(e))e=e.substring(i[0].length),this.tokens.push({type:"heading",depth:i[1].length,text:i[2]});else if(n&&(i=this.rules.nptable.exec(e))&&(a={type:"table",header:b(i[1].replace(/^ *| *\| *$/g,"")),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/\n$/,"").split("\n"):[]}).header.length===a.align.length){for(e=e.substring(i[0].length),p=0;p ?/gm,""),this.token(i,n),this.tokens.push({type:"blockquote_end"});else if(i=this.rules.list.exec(e)){for(e=e.substring(i[0].length),g=(l=i[2]).length>1,this.tokens.push({type:"list_start",ordered:g,start:g?+l:""}),r=!1,c=(i=i[0].match(this.rules.item)).length,p=0;p1&&o.length>1||(e=i.slice(p+1).join("\n")+e,p=c-1)),s=r||/\n\n(?!\s*$)/.test(a),p!==c-1&&(r="\n"===a.charAt(a.length-1),s||(s=r)),f=void 0,(d=/^\[[ xX]\] /.test(a))&&(f=" "!==a[1],a=a.replace(/^\[[ xX]\] +/,"")),this.tokens.push({type:s?"loose_item_start":"list_item_start",task:d,checked:f}),this.token(a,!1),this.tokens.push({type:"list_item_end"});this.tokens.push({type:"list_end"})}else if(i=this.rules.html.exec(e))e=e.substring(i[0].length),this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:!this.options.sanitizer&&("pre"===i[1]||"script"===i[1]||"style"===i[1]),text:i[0]});else if(n&&(i=this.rules.def.exec(e)))e=e.substring(i[0].length),i[3]&&(i[3]=i[3].substring(1,i[3].length-1)),u=i[1].toLowerCase().replace(/\s+/g," "),this.tokens.links[u]||(this.tokens.links[u]={href:i[2],title:i[3]});else if(n&&(i=this.rules.table.exec(e))&&(a={type:"table",header:b(i[1].replace(/^ *| *\| *$/g,"")),align:i[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:i[3]?i[3].replace(/(?: *\| *)?\n$/,"").split("\n"):[]}).header.length===a.align.length){for(e=e.substring(i[0].length),p=0;p?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:d,tag:"^comment|^[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)|^__([^\s])__(?!_)|^\*\*([^\s])\*\*(?!\*)/,em:/^_([^\s][\s\S]*?[^\s_])_(?!_)|^_([^\s_][\s\S]*?[^\s])_(?!_)|^\*([^\s][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*][\s\S]*?[^\s])\*(?!\*)|^_([^\s_])_(?!_)|^\*([^\s*])\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`]?)\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:d,text:/^[\s\S]+?(?=[\\/g,">").replace(/"/g,""").replace(/'/g,"'")}function h(e){return e.replace(/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}function p(e,t){return e=e.source||e,t=t||"",{replace:function(t,n){return n=(n=n.source||n).replace(/(^|[^\[])\^/g,"$1"),e=e.replace(t,n),this},getRegex:function(){return new RegExp(e,t)}}}function u(e,t){return c[" "+e]||(/^[^:]+:\/*[^/]*$/.test(e)?c[" "+e]=e+"/":c[" "+e]=e.replace(/[^/]*$/,"")),e=c[" "+e],"//"===t.slice(0,2)?e.replace(/:[\s\S]*/,":")+t:"/"===t.charAt(0)?e.replace(/(:\/*[^/]*)[\s\S]*/,"$1")+t:e+t}r._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,r._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,r._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,r.autolink=p(r.autolink).replace("scheme",r._scheme).replace("email",r._email).getRegex(),r._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,r.tag=p(r.tag).replace("comment",t._comment).replace("attribute",r._attribute).getRegex(),r._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|[^\[\]\\])*?/,r._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|(?:\\[()]?|\([^\s\x00-\x1f()\\]*\)|[^\s\x00-\x1f()\\])*?)/,r._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,r.link=p(r.link).replace("label",r._label).replace("href",r._href).replace("title",r._title).getRegex(),r.reflink=p(r.reflink).replace("label",r._label).getRegex(),r.normal=f({},r),r.pedantic=f({},r.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:p(/^!?\[(label)\]\((.*?)\)/).replace("label",r._label).getRegex(),reflink:p(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",r._label).getRegex()}),r.gfm=f({},r.normal,{escape:p(r.escape).replace("])","~|])").getRegex(),url:p(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("email",r._email).getRegex(),_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:p(r.text).replace("]|","~]|").replace("|","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|").getRegex()}),r.breaks=f({},r.gfm,{br:p(r.br).replace("{2,}","*").getRegex(),text:p(r.gfm.text).replace("{2,}","*").getRegex()}),s.rules=r,s.output=function(e,t,n){return new s(t,n).output(e)},s.prototype.output=function(e){for(var t,n,r,i,l,o="";e;)if(l=this.rules.escape.exec(e))e=e.substring(l[0].length),o+=l[1];else if(l=this.rules.autolink.exec(e))e=e.substring(l[0].length),r="@"===l[2]?"mailto:"+(n=a(this.mangle(l[1]))):n=a(l[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(l=this.rules.url.exec(e))){if(l=this.rules.tag.exec(e))!this.inLink&&/^/i.test(l[0])&&(this.inLink=!1),e=e.substring(l[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(l[0]):a(l[0]):l[0];else if(l=this.rules.link.exec(e))e=e.substring(l[0].length),this.inLink=!0,r=l[2],this.options.pedantic?(t=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r))?(r=t[1],i=t[3]):i="":i=l[3]?l[3].slice(1,-1):"",r=r.trim().replace(/^<([\s\S]*)>$/,"$1"),o+=this.outputLink(l,{href:s.escapes(r),title:s.escapes(i)}),this.inLink=!1;else if((l=this.rules.reflink.exec(e))||(l=this.rules.nolink.exec(e))){if(e=e.substring(l[0].length),t=(l[2]||l[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=l[0].charAt(0),e=l[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(l,t),this.inLink=!1}else if(l=this.rules.strong.exec(e))e=e.substring(l[0].length),o+=this.renderer.strong(this.output(l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.em.exec(e))e=e.substring(l[0].length),o+=this.renderer.em(this.output(l[6]||l[5]||l[4]||l[3]||l[2]||l[1]));else if(l=this.rules.code.exec(e))e=e.substring(l[0].length),o+=this.renderer.codespan(a(l[2].trim(),!0));else if(l=this.rules.br.exec(e))e=e.substring(l[0].length),o+=this.renderer.br();else if(l=this.rules.del.exec(e))e=e.substring(l[0].length),o+=this.renderer.del(this.output(l[1]));else if(l=this.rules.text.exec(e))e=e.substring(l[0].length),o+=this.renderer.text(a(this.smartypants(l[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else l[0]=this.rules._backpedal.exec(l[0])[0],e=e.substring(l[0].length),"@"===l[2]?r="mailto:"+(n=a(l[0])):(n=a(l[0]),r="www."===l[1]?"http://"+n:n),o+=this.renderer.link(r,null,n);return o},s.escapes=function(e){return e?e.replace(s.rules._escapes,"$1"):e},s.prototype.outputLink=function(e,t){var n=t.href,r=t.title?a(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,a(e[1]))},s.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},s.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s.5&&(t="x"+t.toString(16)),n+=""+t+";";return n},i.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?''+(n?e:a(e,!0))+"
\n":""+(n?e:a(e,!0))+"
"},i.prototype.blockquote=function(e){return"\n"+e+"
\n"},i.prototype.html=function(e){return e},i.prototype.heading=function(e,t,n){return this.options.headerIds?"\n":""+e+"\n"},i.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"},i.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+r+">\n"},i.prototype.listitem=function(e){return""+e+"\n"},i.prototype.checkbox=function(e){return" "},i.prototype.paragraph=function(e){return""+e+"
\n"},i.prototype.table=function(e,t){return t&&(t=""+t+""),"\n"},i.prototype.tablerow=function(e){return"\n"+e+"
\n"},i.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"},i.prototype.strong=function(e){return""+e+""},i.prototype.em=function(e){return""+e+""},i.prototype.codespan=function(e){return""+e+"
"},i.prototype.br=function(){return this.options.xhtml?"
":"
"},i.prototype.del=function(e){return""+e+""},i.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(h(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return n}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:")||0===r.indexOf("data:"))return n}this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return n}var s='"+n+""},i.prototype.image=function(e,t,n){this.options.baseUrl&&!g.test(e)&&(e=u(this.options.baseUrl,e));var r='
":">"},i.prototype.text=function(e){return e},l.prototype.strong=l.prototype.em=l.prototype.codespan=l.prototype.del=l.prototype.text=function(e){return e},l.prototype.link=l.prototype.image=function(e,t,n){return""+n},l.prototype.br=function(){return""},o.parse=function(e,t){return new o(t).parse(e)},o.prototype.parse=function(e){this.inline=new s(e.links,this.options),this.inlineText=new s(e.links,f({},this.options,{renderer:new l})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},o.prototype.next=function(){return this.token=this.tokens.pop()},o.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},o.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},o.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,h(this.inlineText.output(this.token.text)));case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;et)n.splice(t);else for(;n.lengthAn error occurred:"+a(e.message+"",!0)+"
";throw e}}d.exec=d,m.options=m.setOptions=function(e){return f(m.defaults,e),m},m.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new i,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},m.defaults=m.getDefaults(),m.Parser=o,m.parser=o.parse,m.Renderer=i,m.TextRenderer=l,m.Lexer=n,m.lexer=n.lex,m.InlineLexer=s,m.inlineLexer=s.output,m.parse=m,"undefined"!=typeof module&&"object"==typeof exports?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):e.marked=m}(this||("undefined"!=typeof window?window:global));